[Bug ld/22751] LTO broken for libgcc libcalls

2018-03-31 Thread jeremip11 at gmail dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=22751

Jeremi  changed:

   What|Removed |Added

 CC||jeremip11 at gmail dot com

-- 
You are receiving this mail because:
You are on the CC list for the bug.
___
bug-binutils mailing list
bug-binutils@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-binutils


[Bug ld/22751] LTO broken for libgcc libcalls

2018-01-27 Thread amodra at gmail dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=22751

Alan Modra  changed:

   What|Removed |Added

 Status|ASSIGNED|RESOLVED
 Resolution|--- |FIXED

--- Comment #8 from Alan Modra  ---
Fixed

-- 
You are receiving this mail because:
You are on the CC list for the bug.
___
bug-binutils mailing list
bug-binutils@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-binutils


[Bug ld/22751] LTO broken for libgcc libcalls

2018-01-27 Thread cvs-commit at gcc dot gnu.org
https://sourceware.org/bugzilla/show_bug.cgi?id=22751

--- Comment #7 from cvs-commit at gcc dot gnu.org  ---
The master branch has been updated by H.J. Lu :

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=fef75122c0fe3abafb99d79a63545c1531f4107c

commit fef75122c0fe3abafb99d79a63545c1531f4107c
Author: H.J. Lu 
Date:   Sat Jan 27 16:04:34 2018 -0800

Add a testcase for PR ld/22751

Since dummy.o must be placed before

-Wl,--whole-archive tmpdir/pr22751.a -Wl,--no-whole-archive

to trigger the bug, this patch adds an optional trailing ld options to
run_ld_link_exec_tests.

PR ld/22751
* testsuite/config/default.exp (INT128_CFLAGS): New.
* testsuite/ld-plugin/lto.exp (INT128_CFLAGS): New.
Run ld/22751 tests.
* testsuite/ld-plugin/pr22751.c: New file.
* testsuite/lib/ld-lib.exp (run_ld_link_exec_tests): Add
ld trailing options.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
___
bug-binutils mailing list
bug-binutils@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-binutils


[Bug ld/22751] LTO broken for libgcc libcalls

2018-01-27 Thread cvs-commit at gcc dot gnu.org
https://sourceware.org/bugzilla/show_bug.cgi?id=22751

--- Comment #6 from cvs-commit at gcc dot gnu.org  ---
The master branch has been updated by Alan Modra :

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=d580dcc7aac21dc8396e8e90ea6d05ec32d6cbb9

commit d580dcc7aac21dc8396e8e90ea6d05ec32d6cbb9
Author: Alan Modra 
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.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
___
bug-binutils mailing list
bug-binutils@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-binutils


[Bug ld/22751] LTO broken for libgcc libcalls

2018-01-27 Thread cvs-commit at gcc dot gnu.org
https://sourceware.org/bugzilla/show_bug.cgi?id=22751

--- Comment #5 from cvs-commit at gcc dot gnu.org  ---
The binutils-2_30-branch branch has been updated by Nick Clifton
:

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=cad6449ec5efdb8cf7adb3f44e67712effebb05f

commit cad6449ec5efdb8cf7adb3f44e67712effebb05f
Author: Nick Clifton 
Date:   Sat Jan 27 14:53:19 2018 +

Revert the optimization of the placement of LTO objects as a temporary
solution for PR 22751.

PR 22751
Revert this change as a temporary solution for this PR:

2017-09-02  Alan Modra  

* ldlang.h (lang_input_statement_type): Expand comments.
(LANG_FOR_EACH_INPUT_STATEMENT): Rewrite without casts.
* ldlang.c (lang_for_each_input_file): Likewise.
(load_symbols): Set usrdata for archives.
(find_rescan_insertion): New function.
(lang_process): Trim off and reinsert entries added to file chain
when rescanning archives for LTO.
* ldmain.c (add_archive_element): Set my_archive input_statement
next pointer to last element added.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
___
bug-binutils mailing list
bug-binutils@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-binutils


[Bug ld/22751] LTO broken for libgcc libcalls

2018-01-27 Thread amodra at gmail dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=22751

--- Comment #4 from Alan Modra  ---
Sigh, so it seems reverting the patch does fix the problem.  I don't know what
happened when I attempted the revert earlier today..

Now that I've had a bit more time to look at the problem, it seems the patch is
causing _divdi3.o extracted from libgcc.a to not be on the file_chain list. 
This is the list used by LANG_FOR_EACH_INPUT_STATEMENT in
output_section_callback, so the .text section from that file is not seen by
map_input_to_output_sections and thus has no output section.  Symbols defined
in a section without output section are unresolvable
(elf-bfd.h:RELOC_FOR_GLOBAL_SYMBOL).

-- 
You are receiving this mail because:
You are on the CC list for the bug.
___
bug-binutils mailing list
bug-binutils@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-binutils


[Bug ld/22751] LTO broken for libgcc libcalls

2018-01-26 Thread amodra at gmail dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=22751

--- Comment #3 from Alan Modra  ---
Reverting 1fa4ec6ae7 makes no difference.  Indeed, now that I've refreshed my
memory on what that patch does, it should not since all it is doing (or at
least supposed to be doing!) is reordering the layout of object files.  Opening
objects, adding their symbols and deciding whether they need including happens
before ld gets to the new 1fa4ec6ae7 code..

-- 
You are receiving this mail because:
You are on the CC list for the bug.
___
bug-binutils mailing list
bug-binutils@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-binutils


[Bug ld/22751] LTO broken for libgcc libcalls

2018-01-26 Thread hjl.tools at gmail dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=22751

H.J. Lu  changed:

   What|Removed |Added

 CC||hjl.tools at gmail dot com

-- 
You are receiving this mail because:
You are on the CC list for the bug.
___
bug-binutils mailing list
bug-binutils@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-binutils


[Bug ld/22751] LTO broken for libgcc libcalls

2018-01-26 Thread amodra at gmail dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=22751

Alan Modra  changed:

   What|Removed |Added

 Status|NEW |ASSIGNED
 CC|amodra at gmail dot com|
   Assignee|unassigned at sourceware dot org   |amodra at gmail dot com

--- Comment #2 from Alan Modra  ---
Uggh.  I guess we need to implement the comment I made.  "Ideally the
recompiled objects ought to be ordered to the same place their IR objects
were."

-- 
You are receiving this mail because:
You are on the CC list for the bug.
___
bug-binutils mailing list
bug-binutils@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-binutils


[Bug ld/22751] LTO broken for libgcc libcalls

2018-01-26 Thread doko at debian dot org
https://sourceware.org/bugzilla/show_bug.cgi?id=22751

Matthias Klose  changed:

   What|Removed |Added

 CC||doko at debian dot org

-- 
You are receiving this mail because:
You are on the CC list for the bug.
___
bug-binutils mailing list
bug-binutils@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-binutils


[Bug ld/22751] LTO broken for libgcc libcalls

2018-01-26 Thread hjl.tools at gmail dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=22751

H.J. Lu  changed:

   What|Removed |Added

 Status|UNCONFIRMED |NEW
   Last reconfirmed||2018-01-26
 CC||amodra at gmail dot com
 Ever confirmed|0   |1

--- Comment #1 from H.J. Lu  ---
The problem is

--whole-archive libx.a --no-whole-archive -lgcc --as-needed -lgcc_s
--no-as-needed -lc -lgcc --as-needed -lgcc_s --no-as-needed 

ld rescan order is wrong.  It rescans -lgcc_s before x.ltrans0.ltrans.o
from libx.a.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
___
bug-binutils mailing list
bug-binutils@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-binutils