diff options
author | Alan Modra <amodra@gmail.com> | 2014-10-13 15:18:21 +1030 |
---|---|---|
committer | Alan Modra <amodra@gmail.com> | 2014-10-13 22:58:44 +1030 |
commit | 5b69e3572d1ee8e8e6e1991fd07f87a96c48746d (patch) | |
tree | e5688986dcaa7b0882440ee3f568f55f3cb03e58 /bfd/elflink.c | |
parent | c780cc2f5062451a568458b6ef9b8aef7cc1dd8a (diff) | |
download | gdb-5b69e3572d1ee8e8e6e1991fd07f87a96c48746d.zip gdb-5b69e3572d1ee8e8e6e1991fd07f87a96c48746d.tar.gz gdb-5b69e3572d1ee8e8e6e1991fd07f87a96c48746d.tar.bz2 |
Run eh_frame optimisation for relocatable link
The idea here is to drop .eh_frame FDEs corresponding to dropped
comdat group sections or linkonce sections, but not perform changes in
encoding.
bfd/
PR 17467
* elf-eh-frame.c (ENSURE_NO_RELOCS): Don't stop at first NONE reloc.
(_bfd_elf_parse_eh_frame): When relocatable output, don't set
flags enabling conversion of CIEs and FDEs to use relative encoding.
(find_merged_cie): Similarly.
(_bfd_elf_write_section_eh_frame): Don't edit FDEs when
relocatable, except for CIE pointer.
* elflink.c (bfd_elf_reloc_symbol_deleted_p): Return true for
relocs against symbols in dropped comdat group sections.
(bfd_elf_discard_info): Do some eh_frame optimisation when
relocatable.
ld/
* ldlang.c (lang_add_section): Set up map_head.s and map_tail.s when
relocatable.
Diffstat (limited to 'bfd/elflink.c')
-rw-r--r-- | bfd/elflink.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/bfd/elflink.c b/bfd/elflink.c index d33efe0..c8068c0 100644 --- a/bfd/elflink.c +++ b/bfd/elflink.c @@ -12602,10 +12602,10 @@ bfd_elf_reloc_symbol_deleted_p (bfd_vma offset, void *cookie) if ((h->root.type == bfd_link_hash_defined || h->root.type == bfd_link_hash_defweak) - && discarded_section (h->root.u.def.section)) + && (h->root.u.def.section->owner != rcookie->abfd + || h->root.u.def.section->kept_section != NULL + || discarded_section (h->root.u.def.section))) return TRUE; - else - return FALSE; } else { @@ -12618,7 +12618,9 @@ bfd_elf_reloc_symbol_deleted_p (bfd_vma offset, void *cookie) /* Need to: get the symbol; get the section. */ isym = &rcookie->locsyms[r_symndx]; isec = bfd_section_from_elf_index (rcookie->abfd, isym->st_shndx); - if (isec != NULL && discarded_section (isec)) + if (isec != NULL + && (isec->kept_section != NULL + || discarded_section (isec))) return TRUE; } return FALSE; @@ -12672,9 +12674,7 @@ bfd_elf_discard_info (bfd *output_bfd, struct bfd_link_info *info) } } - o = NULL; - if (!info->relocatable) - o = bfd_get_section_by_name (output_bfd, ".eh_frame"); + o = bfd_get_section_by_name (output_bfd, ".eh_frame"); if (o != NULL) { asection *i; |