aboutsummaryrefslogtreecommitdiff
path: root/bfd/elf.c
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2004-07-30 15:37:04 +0000
committerH.J. Lu <hjl.tools@gmail.com>2004-07-30 15:37:04 +0000
commit185d09adc379a495103643c594a28d5f80110978 (patch)
tree942082fe14e0e90b98f4a2b3cbedba1f03aef2ee /bfd/elf.c
parentddc9cd0f636c47cb328a663e28e0414052dc21c1 (diff)
downloadgdb-185d09adc379a495103643c594a28d5f80110978.zip
gdb-185d09adc379a495103643c594a28d5f80110978.tar.gz
gdb-185d09adc379a495103643c594a28d5f80110978.tar.bz2
2004-07-30 H.J. Lu <hongjiu.lu@intel.com>
Nick Clifton <nickc@redhat.com> PR 290 * bfd.c (_bfd_default_error_handler): Make it global. * elf-bfd.h (elf_backend_data): Add link_order_error_handler. * elf.c (assign_section_numbers): Cope gracefully with sections which have SHF_LINK_ORDER set but no sh_link set up. * elflink.c (elf_get_linked_section_vma): Likewise. * elfxx-ia64.c (elf_backend_link_order_error_handler): New. Set it to NULL. * elfxx-target.h (elf_backend_link_order_error_handler): New. Set it to _bfd_default_error_handler. (elfNN_bed): Add elf_backend_link_order_error_handler. * libbfd-in.h (_bfd_default_error_handler): New. * libbfd.h: Regenerated.
Diffstat (limited to 'bfd/elf.c')
-rw-r--r--bfd/elf.c30
1 files changed, 26 insertions, 4 deletions
diff --git a/bfd/elf.c b/bfd/elf.c
index 752df66..7e00c04 100644
--- a/bfd/elf.c
+++ b/bfd/elf.c
@@ -2885,10 +2885,32 @@ assign_section_numbers (bfd *abfd)
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;
+ /* PR 290:
+ The Intel C compiler generates SHT_IA_64_UNWIND with
+ SHF_LINK_ORDER. But it doesn't set theh sh_link or
+ sh_info fields. Hence we could get the situation
+ where elfsec is 0. */
+ if (elfsec == 0)
+ {
+ const struct elf_backend_data *bed
+ = get_elf_backend_data (abfd);
+ if (bed->link_order_error_handler)
+ {
+ char *name = bfd_get_section_ident (s);
+ bed->link_order_error_handler
+ (_("%s: warning: sh_link not set for section `%s'"),
+ bfd_archive_filename (abfd),
+ name ? name : s->name);
+ if (name)
+ free (name);
+ }
+ }
+ else
+ {
+ s = elf_shdrp[elfsec]->bfd_section->output_section;
+ BFD_ASSERT (s != NULL);
+ d->this_hdr.sh_link = elf_section_data (s)->this_idx;
+ }
break;
}
}