This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
pr13131 "fix"
- From: Alan Modra <amodra at gmail dot com>
- To: binutils at sourceware dot org
- Date: Tue, 6 Sep 2011 17:12:04 +0930
- Subject: pr13131 "fix"
Applied. Not a fix that makes ld handle these oddball relocations,
but an error instead of an abort. I don't think it's worth spending
time in the linker running over debug relocs to catch these cases in
order to automatically disable the toc optimization.
PR ld/13131
* elf64-ppc.c (adjust_toc_syms): Delete redundant code.
(ppc64_elf_edit_toc): Fix style nit. Report some details
on linker failure due to reference in debug or non-alloc
sections to optimized away toc entry, and don't abort.
Index: bfd/elf64-ppc.c
===================================================================
RCS file: /cvs/src/src/bfd/elf64-ppc.c,v
retrieving revision 1.361
diff -u -p -r1.361 elf64-ppc.c
--- bfd/elf64-ppc.c 19 Aug 2011 08:12:08 -0000 1.361
+++ bfd/elf64-ppc.c 6 Sep 2011 07:35:27 -0000
@@ -7881,9 +7881,6 @@ adjust_toc_syms (struct elf_link_hash_en
struct adjust_toc_info *toc_inf = (struct adjust_toc_info *) inf;
unsigned long i;
- if (h->root.type == bfd_link_hash_indirect)
- return TRUE;
-
if (h->root.type != bfd_link_hash_defined
&& h->root.type != bfd_link_hash_defweak)
return TRUE;
@@ -8267,7 +8264,7 @@ ppc64_elf_edit_toc (struct bfd_link_info
some_unused = 1;
last = 0;
}
- else if (*drop & ref_from_discarded)
+ else if ((*drop & ref_from_discarded) != 0)
{
some_unused = 1;
last = ref_from_discarded;
@@ -8385,7 +8382,13 @@ ppc64_elf_edit_toc (struct bfd_link_info
break;
default:
- abort ();
+ info->callbacks->einfo
+ (_("%P: %H: %s relocation references "
+ "optimized away TOC entry\n"),
+ ibfd, sec, rel->r_offset,
+ ppc64_elf_howto_table[r_type]->name);
+ bfd_set_error (bfd_error_bad_value);
+ goto error_ret;
}
rel->r_addend = tocrel->r_addend;
elf_section_data (sec)->relocs = relstart;
--
Alan Modra
Australia Development Lab, IBM