Bug 17112 - [regression] binutils trunk ld/LTO 11 test fails when built using GCC 4.9
Summary: [regression] binutils trunk ld/LTO 11 test fails when built using GCC 4.9
Status: RESOLVED FIXED
Alias: None
Product: binutils
Classification: Unclassified
Component: ld (show other bugs)
Version: 2.25
: P2 normal
Target Milestone: 2.26
Assignee: Alan Modra
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-07-04 11:51 UTC by Matthias Klose
Modified: 2014-07-08 00:54 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Matthias Klose 2014-07-04 11:51:00 UTC
on binutils trunk the ld/LTO 11 test fails when built using GCC 4.9, but succeeds when built using 4.8. seen across all *-linux-gnu architectures.

gcc  -B/scratch/packages/binutils/binutils-2.24.51.20140704/builddir-single/ld/tmpdir/gas/ -I/scratch/packages/binutils/b
inutils-2.24.51.20140704/ld/testsuite/ld-plugin -g -O2   -c -g -O2  -c /scratch/packages/binutils/binutils-2.24.51.201407
04/ld/testsuite/ld-plugin/dummy.c -o tmpdir/dummy.o
Executing on host: sh -c {gcc  -B/scratch/packages/binutils/binutils-2.24.51.20140704/builddir-single/ld/tmpdir/gas/ -I/s
cratch/packages/binutils/binutils-2.24.51.20140704/ld/testsuite/ld-plugin -g -O2   -c -g -O2  -c /scratch/packages/binuti
ls/binutils-2.24.51.20140704/ld/testsuite/ld-plugin/dummy.c -o tmpdir/dummy.o 2>&1}  /dev/null ld.tmp (timeout = 300)
spawn [open ...]
gcc -B/scratch/packages/binutils/binutils-2.24.51.20140704/builddir-single/ld/tmpdir/ld/ -L=/usr/x86_64-linux-gnu/lib64 -
L=/usr/local/lib64 -L=/lib64 -L=/usr/lib64 -L=/usr/x86_64-linux-gnu/lib -L=/usr/local/lib -L=/lib -L=/usr/lib   -o tmpdir
/lto-11.exe -L/scratch/packages/binutils/binutils-2.24.51.20140704/ld/testsuite/ld-plugin -O -flto -fuse-linker-plugin tm
pdir/liblto-11.a tmpdir/dummy.o
Executing on host: sh -c {gcc -B/scratch/packages/binutils/binutils-2.24.51.20140704/builddir-single/ld/tmpdir/ld/ -L=/us
r/x86_64-linux-gnu/lib64 -L=/usr/local/lib64 -L=/lib64 -L=/usr/lib64 -L=/usr/x86_64-linux-gnu/lib -L=/usr/local/lib -L=/l
ib -L=/usr/lib   -o tmpdir/lto-11.exe -L/scratch/packages/binutils/binutils-2.24.51.20140704/ld/testsuite/ld-plugin -O -f
lto -fuse-linker-plugin tmpdir/liblto-11.a tmpdir/dummy.o 2>&1}  /dev/null ld.tmp (timeout = 300)
spawn [open ...]
/usr/lib/gcc/x86_64-linux-gnu/4.9/../../../x86_64-linux-gnu/crt1.o: In function `_start':
/build/glibc-irh9iM/glibc-2.19/csu/../sysdeps/x86_64/start.S:118: undefined reference to `main'
collect2: error: ld returned 1 exit status
/usr/lib/gcc/x86_64-linux-gnu/4.9/../../../x86_64-linux-gnu/crt1.o: In function `_start':
/build/glibc-irh9iM/glibc-2.19/csu/../sysdeps/x86_64/start.S:118: undefined reference to `main'
collect2: error: ld returned 1 exit status
FAIL: LTO 11
Comment 1 Matthias Klose 2014-07-04 11:54:31 UTC
filed for GCC: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61715
Comment 2 Alan Modra 2014-07-04 13:16:00 UTC
I was looking at this last week.  It's basically a testsuite issue.  The test puts all the objects into tmpdir/liblto-11.a, expecting that the startup file reference to main will pull them out of the archive as it would normally.  However, the objects are not built with -ffat-lto-objects so there are no normal symbols, except things like __gnu_lto_slim.  These useless symbols are the ones put into the archive index, and of course nothing references them so no objects are extracted by the linker.

I think what needs to happen is the archive be built with ar --plugin.
Comment 3 Sourceware Commits 2014-07-08 00:33:42 UTC
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "gdb and binutils".

The branch, master has been updated
       via  37a6ac445daf5075d9058d7f01505f96a43f592a (commit)
      from  e29c73ebde63ce95bfbb4be28eb797b55c8e3842 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

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

commit 37a6ac445daf5075d9058d7f01505f96a43f592a
Author: Alan Modra <amodra@gmail.com>
Date:   Sat Jul 5 12:05:01 2014 +0930

    Run ar with --plugin for LTO 11 test
    
    Objects built with -fno-fat-lto-objects (the default for gcc-4.9) have
    no normal symbols, except things like __gnu_lto_slim.  These useless
    symbols are the ones put into the archive index, and of course nothing
    references them so no objects are extracted by the linker.  Running
    ar with --plugin changes ar behaviour to put the lto symbols into the
    archive index.
    
    	PR 17112
    	* ld-plugin/lto.exp: When building liblti-11.a, pass
    	--plugin path_to_gcc/liblto_plugin.so to ar.

-----------------------------------------------------------------------

Summary of changes:
 ld/testsuite/ChangeLog         |    6 ++++++
 ld/testsuite/ld-plugin/lto.exp |   15 ++++++++++++++-
 2 files changed, 20 insertions(+), 1 deletions(-)
Comment 4 Alan Modra 2014-07-08 00:54:51 UTC
Patch applied