* [U-Boot] [PATCH] Makefile: prevent libgcc to be linked twice
@ 2011-10-17 13:41 Nicolas Ferre
2011-10-17 17:25 ` Mike Frysinger
0 siblings, 1 reply; 5+ messages in thread
From: Nicolas Ferre @ 2011-10-17 13:41 UTC (permalink / raw)
To: u-boot
If we define USE_PRIVATE_LIBGCC, PLATFORM_LIBS is used during
link. During this last link editing, libgcc may be listed twice
and fail.
Prevent this using "filter-out" in top Makefile.
Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com>
---
Makefile | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/Makefile b/Makefile
index 5db2e0e..4bdfe11 100644
--- a/Makefile
+++ b/Makefile
@@ -311,7 +311,8 @@ endif
else
PLATFORM_LIBGCC = -L $(shell dirname `$(CC) $(CFLAGS) -print-libgcc-file-name`) -lgcc
endif
-PLATFORM_LIBS += $(PLATFORM_LIBGCC)
+PLATFORM_LIBS := $(PLATFORM_LIBGCC) \
+ $(filter-out %$(PLATFORM_LIBGCC), $(PLATFORM_LIBS))
export PLATFORM_LIBS
# Special flags for CPP when processing the linker script.
--
1.7.5.4
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [U-Boot] [PATCH] Makefile: prevent libgcc to be linked twice
2011-10-17 13:41 [U-Boot] [PATCH] Makefile: prevent libgcc to be linked twice Nicolas Ferre
@ 2011-10-17 17:25 ` Mike Frysinger
2011-10-18 8:30 ` Nicolas Ferre
0 siblings, 1 reply; 5+ messages in thread
From: Mike Frysinger @ 2011-10-17 17:25 UTC (permalink / raw)
To: u-boot
On Monday 17 October 2011 09:41:15 Nicolas Ferre wrote:
> If we define USE_PRIVATE_LIBGCC, PLATFORM_LIBS is used during
> link. During this last link editing, libgcc may be listed twice
> and fail.
> Prevent this using "filter-out" in top Makefile.
could you please provide more details ? libgcc should not be listed twice.
-mike
^ permalink raw reply [flat|nested] 5+ messages in thread
* [U-Boot] [PATCH] Makefile: prevent libgcc to be linked twice
2011-10-17 17:25 ` Mike Frysinger
@ 2011-10-18 8:30 ` Nicolas Ferre
2011-10-18 16:06 ` Mike Frysinger
0 siblings, 1 reply; 5+ messages in thread
From: Nicolas Ferre @ 2011-10-18 8:30 UTC (permalink / raw)
To: u-boot
On 10/17/2011 07:25 PM, Mike Frysinger :
> On Monday 17 October 2011 09:41:15 Nicolas Ferre wrote:
>> If we define USE_PRIVATE_LIBGCC, PLATFORM_LIBS is used during
>> link. During this last link editing, libgcc may be listed twice
>> and fail.
>> Prevent this using "filter-out" in top Makefile.
>
> could you please provide more details ? libgcc should not be listed twice.
I compile current u-boot with the flowing command line:
make -j5 CROSS_COMPILE=arm-linux-gnueabi- USE_PRIVATE_LIBGCC=yes at91sam9m10g45ek_nandflash
On an Ubuntu 11.10 with Linaro's cross-toolchain (targeting ARMv7). My SoC is an ARM926 so I use the "USE_PRIVATE_LIBGCC=yes" switch. This will prevent the build to take libgcc from my host but compile the u-boot embedded libgcc: everything is fine, good feature.
But, here is the final link editing stage:
UNDEF_SYM=`arm-linux-gnueabi-objdump -x board/atmel/at91sam9m10g45ek/libat91sam9m10g45ek.o api/libapi.o arch/arm/cpu/arm926ejs/at91/libat91.o arch/arm/cpu/arm926ejs/libarm926ejs.o arch/arm/lib/libarm.o common/libcommon.o disk/libdisk.o drivers/bios_emulator/libatibiosemu.o drivers/block/libblock.o drivers/dma/libdma.o drivers/fpga/libfpga.o drivers/gpio/libgpio.o drivers/hwmon/libhwmon.o drivers/i2c/libi2c.o drivers/input/libinput.o drivers/misc/libmisc.o drivers/mmc/libmmc.o drivers/mtd/libmtd.o drivers/mtd/nand/libnand.o drivers/mtd/onenand/libonenand.o drivers/mtd/spi/libspi_flash.o drivers/mtd/ubi/libubi.o drivers/net/libnet.o drivers/net/phy/libphy.o drivers/pci/libpci.o drivers/pcmcia/libpcmcia.o drivers/power/libpower.o drivers/rtc/librtc.o drivers/serial/libserial.o drivers/spi/libspi.o drivers/twserial/libtws.o drivers/usb/eth/libusb_eth.o drivers/usb/gadget/libusb_gadget.o drivers/usb/host/libusb_host.o drivers/usb/musb/libusb_musb.o drivers/usb/phy/libusb_phy.o dri
vers/video/libvideo.o drivers/watchdog/libwatchdog.o fs/cramfs/libcramfs.o fs/ext2/libext2fs.o fs/fat/libfat.o fs/fdos/libfdos.o fs/jffs2/libjffs2.o fs/reiserfs/libreiserfs.o fs/ubifs/libubifs.o fs/yaffs2/libyaffs2.o lib/libfdt/libfdt.o lib/libgeneric.o lib/lzma/liblzma.o lib/lzo/liblzo.o lib/zlib/libz.o net/libnet.o post/libpost.o | sed -n -e 's/.*\(__u_boot_cmd_.*\)/-u\1/p'|sort|uniq`; cd /home/nferre/workspace/u-boot/u-boot-git && arm-linux-gnueabi-ld -pie -T u-boot.lds -Bstatic -Ttext 0x73f00000 $UNDEF_SYM arch/arm/cpu/arm926ejs/start.o --start-group api/libapi.o arch/arm/cpu/arm926ejs/at91/libat91.o arch/arm/cpu/arm926ejs/libarm926ejs.o arch/arm/lib/libarm.o common/libcommon.o disk/libdisk.o drivers/bios_emulator/libatibiosemu.o drivers/block/libblock.o drivers/dma/libdma.o drivers/fpga/libfpga.o drivers/gpio/libgpio.o drivers/hwmon/libhwmon.o drivers/i2c/libi2c.o drivers/input/libinput.o drivers/misc/libmisc.o drivers/mmc/libmmc.o drivers/mtd/libmtd.o drivers/mtd/nand
/libnand.o drivers/mtd/onenand/libonenand.o drivers/mtd/spi/libspi_flash.o drivers/mtd/ubi/libubi.o drivers/net/libnet.o drivers/net/phy/libphy.o drivers/pci/libpci.o drivers/pcmcia/libpcmcia.o drivers/power/libpower.o drivers/rtc/librtc.o drivers/serial/libserial.o drivers/spi/libspi.o drivers/twserial/libtws.o drivers/usb/eth/libusb_eth.o drivers/usb/gadget/libusb_gadget.o drivers/usb/host/libusb_host.o drivers/usb/musb/libusb_musb.o drivers/usb/phy/libusb_phy.o drivers/video/libvideo.o drivers/watchdog/libwatchdog.o fs/cramfs/libcramfs.o fs/ext2/libext2fs.o fs/fat/libfat.o fs/fdos/libfdos.o fs/jffs2/libjffs2.o fs/reiserfs/libreiserfs.o fs/ubifs/libubifs.o fs/yaffs2/libyaffs2.o lib/libfdt/libfdt.o lib/libgeneric.o lib/lzma/liblzma.o lib/lzo/liblzo.o lib/zlib/libz.o net/libnet.o post/libpost.o board/atmel/at91sam9m10g45ek/libat91sam9m10g45ek.o --end-group /home/nferre/workspace/u-boot/u-boot-git/arch/arm/lib/eabi_compat.o /home/nferre/workspace/u-boot/u-boot-git/arch/arm/lib
/libgcc.o /home/nferre/workspace/u-boot/u-boot-git/arch/arm/lib/libgcc.o -Map u-boot.map -o u-boot
And you see that there is arch/arm/lib/libgcc.o included twice in object files that have to be linked together. I think that it is coming from the PLATFORM_LIBS variable so I modified like in my patch which solves the problem.
Best regards,
--
Nicolas Ferre
^ permalink raw reply [flat|nested] 5+ messages in thread
* [U-Boot] [PATCH] Makefile: prevent libgcc to be linked twice
2011-10-18 8:30 ` Nicolas Ferre
@ 2011-10-18 16:06 ` Mike Frysinger
2011-10-20 8:26 ` Nicolas Ferre
0 siblings, 1 reply; 5+ messages in thread
From: Mike Frysinger @ 2011-10-18 16:06 UTC (permalink / raw)
To: u-boot
On Tuesday 18 October 2011 04:30:27 Nicolas Ferre wrote:
> On 10/17/2011 07:25 PM, Mike Frysinger :
> > On Monday 17 October 2011 09:41:15 Nicolas Ferre wrote:
> >> If we define USE_PRIVATE_LIBGCC, PLATFORM_LIBS is used during
> >> link. During this last link editing, libgcc may be listed twice
> >> and fail.
> >> Prevent this using "filter-out" in top Makefile.
> >
> > could you please provide more details ? libgcc should not be listed
> > twice.
>
> I compile current u-boot with the flowing command line:
> make -j5 CROSS_COMPILE=arm-linux-gnueabi- USE_PRIVATE_LIBGCC=yes
> at91sam9m10g45ek_nandflash
the issue shows up when using the board shortcut, and only when your tree is
already configured. if you use at91sam9m10g45ek_nandflash_config and then
another make, it works fine. if you start from a clean tree (git clean -x -d),
it works fine.
this is due to PLATFORM_LIBS appending PLATFORM_LIBGCC when the tree has been
configured, then exporting PLATFORM_LIBS, then the board shortcut running
$(MAKE). the exported PLATFORM_LIBS gets LIBGCC appended a second time.
this issue will show up with any value that gets appended to PLATFORM_LIBS and
not just libgcc. the arm code already hits this and deals with it locally.
seems like we should instead unify this logic, or redo PLATFORM_LIBS so that
it isn't an issue in the first place.
-mike
^ permalink raw reply [flat|nested] 5+ messages in thread
* [U-Boot] [PATCH] Makefile: prevent libgcc to be linked twice
2011-10-18 16:06 ` Mike Frysinger
@ 2011-10-20 8:26 ` Nicolas Ferre
0 siblings, 0 replies; 5+ messages in thread
From: Nicolas Ferre @ 2011-10-20 8:26 UTC (permalink / raw)
To: u-boot
On 10/18/2011 06:06 PM, Mike Frysinger :
> On Tuesday 18 October 2011 04:30:27 Nicolas Ferre wrote:
>> On 10/17/2011 07:25 PM, Mike Frysinger :
>>> On Monday 17 October 2011 09:41:15 Nicolas Ferre wrote:
>>>> If we define USE_PRIVATE_LIBGCC, PLATFORM_LIBS is used during
>>>> link. During this last link editing, libgcc may be listed twice
>>>> and fail.
>>>> Prevent this using "filter-out" in top Makefile.
>>>
>>> could you please provide more details ? libgcc should not be listed
>>> twice.
>>
>> I compile current u-boot with the flowing command line:
>> make -j5 CROSS_COMPILE=arm-linux-gnueabi- USE_PRIVATE_LIBGCC=yes
>> at91sam9m10g45ek_nandflash
>
> the issue shows up when using the board shortcut, and only when your tree is
> already configured. if you use at91sam9m10g45ek_nandflash_config and then
> another make, it works fine. if you start from a clean tree (git clean -x -d),
> it works fine.
Ah thanks for the information. Indeed it is a more common way of using
the configuration/compilation flow...
> this is due to PLATFORM_LIBS appending PLATFORM_LIBGCC when the tree has been
> configured, then exporting PLATFORM_LIBS, then the board shortcut running
> $(MAKE). the exported PLATFORM_LIBS gets LIBGCC appended a second time.
>
> this issue will show up with any value that gets appended to PLATFORM_LIBS and
> not just libgcc. the arm code already hits this and deals with it locally.
> seems like we should instead unify this logic, or redo PLATFORM_LIBS so that
> it isn't an issue in the first place.
Yes, that it a bit confusing... But with proper explanation, we can deal
with this.
Thanks for your help, best regards,
--
Nicolas Ferre
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2011-10-20 8:26 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-10-17 13:41 [U-Boot] [PATCH] Makefile: prevent libgcc to be linked twice Nicolas Ferre
2011-10-17 17:25 ` Mike Frysinger
2011-10-18 8:30 ` Nicolas Ferre
2011-10-18 16:06 ` Mike Frysinger
2011-10-20 8:26 ` Nicolas Ferre
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox