diff options
-rw-r--r-- | bfd/elf-bfd.h | 7 | ||||
-rw-r--r-- | bfd/elf-eh-frame.c | 3 | ||||
-rw-r--r-- | bfd/elf.c | 18 | ||||
-rw-r--r-- | bfd/elflink.c | 2 |
4 files changed, 19 insertions, 11 deletions
diff --git a/bfd/elf-bfd.h b/bfd/elf-bfd.h index 138ef46..1d3ae76 100644 --- a/bfd/elf-bfd.h +++ b/bfd/elf-bfd.h @@ -1909,10 +1909,6 @@ struct output_elf_obj_tdata /* STT_SECTION symbols for each section */ asymbol **section_syms; - /* Used to determine if PT_GNU_EH_FRAME segment header should be - created. */ - asection *eh_frame_hdr; - /* NT_GNU_BUILD_ID note type info. */ struct { @@ -2116,7 +2112,6 @@ struct elf_obj_tdata #define elf_seg_map(bfd) (elf_tdata(bfd) -> o->seg_map) #define elf_link_info(bfd) (elf_tdata(bfd) -> o->link_info) #define elf_next_file_pos(bfd) (elf_tdata(bfd) -> o->next_file_pos) -#define elf_eh_frame_hdr(bfd) (elf_tdata(bfd) -> o->eh_frame_hdr) #define elf_stack_flags(bfd) (elf_tdata(bfd) -> o->stack_flags) #define elf_shstrtab(bfd) (elf_tdata(bfd) -> o->strtab_ptr) #define elf_onesymtab(bfd) (elf_tdata(bfd) -> symtab_section) @@ -2412,7 +2407,7 @@ extern bool _bfd_elf_discard_section_eh_frame extern bool _bfd_elf_adjust_eh_frame_global_symbol (struct elf_link_hash_entry *, void *); extern bool _bfd_elf_discard_section_eh_frame_hdr - (bfd *, struct bfd_link_info *); + (struct bfd_link_info *); extern bfd_vma _bfd_elf_eh_frame_section_offset (bfd *, struct bfd_link_info *, asection *, bfd_vma); extern bool _bfd_elf_write_section_eh_frame diff --git a/bfd/elf-eh-frame.c b/bfd/elf-eh-frame.c index a621fed..2e22d0c 100644 --- a/bfd/elf-eh-frame.c +++ b/bfd/elf-eh-frame.c @@ -1612,7 +1612,7 @@ _bfd_elf_discard_section_eh_frame input sections. It finalizes the size of .eh_frame_hdr section. */ bool -_bfd_elf_discard_section_eh_frame_hdr (bfd *abfd, struct bfd_link_info *info) +_bfd_elf_discard_section_eh_frame_hdr (struct bfd_link_info *info) { struct elf_link_hash_table *htab; struct eh_frame_hdr_info *hdr_info; @@ -1644,7 +1644,6 @@ _bfd_elf_discard_section_eh_frame_hdr (bfd *abfd, struct bfd_link_info *info) sec->size += 4 + hdr_info->u.dwarf.fde_count * 8; } - elf_eh_frame_hdr (abfd) = sec; return true; } @@ -4343,6 +4343,20 @@ _bfd_elf_compute_section_file_positions (bfd *abfd, return true; } +/* Retrieve .eh_frame_hdr. Prior to size_dynamic_sections the + function effectively returns whether --eh-frame-hdr is given on the + command line. After size_dynamic_sections the result reflects + whether .eh_frame_hdr will actually be output (sizing isn't done + until ldemul_after_allocation). */ + +static asection * +elf_eh_frame_hdr (const struct bfd_link_info *info) +{ + if (info != NULL && is_elf_hash_table (info->hash)) + return elf_hash_table (info)->eh_info.hdr_sec; + return NULL; +} + /* Make an initial estimate of the size of the program header. If we get the number wrong here, we'll redo section placement. */ @@ -4379,7 +4393,7 @@ get_program_header_size (bfd *abfd, struct bfd_link_info *info) ++segs; } - if (elf_eh_frame_hdr (abfd)) + if (elf_eh_frame_hdr (info)) { /* We need a PT_GNU_EH_FRAME segment. */ ++segs; @@ -5134,7 +5148,7 @@ _bfd_elf_map_sections_to_segments (bfd *abfd, /* If there is a .eh_frame_hdr section, throw in a PT_GNU_EH_FRAME segment. */ - eh_frame_hdr = elf_eh_frame_hdr (abfd); + eh_frame_hdr = elf_eh_frame_hdr (info); if (eh_frame_hdr != NULL && (eh_frame_hdr->output_section->flags & SEC_LOAD) != 0) { diff --git a/bfd/elflink.c b/bfd/elflink.c index 2677561..6fa18d9 100644 --- a/bfd/elflink.c +++ b/bfd/elflink.c @@ -14888,7 +14888,7 @@ bfd_elf_discard_info (bfd *output_bfd, struct bfd_link_info *info) if (info->eh_frame_hdr_type && !bfd_link_relocatable (info) - && _bfd_elf_discard_section_eh_frame_hdr (output_bfd, info)) + && _bfd_elf_discard_section_eh_frame_hdr (info)) changed = 1; return changed; |