[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/22756] New: Linker relaxation miscalculates symbol addresses on riscv

2018-01-27 Thread sch...@linux-m68k.org
https://sourceware.org/bugzilla/show_bug.cgi?id=22756

Bug ID: 22756
   Summary: Linker relaxation miscalculates symbol addresses on
riscv
   Product: binutils
   Version: 2.30
Status: NEW
  Severity: normal
  Priority: P2
 Component: ld
  Assignee: unassigned at sourceware dot org
  Reporter: sch...@linux-m68k.org
  Target Milestone: ---
Target: riscv64-*-*

The test program created by the copy_setup proc in
testsuite/binutils-all/objcopy.exp is broken by linker relaxation.

$ objdump -d tmpdir/testprog

tmpdir/testprog: file format elf64-littleriscv


Disassembly of section .plt:

0690 <.plt>:
 690:   2397auipc   t2,0x2
 694:   41c30333sub t1,t1,t3
 698:   9883be03ld  t3,-1656(t2) # 2018 <__TMC_END__>
 69c:   fd430313addit1,t1,-44
 6a0:   98838293addit0,t2,-1656
 6a4:   00135313srlit1,t1,0x1
 6a8:   0082b283ld  t0,8(t0)
 6ac:   000e0067jr  t3

06b0 <__libc_start_main@plt>:
 6b0:   2e17auipc   t3,0x2
 6b4:   978e3e03ld  t3,-1672(t3) # 2028
<__libc_start_main@GLIBC_2.27>
 6b8:   000e0367jalrt1,t3
 6bc:   0013nop

06c0 :
 6c0:   2e17auipc   t3,0x2
 6c4:   970e3e03ld  t3,-1680(t3) # 2030 
 6c8:   000e0367jalrt1,t3
 6cc:   0013nop

06d0 <_exit@plt>:
 6d0:   2e17auipc   t3,0x2
 6d4:   968e3e03ld  t3,-1688(t3) # 2038 <_exit@GLIBC_2.27>
 6d8:   000e0367jalrt1,t3
 6dc:   0013nop

06e0 :
 6e0:   2e17auipc   t3,0x2
 6e4:   960e3e03ld  t3,-1696(t3) # 2040 
 6e8:   000e0367jalrt1,t3
 6ec:   0013nop

06f0 :
 6f0:   2e17auipc   t3,0x2
 6f4:   958e3e03ld  t3,-1704(t3) # 2048 
 6f8:   000e0367jalrt1,t3
 6fc:   0013nop

0700 :
 700:   2e17auipc   t3,0x2
 704:   950e3e03ld  t3,-1712(t3) # 2050 
 708:   000e0367jalrt1,t3
 70c:   0013nop

0710 :
 710:   2e17auipc   t3,0x2
 714:   948e3e03ld  t3,-1720(t3) # 2058 
 718:   000e0367jalrt1,t3
 71c:   0013nop

Disassembly of section .text:

0720 <_start>:
 720:   02c000efjal ra,74c <_start+0x2c>
 724:   87aamv  a5,a0
 726:   2517auipc   a0,0x2
 72a:   94a53503ld  a0,-1718(a0) # 2070
<__wrap_main@@Base+0x160e>
 72e:   6582ld  a1,0(sp)
 730:   0030addia2,sp,8
 732:   ff017113andisp,sp,-16
 736:   0697auipc   a3,0x0
 73a:   35c68693addia3,a3,860 # a92 <__libc_csu_init>
 73e:   0717auipc   a4,0x0
 742:   3ac70713addia4,a4,940 # aea <__libc_csu_fini>
 746:   880amv  a6,sp
 748:   f69ff06fj   6b0 <__libc_start_main@plt>
 74c:   2197auipc   gp,0x2
 750:   14418193addigp,gp,324 # 2890 <__global_pointer$>
 754:   8082ret

0756 :
 756:   2517auipc   a0,0x2
 75a:   8c250513addia0,a0,-1854 # 2018 <__TMC_END__>
 75e:   2797auipc   a5,0x2
 762:   8ba78793addia5,a5,-1862 # 2018 <__TMC_END__>
 766:   00a78963beq a5,a0,778 
 76a:   2317auipc   t1,0x2
 76e:   8fe33303ld  t1,-1794(t1) # 2068
<_ITM_deregisterTMCloneTable>
 772:   00030363beqzt1,778 
 776:   8302jr  t1
 778:   8082ret

077a :
 77a:   2517auipc   a0,0x2
 77e:   89e50513addia0,a0,-1890 # 2018 <__TMC_END__>
 782:   2597auipc   a1,0x2
 786:   89658593addia1,a1,-1898 # 2018 <__TMC_END__>
 78a:   8d89sub a1,a1,a0
 78c:   858dsraia1,a1,0x3
 78e:   03f5d793srlia5,a1,0x3f
 792:   95beadd a1,a1,a5
 794:   8585sraia1,a1,0x1
 796:   c981beqza1,7a6 
 798:   2317auipc   t1,0x2
 79c:   8f033303ld  t1,-1808(t1) # 2088
