summaryrefslogtreecommitdiff
path: root/bfd/elflink.c
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2017-04-27 11:08:14 +0930
committerAlan Modra <amodra@gmail.com>2017-04-27 11:54:29 +0930
commitd7153c4ac333c9127c18efcf184607d368bb142d (patch)
tree72ca75116b4aadb183ba62ac329282406e67a064 /bfd/elflink.c
parent641338d8e9b62bde9672f13f0dca2324b61e46e2 (diff)
Edit .eh_frame symbols
Experimental support for moving symbols defined in .eh_frame as their CIEs/FDEs are edited or merged. * elf-bfd.h (struct eh_cie_fde): Add aug_str_len and aug_data_len. (_bfd_elf_adjust_eh_frame_global_symbol): Declare. * elf-eh-frame.c (_bfd_elf_parse_eh_frame): Set aug_str_len and aug_data_len. (offset_adjust): New function. (_bfd_elf_adjust_eh_frame_global_symbol): Likewise. (adjust_eh_frame_local_symbols): Likewise. (_bfd_elf_discard_section_eh_frame): Call adjust_eh_frame_local_symbols after changing anything. Return true if anything changed. * elflink.c (bfd_elf_discard_info): If .eh_frame changed, call _bfd_elf_adjust_eh_frame_global_symbol for globals.
Diffstat (limited to 'bfd/elflink.c')
-rw-r--r--bfd/elflink.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/bfd/elflink.c b/bfd/elflink.c
index 59300b7cde..4af4b1cd3d 100644
--- a/bfd/elflink.c
+++ b/bfd/elflink.c
@@ -13807,6 +13807,7 @@ bfd_elf_discard_info (bfd *output_bfd, struct bfd_link_info *info)
if (o != NULL)
{
asection *i;
+ int eh_changed = 0;
for (i = o->map_head.s; i != NULL; i = i->map_head.s)
{
@@ -13824,10 +13825,17 @@ bfd_elf_discard_info (bfd *output_bfd, struct bfd_link_info *info)
if (_bfd_elf_discard_section_eh_frame (abfd, info, i,
bfd_elf_reloc_symbol_deleted_p,
&cookie))
- changed = 1;
+ {
+ eh_changed = 1;
+ if (i->size != i->rawsize)
+ changed = 1;
+ }
fini_reloc_cookie_for_section (&cookie, i);
}
+ if (eh_changed)
+ elf_link_hash_traverse (elf_hash_table (info),
+ _bfd_elf_adjust_eh_frame_global_symbol, NULL);
}
for (abfd = info->input_bfds; abfd != NULL; abfd = abfd->link.next)