aboutsummaryrefslogtreecommitdiff
path: root/bfd/elf.c
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2004-07-26 21:01:15 +0000
committerH.J. Lu <hjl.tools@gmail.com>2004-07-26 21:01:15 +0000
commit38ce5b119123653044ec30f4e7a770cd806fcd09 (patch)
tree8fc357be0e04989ab375f2f69012b4adc2f0ecb2 /bfd/elf.c
parent7ac4ac061926872510858e0ff8e37673b5de28d5 (diff)
downloadgdb-38ce5b119123653044ec30f4e7a770cd806fcd09.zip
gdb-38ce5b119123653044ec30f4e7a770cd806fcd09.tar.gz
gdb-38ce5b119123653044ec30f4e7a770cd806fcd09.tar.bz2
bfd/
2004-07-26 H.J. Lu <hongjiu.lu@intel.com> * elf-bfd.h (bfd_elf_section_data): Add a pointer for the linked-to section. (elf_linked_to_section): New. * elf.c (assign_section_numbers): Set up sh_link for SHF_LINK_ORDER. * elfxx-ia64.c (elfNN_ia64_final_write_processing): Set sh_info to sh_link for SHT_IA_64_UNWIND sections. gas/ 2004-07-26 H.J. Lu <hongjiu.lu@intel.com> * config/tc-ia64.c (start_unwind_section): Set the linked-to section. (ia64_elf_section_change_hook): Set the linked-to section for SHT_IA_64_UNWIND.
Diffstat (limited to 'bfd/elf.c')
-rw-r--r--bfd/elf.c35
1 files changed, 35 insertions, 0 deletions
diff --git a/bfd/elf.c b/bfd/elf.c
index 4371f15..300ed27 100644
--- a/bfd/elf.c
+++ b/bfd/elf.c
@@ -2790,6 +2790,7 @@ assign_section_numbers (bfd *abfd)
i_shdrp[t->strtab_section] = &t->strtab_hdr;
t->symtab_hdr.sh_link = t->strtab_section;
}
+
for (sec = abfd->sections; sec; sec = sec->next)
{
struct bfd_elf_section_data *d = elf_section_data (sec);
@@ -2818,6 +2819,40 @@ assign_section_numbers (bfd *abfd)
d->rel_hdr2->sh_info = d->this_idx;
}
+ /* We need to set up sh_link for SHF_LINK_ORDER. */
+ if ((d->this_hdr.sh_flags & SHF_LINK_ORDER) != 0)
+ {
+ s = elf_linked_to_section (sec);
+ if (s)
+ d->this_hdr.sh_link = elf_section_data (s)->this_idx;
+ else
+ {
+ struct bfd_link_order *p;
+
+ /* Find out what the corresponding section in output
+ is. */
+ for (p = sec->link_order_head; p != NULL; p = p->next)
+ {
+ s = p->u.indirect.section;
+ if (p->type == bfd_indirect_link_order
+ && (bfd_get_flavour (s->owner)
+ == bfd_target_elf_flavour))
+ {
+ Elf_Internal_Shdr ** const elf_shdrp
+ = elf_elfsections (s->owner);
+ int elfsec
+ = _bfd_elf_section_from_bfd_section (s->owner, s);
+ elfsec = elf_shdrp[elfsec]->sh_link;
+ BFD_ASSERT (elfsec != 0);
+ s = elf_shdrp[elfsec]->bfd_section->output_section;
+ BFD_ASSERT (s != NULL);
+ d->this_hdr.sh_link = elf_section_data (s)->this_idx;
+ break;
+ }
+ }
+ }
+ }
+
switch (d->this_hdr.sh_type)
{
case SHT_REL: