/* 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
{
#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)
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
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;
sec->size += 4 + hdr_info->u.dwarf.fde_count * 8;
}
- elf_eh_frame_hdr (abfd) = sec;
return true;
}
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. */
++segs;
}
- if (elf_eh_frame_hdr (abfd))
+ if (elf_eh_frame_hdr (info))
{
/* We need a PT_GNU_EH_FRAME segment. */
++segs;
/* 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)
{
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;