summaryrefslogtreecommitdiff
path: root/bfd/elf32-m32r.c
diff options
context:
space:
mode:
authorAlan Modra <amodra@bigpond.net.au>2006-02-21 01:51:59 +0000
committerAlan Modra <amodra@bigpond.net.au>2006-02-21 01:51:59 +0000
commit7e5a980e6ed0e61594eaa1617eba504366908562 (patch)
treef0d080de57ce619547df7a4a43c1a16317743b47 /bfd/elf32-m32r.c
parent632244759a644b3f7b833d0757b088518923469c (diff)
downloadbinutils-redhat-7e5a980e6ed0e61594eaa1617eba504366908562.tar.gz
PR ld/2218
* elf32-arm.c (allocate_dynrelocs): Ensure undef weak sym in pie is dynamic. * elf32-hppa.c (allocate_dynrelocs): Likewise. * elf32-i386.c (allocate_dynrelocs): Likewise. * elf32-s390.c (allocate_dynrelocs): Likewise. * elf32-sh.c (allocate_dynrelocs): Likewise. * elf64-s390.c (allocate_dynrelocs): Likewise. * elf64-x86-64.c (allocate_dynrelocs): Likewise. * elf32-m32r.c (allocate_dynrelocs): Likewise. Discard relocs on undef weak with non-default visibility too. * elfxx-sparc.c (allocate_dynrelocs): Ditto.
Diffstat (limited to 'bfd/elf32-m32r.c')
-rw-r--r--bfd/elf32-m32r.c22
1 files changed, 20 insertions, 2 deletions
diff --git a/bfd/elf32-m32r.c b/bfd/elf32-m32r.c
index a4c08db227..6a8c5bfdaa 100644
--- a/bfd/elf32-m32r.c
+++ b/bfd/elf32-m32r.c
@@ -1,6 +1,6 @@
/* M32R-specific support for 32-bit ELF.
- Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
- Free Software Foundation, Inc.
+ Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
+ 2006 Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
@@ -2101,6 +2101,24 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void * inf)
pp = &p->next;
}
}
+
+ /* Also discard relocs on undefined weak syms with non-default
+ visibility. */
+ if (eh->dyn_relocs != NULL
+ && h->root.type == bfd_link_hash_undefweak)
+ {
+ if (ELF_ST_VISIBILITY (h->other) != STV_DEFAULT)
+ eh->dyn_relocs = NULL;
+
+ /* Make sure undefined weak symbols are output as a dynamic
+ symbol in PIEs. */
+ else if (h->dynindx == -1
+ && !h->forced_local)
+ {
+ if (! bfd_elf_link_record_dynamic_symbol (info, h))
+ return FALSE;
+ }
+ }
}
else
{