public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* LTO with static libraries
@ 2011-10-24  9:51 Sebastian Huber
  2011-10-24 17:06 ` Ian Lance Taylor
  2011-10-24 17:21 ` xunxun
  0 siblings, 2 replies; 4+ messages in thread
From: Sebastian Huber @ 2011-10-24  9:51 UTC (permalink / raw)
  To: gcc-help

Hello,

when I run the GCC testsuite for RTEMS and the ARM EABI target, then I get this:

Running 
/home/sh/archive/gcc-4.6-20111021-work/gcc/testsuite/gcc.c-torture/execute/builtins/builtins.exp 
...
FAIL: gcc.c-torture/execute/builtins/20010124-1.c compilation,  -O2 -flto 
-flto-partition=none

This is due to:

/home/sh/b-arm-gcc/gcc/xgcc -B/home/sh/b-arm-gcc/gcc/ 
/home/sh/archive/gcc-4.6-20111021-work/gcc/testsuite/gcc.c-torture/execute/builtins/20010124-1.c 
/home/sh/archive/gcc-4.6-20111021-work/gcc/testsuite/gcc.c-torture/execute/builtins/20010124-1-lib.c 
/home/sh/archive/gcc-4.6-20111021-work/gcc/testsuite/gcc.c-torture/execute/builtins/lib/main.c 
gcc_tg.o  -w  -O2 -flto -flto-partition=none  -DSTACK_SIZE=2048  -isystem 
/home/sh/b-arm-gcc/arm-rtemseabi4.11/./newlib/targ-include -isystem 
/home/sh/archive/gcc-4.6-20111021-work/newlib/libc/include -mcpu=arm7tdmi 
-B/home/sh/install-4.6-20111021/arm-rtemseabi4.11/edb7312/lib/ -specs bsp_specs 
-qrtems  -B/home/sh/b-arm-gcc/arm-rtemseabi4.11/./newlib/ 
-L/home/sh/b-arm-gcc/arm-rtemseabi4.11/./newlib 
/home/sh/b-arm-gcc/rtems_gcc_main.o  -Wl,-wrap,exit -Wl,-wrap,_exit 
-Wl,-wrap,main -Wl,-wrap,abort -lm   -o 
/home/sh/b-arm-gcc/gcc/testsuite/gcc/20010124-1.x6 -Wl,-Map,map.txt -save-temps
[Leaving LTRANS /tmp/cc0vFDjO.args]
/tmp/ccTLtFeu.lto.o: In function `memcpy':
20010124-1.o:(.text+0x4): multiple definition of `memcpy'
/home/sh/b-arm-gcc/arm-rtemseabi4.11/./newlib/libc.a(lib_a-memcpy.o):/home/sh/archive/gcc-4.6-20111021-work/newlib/libc/string/memcpy.c:79: 
first defined here
collect2: ld returned 1 exit status

In the linker map file I have this:

LOAD /home/sh/install-4.6-20111021/arm-rtemseabi4.11/edb7312/lib/start.o
LOAD /home/sh/b-arm-gcc/gcc/crti.o
LOAD /home/sh/b-arm-gcc/gcc/crtbegin.o
LOAD 20010124-1.o
LOAD /tmp/ccTLtFeu.lto.o
LOAD /home/sh/b-arm-gcc/gcc/libgcc.a
LOAD /home/sh/install-4.6-20111021/arm-rtemseabi4.11/edb7312/lib/librtemsbsp.a
LOAD /home/sh/install-4.6-20111021/arm-rtemseabi4.11/edb7312/lib/librtemscpu.a
LOAD /home/sh/b-arm-gcc/arm-rtemseabi4.11/./newlib/libc.a
LOAD /home/sh/b-arm-gcc/gcc/libgcc.a
LOAD 20010124-1-lib.o
LOAD main.o
LOAD gcc_tg.o
LOAD /home/sh/b-arm-gcc/rtems_gcc_main.o
LOAD /home/sh/b-arm-gcc/arm-rtemseabi4.11/./newlib/libm.a
START GROUP
LOAD /home/sh/b-arm-gcc/gcc/libgcc.a
START GROUP
LOAD /home/sh/install-4.6-20111021/arm-rtemseabi4.11/edb7312/lib/librtemsbsp.a
LOAD /home/sh/install-4.6-20111021/arm-rtemseabi4.11/edb7312/lib/librtemscpu.a
LOAD /home/sh/b-arm-gcc/arm-rtemseabi4.11/./newlib/libc.a
LOAD /home/sh/b-arm-gcc/gcc/libgcc.a
END GROUP

