This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
PATCH: ld/2008: Segfault on IA64, something to do with Unwind and section ordering
- From: "H. J. Lu" <hjl at lucon dot org>
- To: binutils at sources dot redhat dot com
- Date: Mon, 12 Dec 2005 06:59:56 -0800
- Subject: PATCH: ld/2008: Segfault on IA64, something to do with Unwind and section ordering
PR 1991 may leave bogus valus in the sh_link field, which leads to
PR 2008 where linker will segfault. This patch bails out if the section
which the sh_link field points to doesn't have an output section.
H.J.
---
2005-12-12 H.J. Lu <hongjiu.lu@intel.com>
PR ld/2008
* elflink.c (elf_get_linked_section_vma): Bail out if the
section which the sh_link field points to doesn't have an
output section.
--- bfd/elflink.c.bad 2005-12-12 06:51:51.000000000 -0800
+++ bfd/elflink.c 2005-12-12 06:53:19.000000000 -0800
@@ -7600,8 +7600,19 @@ elf_get_linked_section_vma (struct bfd_l
}
else
{
- s = elf_shdrp[elfsec]->bfd_section;
- return s->output_section->vma + s->output_offset;
+ asection *link = elf_shdrp[elfsec]->bfd_section;
+ /* PR 1991, 2008:
+ Some strip/objcopy may leave an incorrect value in sh_link.
+ We will bail out now. */
+ if (link == NULL)
+ {
+ (*_bfd_error_handler)
+ (_("%B: sh_link [%d] in section `%A' is incorrect"),
+ s->owner, s, elfsec);
+ unlink_if_ordinary (s->output_section->owner->filename);
+ xexit (EXIT_FAILURE);
+ }
+ return link->output_section->vma + link->output_offset;
}
}