This is the mail archive of the gcc-help@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]

Help with LTO linking in gcc 4.6.0


Hi all,

I'm running into a problem using LTO for linking when using the -nostdlib option.

If I perform the same link with the same object files without using -flto the link is successful.

Here is the successful case:

$ powerpc-eabispe-gcc -nostdlib -Os -o prog main.o foo.o crt0.o `powerpc-eabispe-gcc -print-libgcc-file-name`

Here is the unsuccessful case:

$ powerpc-eabispe-gcc -nostdlib -flto -fuse-linker-plugin -Os -o prog main.o foo.o crt0.o `powerpc-eabispe-gcc -print-libgcc-file-name`
/tmp/ccJRW7xo.ltrans0.ltrans.o: In function `_Z3fooi.constprop.0.1466':
ccJRW7xo.ltrans0.o:(.text+0x74): undefined reference to `_rest32gpr_30_x'
collect2: ld returned 1 exit status


This problem does not occur if -nostdlib isn't specified. This suggests to me that gcc is somehow handling libgcc differently if it is specified on the command line??

Is this my (stupid?) error or have I stumbled across a gcc bug?

If it helps I can bundle up my contrived example and send it to anyone who can help. The compiler in question is a powerpc cross compiler. Here is the output from gcc -v.

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



Thanks,


Patrick


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