This is the mail archive of the
binutils-cvs@sourceware.org
mailing list for the binutils project.
[binutils-gdb] PR22751, LTO broken for libgcc libcalls
- From: Alan Modra <amodra at sourceware dot org>
- To: bfd-cvs at sourceware dot org
- Date: 27 Jan 2018 22:34:08 -0000
- Subject: [binutils-gdb] PR22751, LTO broken for libgcc libcalls
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=d580dcc7aac21dc8396e8e90ea6d05ec32d6cbb9
commit d580dcc7aac21dc8396e8e90ea6d05ec32d6cbb9
Author: Alan Modra <amodra@gmail.com>
Date: Sun Jan 28 08:03:26 2018 +1030
PR22751, LTO broken for libgcc libcalls
So what was happening was that the file added from libgcc.a during the
rescan was not put on file_chain. map_input_to_output_sections then
doesn't see the file and its sections are treated as discarded.
The file_chain list pointer bug was caused by that fact that an
archive element claimed by the plugin does not have my_archive set.
Or more correctly, the actual archive element does have my_archive
set, but this bfd is replaced with a dummy bfd that doesn't have
my_archive set.
PR 22751
* ldlang.c (find_rescan_insertion): Look past bfds with claim_archive
set.
Diff:
---
ld/ChangeLog | 6 ++++++
ld/ldlang.c | 3 ++-
2 files changed, 8 insertions(+), 1 deletion(-)
diff --git a/ld/ChangeLog b/ld/ChangeLog
index 3430a86..f32b42f 100644
--- a/ld/ChangeLog
+++ b/ld/ChangeLog
@@ -1,3 +1,9 @@
+2018-01-28 Alan Modra <amodra@gmail.com>
+
+ PR 22751
+ * ldlang.c (find_rescan_insertion): Look past bfds with claim_archive
+ set.
+
2018-01-26 Maciej W. Rozycki <macro@mips.com>
* emulparams/elf32mipswindiss.sh (EXTRA_EM_FILE): Set to
diff --git a/ld/ldlang.c b/ld/ldlang.c
index 1526d7b..001039d 100644
--- a/ld/ldlang.c
+++ b/ld/ldlang.c
@@ -7044,7 +7044,8 @@ find_rescan_insertion (lang_input_statement_type *add)
for (iter = before ? &before->next : &file_chain.head->input_statement.next;
*iter != NULL;
iter = &(*iter)->input_statement.next)
- if ((*iter)->input_statement.the_bfd->my_archive == NULL)
+ if (!(*iter)->input_statement.flags.claim_archive
+ && (*iter)->input_statement.the_bfd->my_archive == NULL)
break;
return iter;