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.
This commit is contained in:
Alan Modra 2018-01-28 08:03:26 +10:30
parent 9a5db26e6d
commit d580dcc7aa
2 changed files with 8 additions and 1 deletions

View file

@ -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;