The problem seems to be that this "/tmp/ccTLtFeu.lto.o" file pulls in memcpy() 
from libc.a and later 20010124-1-lib.o defines also memcpy().  I never used the 
LTO before and now I am not sure where to search for the error in this case. 
Is it probably in the linker command file?  Who produces this 
"/tmp/ccTLtFeu.lto.o" and what is its purpose (it is not preserved with 
-save-temps)?

The linker map file without LTO looks like this:

LOAD /home/sh/install-4.6-20111021/arm-rtemseabi4.11/edb7312/lib/start.o
LOAD /home/sh/b-arm-gcc/gcc/crti.o
LOAD /home/sh/b-arm-gcc/gcc/crtbegin.o
LOAD 20010124-1.o
LOAD 20010124-1-lib.o
LOAD main.o
LOAD gcc_tg.o
LOAD /home/sh/b-arm-gcc/rtems_gcc_main.o
LOAD /home/sh/b-arm-gcc/arm-rtemseabi4.11/./newlib/libm.a
START GROUP
LOAD /home/sh/b-arm-gcc/gcc/libgcc.a
START GROUP
LOAD /home/sh/install-4.6-20111021/arm-rtemseabi4.11/edb7312/lib/librtemsbsp.a
LOAD /home/sh/install-4.6-20111021/arm-rtemseabi4.11/edb7312/lib/librtemscpu.a
LOAD /home/sh/b-arm-gcc/arm-rtemseabi4.11/./newlib/libc.a
LOAD /home/sh/b-arm-gcc/gcc/libgcc.a
END GROUP

-- 
Sebastian Huber, embedded brains GmbH

Address : Obere Lagerstr. 30, D-82178 Puchheim, Germany
Phone   : +49 89 18 90 80 79-6
Fax     : +49 89 18 90 80 79-9
E-Mail  : sebastian.huber@embedded-brains.de
PGP     : Public key available on request.

Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: LTO with static libraries
  2011-10-24  9:51 LTO with static libraries Sebastian Huber
@ 2011-10-24 17:06 ` Ian Lance Taylor
  2011-10-25  7:53   ` Sebastian Huber
  2011-10-24 17:21 ` xunxun
  1 sibling, 1 reply; 4+ messages in thread
From: Ian Lance Taylor @ 2011-10-24 17:06 UTC (permalink / raw)
  To: Sebastian Huber; +Cc: gcc-help

Sebastian Huber <sebastian.huber@embedded-brains.de> writes:

> /tmp/ccTLtFeu.lto.o: In function `memcpy':
> 20010124-1.o:(.text+0x4): multiple definition of `memcpy'
> /home/sh/b-arm-gcc/arm-rtemseabi4.11/./newlib/libc.a(lib_a-memcpy.o):/home/sh/archive/gcc-4.6-20111021-work/newlib/libc/string/memcpy.c:79:
> first defined here

Which version of the linker are you using?  Can you try a newer version?

Ian

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: LTO with static libraries
  2011-10-24  9:51 LTO with static libraries Sebastian Huber
  2011-10-24 17:06 ` Ian Lance Taylor
