This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug lto/48447] New: LTO link fails to link libgcc correctly when -nostdlib option is specified


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48447

           Summary: LTO link fails to link libgcc correctly when -nostdlib
                    option is specified
           Product: gcc
           Version: 4.6.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: lto
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: patrick@motec.com.au


Created attachment 23879
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=23879
Test cases

Not sure if this is a bug with gcc or binutils (ld) but I suspect gcc as test
case 2 succeeds.

Attached are 3 test cases which build a minimal project demonstrating the
following behaviours:

1. Link with LTO and -nostartfiles (succeeds)
2. Link without LTO and -nostdlib, libgcc is specified on the command line
(succeeds)
3. Link with LTO and -nostdlib, libgcc is specified on the command line (fails)

*** TEST 1: LTO with -nostartfiles
powerpc-eabispe-gcc -nostartfiles -flto -fuse-linker-plugin -Os -o test1 crt0.o
main.o -L.
*** TEST 2: no LTO with -nostdlib
powerpc-eabispe-gcc -nostdlib -Os -o test2 crt0.o main.o
/home/patrick/src/e7/toolchain/stage2/lib/gcc/powerpc-eabispe/4.6.0/libgcc.a
*** TEST 3: LTO with -nostdlib
powerpc-eabispe-gcc -nostdlib -flto -fuse-linker-plugin -Os -o test3 crt0.o
main.o
/home/patrick/src/e7/toolchain/stage2/lib/gcc/powerpc-eabispe/4.6.0/libgcc.a
/tmp/ccpXMwiG.ltrans0.ltrans.o: In function `foo.1466':
ccpXMwiG.ltrans0.o:(.text+0x84): undefined reference to `_rest32gpr_29_x'
collect2: ld returned 1 exit status
make: *** [test3] Error 1

Output of gcc -v

patrick@gtr:~/src/patrick/test$ powerpc-eabispe-gcc -v
Using built-in specs.
COLLECT_GCC=powerpc-eabispe-gcc
COLLECT_LTO_WRAPPER=/home/patrick/src/e7/toolchain/stage2/libexec/gcc/powerpc-eabispe/4.6.0/lto-wrapper
Target: powerpc-eabispe
Configured with: /home/patrick/src/e7/toolchain/src/gcc-4.6.0/configure
--prefix=/home/patrick/src/e7/toolchain/stage2 --build=x86_64-unknown-linux-gnu
--host=x86_64-unknown-linux-gnu --target=powerpc-eabispe
--enable-languages=c,c++ --with-sysroot=/home/patrick/src/e7/prex_sysroot
--disable-nls --disable-werror --with-newlib
--with-gmp=/home/patrick/src/e7/toolchain/stage2
--with-mpfr=/home/patrick/src/e7/toolchain/stage2 --disable-shared
--disable-debug --disable-libssp --with-cpu=8540
Thread model: single
gcc version 4.6.0 (GCC)

I have tried this with binutils 2.21 and the latest 2.21.51 development
snapshot.

Please let me know if there is any other information I can provide to assist in
working this out.

Thanks,

    Patrick


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]