<_ITM_registerTMCloneTable>
 7a0:   00030363beqzt1,7a6 
 7a4:   8302

[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 gold/22755] gold test suite failures (gentoo, 2.30)

2018-01-27 Thread dilfridge at gentoo dot org
https://sourceware.org/bugzilla/show_bug.cgi?id=22755

Andreas K. Huettel  changed:

   What|Removed |Added

Version|unspecified |2.30

-- 
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 gold/22755] New: gold test suite failures (gentoo, 2.30)

2018-01-27 Thread dilfridge at gentoo dot org
https://sourceware.org/bugzilla/show_bug.cgi?id=22755

Bug ID: 22755
   Summary: gold test suite failures (gentoo, 2.30)
   Product: binutils
   Version: unspecified
Status: UNCONFIRMED
  Severity: normal
  Priority: P2
 Component: gold
  Assignee: ccoutant at gmail dot com
  Reporter: dilfridge at gentoo dot org
CC: ian at airs dot com
  Target Milestone: ---

Here's the test suite log. Happy to help debugging. binutils 2.30, gcc 7.3.0,
glibc 2.25, x86-64


   gold 0.1: testsuite/test-suite.log   


18 of 263 tests failed.  

.. contents:: :depth: 2


FAIL: strong_ref_weak_def.sh (exit: 1)
==

pattern ".* FUNC.* GLOBAL.* UND.* weak_def" not found in file
strong_ref_weak_def.stdout.


FAIL: dyn_weak_ref.sh (exit: 1)
===

pattern ".* WEAK .* UND.* weak_ref" not found in file dyn_weak_ref.stdout.


FAIL: large_symbol_alignment (exit: 1)
==


FAIL: exception_separate_shared_12_test (exit: 127)
===

./exception_separate_shared_12_test: symbol lookup error:
./exception_shared_1.so: undefined symbol: _Z2f1v

FAIL: exception_separate_shared_21_test (exit: 127)
===

./exception_separate_shared_21_test: symbol lookup error:
./exception_shared_1.so: undefined symbol: _Z2f1v

FAIL: weak_undef_test (exit: 1)
===

FAILED weak undef test 4: &no_such_symbol_ is not NULL

FAIL: initpri3a (exit: 134)
===

initpri3a:
/var/tmp/portage/sys-devel/binutils-2.30/work/binutils-2.30/gold/testsuite/initpri3.c:40:
ctor2: Assertion `i == 2' failed.

FAIL: script_test_1 (exit: 134)
===

script_test_1:
/var/tmp/portage/sys-devel/binutils-2.30/work/binutils-2.30/gold/testsuite/script_test_1b.cc:31:
void check_int(intptr_t, intptr_t): Assertion `i == j' failed.

FAIL: script_test_2 (exit: 134)
===

script_test_2:
/var/tmp/portage/sys-devel/binutils-2.30/work/binutils-2.30/gold/testsuite/script_test_2.cc:44:
int main(int, char**): Assertion `reinterpret_cast(start_test_area)
== 0x2001' failed.

FAIL: justsyms (exit: 134)
==

justsyms:
/var/tmp/portage/sys-devel/binutils-2.30/work/binutils-2.30/gold/testsuite/justsyms_1.cc:47:
int main(int, char**): Assertion `reinterpret_cast(justsyms_string)
== 0x100' failed.

FAIL: justsyms_exec (exit: 2)
=

&exported_func is 0x55664cbeb200, expected 01000200
&exported_data is 0x55664dbeb000, expected 0200

FAIL: binary_test (exit: 134)
=

binary_test:
/var/tmp/portage/sys-devel/binutils-2.30/work/binutils-2.30/gold/testsuite/binary_test.cc:39:
int main(int, char**): Assertion `size == _binary_binary_txt_end -
_binary_binary_txt_start' failed.

FAIL: script_test_3 (exit: 139)
===


FAIL: tls_phdrs_script_test (exit: 139)
===


FAIL: script_test_12i (exit: 1)
===


FAIL: dynamic_list_2 (exit: 1)
==


FAIL: incremental_test_2 (exit: 134)


incremental_test_2:
/var/tmp/portage/sys-devel/binutils-2.30/work/binutils-2.30/gold/testsuite/two_file_test_main.cc:50:
int main(): Assertion `t12()' failed.

FAIL: incremental_test_5 (exit: 134)


incremental_test_5:
/var/tmp/portage/sys-devel/binutils-2.30/work/binutils-2.30/gold/testsuite/two_file_test_main.cc:50:
int main(): Assertion `t12()' failed.

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