@ 2011-10-24 17:21 ` xunxun
  1 sibling, 0 replies; 4+ messages in thread
From: xunxun @ 2011-10-24 17:21 UTC (permalink / raw)
  To: Sebastian Huber; +Cc: gcc-help

于 2011/10/24 17:50, Sebastian Huber 写道:
> /tmp/ccTLtFeu.lto.o: In function `memcpy':
> 20010124-1.o:(.text+0x4): multiple definition of `memcpy'
> /home/sh/b-arm-gcc/arm-rtemseabi4.11/./newlib/libc.a(lib_a-memcpy.o):/home/sh/archive/gcc-4.6-20111021-work/newlib/libc/string/memcpy.c:79: 
> first defined here
> collect2: ld returned 1 exit status 
Try to use "-Wl, --allow-multiple-definition "

In earlier days, ld on MinGW has this bug, and it has been fixed in CVS, 
but I don't know arm target.

-- 
Best Regards,
xunxun

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: LTO with static libraries
  2011-10-24 17:06 ` Ian Lance Taylor
@ 2011-10-25  7:53   ` Sebastian Huber
  0 siblings, 0 replies; 4+ messages in thread
From: Sebastian Huber @ 2011-10-25  7:53 UTC (permalink / raw)
  To: Ian Lance Taylor; +Cc: gcc-help

On 10/24/2011 07:06 PM, Ian Lance Taylor wrote:
> Which version of the linker are you using?  Can you try a newer version?

I used GNU Binutils 2.21.1 (the latest release).  I installed now 
2.21.53.20110922 (2.22 release branch).  This didn't work.  Then I checked the 
Binutils configure options and added "--enable-lto".

/home/sh/archive/binutils-2.21.53/configure --target=arm-rtemseabi4.11 
--prefix=/opt/rtems-4.11 --disable-nls --disable-win32-registry 
--disable-werror --enable-lto

With this I still get:

/home/sh/b-arm-gcc/gcc/xgcc -B/home/sh/b-arm-gcc/gcc/ 
/home/sh/archive/gcc-4.6-20111021-work/gcc/testsuite/gcc.c-torture/execute/builtins/20010124-1.c 
/home/sh/archive/gcc-4.6-20111021-work/gcc/testsuite/gcc.c-torture/execute/builtins/20010124-1-lib.c 
/home/sh/archive/gcc-4.6-20111021-work/gcc/testsuite/gcc.c-torture/execute/builtins/lib/main.c 
gcc_tg.o  -w  -O2 -flto -flto-partition=none  -DSTACK_SIZE=2048  -isystem 
/home/sh/b-arm-gcc/arm-rtemseabi4.11/./newlib/targ-include -isystem 
/home/sh/archive/gcc-4.6-20111021-work/newlib/libc/include -mcpu=arm7tdmi 
-B/home/sh/install-4.6-20111021/arm-rtemseabi4.11/edb7312/lib/ -specs bsp_specs 
-qrtems  -B/home/sh/b-arm-gcc/arm-rtemseabi4.11/./newlib/ 
-L/home/sh/b-arm-gcc/arm-rtemseabi4.11/./newlib 
/home/sh/b-arm-gcc/rtems_gcc_main.o  -Wl,-wrap,exit -Wl,-wrap,_exit 
-Wl,-wrap,main -Wl,-wrap,abort -lm   -o 
/home/sh/b-arm-gcc/gcc/testsuite/gcc/20010124-1.x6
/tmp/ccJbMxyE.lto.o: In function `memcpy':
ccKyOGEO.o:(.text+0x4): multiple definition of `memcpy'
/home/sh/b-arm-gcc/arm-rtemseabi4.11/./newlib/libc.a(lib_a-memcpy.o):/home/sh/archive/gcc-4.6-20111021-work/newlib/libc/string/memcpy.c:79: 
first defined here
collect2: ld returned 1 exit status

If I add "-Wl,--allow-multiple-definition" as suggested by Xunxun the link 
process succeeds.

-- 
Sebastian Huber, embedded brains GmbH

Address : Obere Lagerstr. 30, D-82178 Puchheim, Germany
Phone   : +49 89 18 90 80 79-6
Fax     : +49 89 18 90 80 79-9
E-Mail  : sebastian.huber@embedded-brains.de
PGP     : Public key available on request.

Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2011-10-25  7:53 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-10-24  9:51 LTO with static libraries Sebastian Huber
2011-10-24 17:06 ` Ian Lance Taylor
2011-10-25  7:53   ` Sebastian Huber
2011-10-24 17:21 ` xunxun

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).