aboutsummaryrefslogtreecommitdiff
path: root/bfd/elflink.c
diff options
context:
space:
mode:
authorAlexandre Oliva <aoliva@redhat.com>2004-06-21 14:45:42 +0000
committerAlexandre Oliva <aoliva@redhat.com>2004-06-21 14:45:42 +0000
commitaee6f5b4bd1c978694bede743979c0c4f560d46b (patch)
treea185bf850c2fe9563a1fbf0a89a5c6b981cddbe4 /bfd/elflink.c
parent05576f107c90440f15fa8a03e009c3f541af0b75 (diff)
downloadfsf-binutils-gdb-aee6f5b4bd1c978694bede743979c0c4f560d46b.zip
fsf-binutils-gdb-aee6f5b4bd1c978694bede743979c0c4f560d46b.tar.gz
fsf-binutils-gdb-aee6f5b4bd1c978694bede743979c0c4f560d46b.tar.bz2
bfd/ChangeLog:
* elf-bfd.h (struct elf_backend_data): Added elf_backend_omit_section_dynsym. (_bfd_elf_link_omit_section_dynsym): Declare. * elf32-frv.c (_frvfdpic_link_omit_section_dynsym): New. (elf_backend_omit_section_dynsym): Use it for frvfdpic. * elflink.c (_bfd_elf_link_omit_section_dynsym): Split out of... (_bfd_elf_link_renumber_dynsyms): ... this function. * elfxx-target.h (elf_backend_omit_section_dynsym): Default to _bfd_elf_link_omit_section_dynsym). (elfNN_bed): Added elf_backend_omit_section_dynsym. ld/ChangeLog: * emulparams/elf32frvfd.sh (GENERATE_PIE_SCRIPT): Set to yes. ld/testsuite/ChangeLog: * ld-frv/fdpic-pie-1.d: Adjust for pie-specific link script. * ld-frv/fdpic-pie-2.d: Likewise. * ld-frv/fdpic-pie-6.d: Likewise. * ld-frv/fdpic-pie-7.d: Likewise. * ld-frv/fdpic-pie-8.d: Likewise. * ld-frv/fdpic-shared-1.d: Likewise. * ld-frv/fdpic-shared-2.d: Likewise. * ld-frv/fdpic-shared-3.d: Likewise. * ld-frv/fdpic-shared-4.d: Likewise. * ld-frv/fdpic-shared-5.d: Likewise. * ld-frv/fdpic-shared-6.d: Likewise. * ld-frv/fdpic-shared-7.d: Likewise. * ld-frv/fdpic-shared-8.d: Likewise. * ld-frv/fdpic-shared-local-2.d: Likewise. * ld-frv/fdpic-shared-local-8.d: Likewise.
Diffstat (limited to 'bfd/elflink.c')
-rw-r--r--bfd/elflink.c70
1 files changed, 41 insertions, 29 deletions
diff --git a/bfd/elflink.c b/bfd/elflink.c
index 37b113b..622d406 100644
--- a/bfd/elflink.c
+++ b/bfd/elflink.c
@@ -608,6 +608,43 @@ elf_link_renumber_hash_table_dynsyms (struct elf_link_hash_entry *h,
return TRUE;
}
+/* Return true if the dynamic symbol for a given section should be
+ omitted when creating a shared library. */
+bfd_boolean
+_bfd_elf_link_omit_section_dynsym (bfd *output_bfd ATTRIBUTE_UNUSED,
+ struct bfd_link_info *info,
+ asection *p)
+{
+ switch (elf_section_data (p)->this_hdr.sh_type)
+ {
+ case SHT_PROGBITS:
+ case SHT_NOBITS:
+ /* If sh_type is yet undecided, assume it could be
+ SHT_PROGBITS/SHT_NOBITS. */
+ case SHT_NULL:
+ if (strcmp (p->name, ".got") == 0
+ || strcmp (p->name, ".got.plt") == 0
+ || strcmp (p->name, ".plt") == 0)
+ {
+ asection *ip;
+ bfd *dynobj = elf_hash_table (info)->dynobj;
+
+ if (dynobj != NULL
+ && (ip = bfd_get_section_by_name (dynobj, p->name))
+ != NULL
+ && (ip->flags & SEC_LINKER_CREATED)
+ && ip->output_section == p)
+ return TRUE;
+ }
+ return FALSE;
+
+ /* There shouldn't be section relative relocations
+ against any other section. */
+ default:
+ return TRUE;
+ }
+}
+
/* Assign dynsym indices. In a shared library we generate a section
symbol for each output section, which come first. Next come all of
the back-end allocated local dynamic syms, followed by the rest of
@@ -620,38 +657,13 @@ _bfd_elf_link_renumber_dynsyms (bfd *output_bfd, struct bfd_link_info *info)
if (info->shared)
{
+ const struct elf_backend_data *bed = get_elf_backend_data (output_bfd);
asection *p;
for (p = output_bfd->sections; p ; p = p->next)
if ((p->flags & SEC_EXCLUDE) == 0
- && (p->flags & SEC_ALLOC) != 0)
- switch (elf_section_data (p)->this_hdr.sh_type)
- {
- case SHT_PROGBITS:
- case SHT_NOBITS:
- /* If sh_type is yet undecided, assume it could be
- SHT_PROGBITS/SHT_NOBITS. */
- case SHT_NULL:
- if (strcmp (p->name, ".got") == 0
- || strcmp (p->name, ".got.plt") == 0
- || strcmp (p->name, ".plt") == 0)
- {
- asection *ip;
- bfd *dynobj = elf_hash_table (info)->dynobj;
-
- if (dynobj != NULL
- && (ip = bfd_get_section_by_name (dynobj, p->name))
- != NULL
- && (ip->flags & SEC_LINKER_CREATED)
- && ip->output_section == p)
- continue;
- }
- elf_section_data (p)->dynindx = ++dynsymcount;
- break;
- /* There shouldn't be section relative relocations
- against any other section. */
- default:
- break;
- }
+ && (p->flags & SEC_ALLOC) != 0
+ && !(*bed->elf_backend_omit_section_dynsym) (output_bfd, info, p))
+ elf_section_data (p)->dynindx = ++dynsymcount;
}
if (elf_hash_table (info)->dynlocal)