Hello,
I test currently the GCC 4.8 release candidate. Some GCC LTO tests fail for me
since the introduction of LTO in GCC. I use Binutils 2.23.1 for PowerPC EABI
(powerpc-rtems4.11 target) configured with:
/scratch/archive/binutils-2.23.1/configure --target=powerpc-rtemsas4.11
--prefix=/scratch/install-4.8.0-RC-20130316 --disable-werror --enable-lto
For GCC I use:
/scratch/archive/gcc-4.8.0-RC-20130316/configure --disable-werror
--enable-threads=rtems --with-gnu-as --disable-multilib --enable-lto
--enable-newlib-mb --enable-newlib-iconv --with-gnu-ld --with-newlib --verbose
--with-system-zlib --disable-nls --enable-version-specific-runtime-libs
--enable-languages=c,c++ --target=powerpc-rtems4.11
--prefix=/scratch/install-4.8.0-RC-20130316
Several test fail like this:
/scratch/b-powerpc-gcc/gcc/xgcc -B/scratch/b-powerpc-gcc/gcc/
/scratch/archive/gcc-4.8.0-RC-20130316/gcc/testsuite/gcc.c-torture/execute/builtins/20010124-1.c
/scratch/archive/gcc-4.8.0-RC-20130316/gcc/testsuite/gcc.c-torture/execute/builtins/20010124-1-lib.c
/scratch/archive/gcc-4.8.0-RC-20130316/gcc/testsuite/gcc.c-torture/execute/builtins/lib/main.c
gcc_tg.o -fno-diagnostics-show-caret -w -O2 -flto -fuse-linker-plugin
-fno-fat-lto-objects -fno-tree-loop-distribute-patterns -DSTACK_SIZE=2048
-isystem /scratch/b-powerpc-gcc/powerpc-rtems4.11/./newlib/targ-include
-isystem /scratch/archive/gcc-4.8.0-RC-20130316/newlib/libc/include
-B/scratch/install-4.8.0-RC-20130316/powerpc-rtems4.11/psim/lib/ -specs
bsp_specs -qrtems -B/scratch/b-powerpc-gcc/powerpc-rtems4.11/./newlib/
-L/scratch/b-powerpc-gcc/powerpc-rtems4.11/./newlib
/scratch/b-powerpc-gcc/rtems_gcc_main.o -Wl,-wrap,exit -Wl,-wrap,_exit
-Wl,-wrap,main -Wl,-wrap,abort -lm -o
/scratch/b-powerpc-gcc/gcc/testsuite/gcc/20010124-1.x8 -Wl,-Map,map.txt -save-temps
[Leaving LTRANS /tmp/cc0uaa6j.args]
[Leaving LTRANS 20010124-1.x8.ltrans.out]
[Leaving LTRANS /tmp/cccIkbEk.args]
[Leaving LTRANS 20010124-1.x8.ltrans0.o]
20010124-1.x8.ltrans0.ltrans.o: In function `memcpy':
20010124-1.x8.ltrans0.o:(.text+0x4): multiple definition of `memcpy'
/scratch/b-powerpc-gcc/powerpc-rtems4.11/./newlib/libc.a(lib_a-memcpy.o):/scratch/archive/gcc-4.8.0-RC-20130316/newlib/libc/string/memcpy.c:78:
first defined here
collect2: error: ld returned 1 exit status
The specs file (bsp_specs) is this:
%rename endfile old_endfile
%rename startfile old_startfile
%rename link old_link
*startfile:
%{!qrtems: %(old_startfile)} \
%{!nostdlib: %{qrtems: ecrti%O%s rtems_crti%O%s crtbegin.o%s \
start.o%s -e _start -u __vectors}}
*link:
%{!qrtems: %(old_link)} %{qrtems: -dp -Bstatic}
*endfile:
%{!qrtems: %(old_endfile)} %{qrtems: crtend.o%s ecrtn.o%s}
The start symbol _start will pull in a lot of code from the operating system
which uses memcpy(). The file 20010124-1-lib.c specified at the command line
above defines a global memcpy() function. In the linker map file I see this:
/scratch/b-powerpc-gcc/powerpc-rtems4.11/./newlib/libc.a(lib_a-memcpy.o)
/scratch/install-4.8.0-RC-20130316/powerpc-rtems4.11/psim/lib/librtemsbsp.a(exc_bspsupport.o)
(memcpy)
.text 0x00000000000001f0 0x8c
/scratch/install-4.8.0-RC-20130316/powerpc-rtems4.11/psim/lib/start.o
0x00000000000001f4 __rtems_entry_point
0x00000000000001f4 _start
0x0000000000000274 bsp_reset
.text 0x000000000000027c 0x88 20010124-1.x8.ltrans0.ltrans.o
.text.startup 0x0000000000000304 0x30 20010124-1.x8.ltrans0.ltrans.o
0x0000000000000304 main
.text 0x0000000000000334 0x33c gcc_tg.o
0x000000000000041c __wrap_exit
0x0000000000000504 __wrap__exit
0x00000000000005f0 __wrap_abort
0x0000000000000634 __wrap_main
So the memcpy from libc is used instead of the one defined in 20010124-1-lib.c.
If I execute this command line (no LTO switches):
/scratch/git-rtems-testing/gcc/b-powerpc-gcc/gcc/xgcc
-B/scratch/git-rtems-testing/gcc/b-powerpc-gcc/gcc/
/home/sh/archive/gcc-4.8.0-RC-20130316/gcc/testsuite/gcc.c-torture/execute/builtins/20010124-1.c
/home/sh/archive/gcc-4.8.0-RC-20130316/gcc/testsuite/gcc.c-torture/execute/builtins/20010124-1-lib.c
/home/sh/archive/gcc-4.8.0-RC-20130316/gcc/testsuite/gcc.c-torture/execute/builtins/lib/main.c
gcc_tg.o -fno-diagnostics-show-caret -w -O2 -DSTACK_SIZE=2048 -isystem
/scratch/git-rtems-testing/gcc/b-powerpc-gcc/powerpc-rtems4.11/./newlib/targ-include
-isystem /home/sh/archive/gcc-4.8.0-RC-20130316/newlib/libc/include
-B/scratch/git-rtems-testing/gcc/install-4.8.0-RC-20130316/powerpc-rtems4.11/psim/lib/
-specs bsp_specs -qrtems
-B/scratch/git-rtems-testing/gcc/b-powerpc-gcc/powerpc-rtems4.11/./newlib/
-L/scratch/git-rtems-testing/gcc/b-powerpc-gcc/powerpc-rtems4.11/./newlib
/scratch/git-rtems-testing/gcc/b-powerpc-gcc/rtems_gcc_main.o -Wl,-wrap,exit
-Wl,-wrap,_exit -Wl,-wrap,main -Wl,-wrap,abort -lm -o
/scratch/git-rtems-testing/gcc/b-powerpc-gcc/gcc/testsuite/gcc/20010124-1.x8
-Wl,-Map,map.txt -save-temps
It links fine, and in the linker map file I see this:
.text 0x00000000000001f0 0x8c
/scratch/install-4.8.0-RC-20130316/powerpc-rtems4.11/psim/lib/start.o
0x00000000000001f4 __rtems_entry_point
0x00000000000001f4 _start
0x0000000000000274 bsp_reset
.text 0x000000000000027c 0x5c 20010124-1.o
0x000000000000027c main_test
.text 0x00000000000002d8 0xac 20010124-1-lib.o
0x00000000000002d8 f
0x00000000000002fc g
0x0000000000000300 memcpy
.text 0x0000000000000384 0x0 main.o
.text.startup 0x0000000000000384 0x44 main.o
0x0000000000000384 main
.text 0x00000000000003c8 0x33c gcc_tg.o
0x00000000000004b0 __wrap_exit
0x0000000000000598 __wrap__exit
0x0000000000000684 __wrap_abort
0x00000000000006c8 __wrap_main
There is no memcpy from libc in contrast to the original GCC test.
I have this problem on other targets as well. Has someone a hint what can be
wrong here since I am quite clueless.