From 8967c6500836165369d7c1944364143d4e0b9be7 Mon Sep 17 00:00:00 2001 From: patacongo Date: Tue, 30 Aug 2011 12:49:24 +0000 Subject: [PATCH] Fix issue with multilib build git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@3926 42af7a65-404d-4744-a932-0658087f49c3 --- ChangeLog | 14 ++++++++++---- arch/arm/src/Makefile | 2 +- arch/avr/src/Makefile | 2 +- arch/hc/src/Makefile | 2 +- arch/mips/src/Makefile | 2 +- arch/sh/src/Makefile | 2 +- arch/x86/src/Makefile | 2 +- arch/z80/src/Makefile.sdcc | 2 +- 8 files changed, 17 insertions(+), 11 deletions(-) diff --git a/ChangeLog b/ChangeLog index 682cf49ef1d..69ac0a8a3b9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1485,7 +1485,7 @@ * arch/arm/stm32/stm32_idle.c: During idle times, the STM32 now uses the WFI instruction to sleep in a reduced power mode until the next interrupt - occurs (Contributed by Uros Platise). + occurs (Contributed by Uros Platise). * NSH: 'mem' command renamed to 'free'. Output is now more similar to the Linux 'free' command. * NSH: Correct a redirection bug in NSH. The following would not work; it @@ -1766,8 +1766,8 @@ (contributed by Uros Platise) * arch/mips and configs/pcblogic-pic32mx: The MicroChip PIC32MX port is now code complete and ready to begin testing. Unfortunately, it looks like - testing will be delayed due to tool issues (My PICkit 2 will not work the - the MPLAB debugger on PIC32; I will need to get a PICkit 3). + testing will be delayed due to tool issues (My PICkit 2 will not work the + the MPLAB debugger on PIC32; I will need to get a PICkit 3). * drivers/net/e1000.c/h: A PCI-based E1000 Ethernet driver submitted by Yu Qiang. * lib/net/lib_inetaddr.c: An implementation of the inet_addr() function @@ -2042,4 +2042,10 @@ layer). * drivers/bch: Fixed some important bugs in the BCH driver (noted by Li Zhuoyi (Lzyy)). This would have effected any large reads or writes - (larger than the hardware sector size). + (larger than the hardware sector size). + * arch/*/src/Makefile: Use of -print-libgcc-file-name to get path to + libgcc.a may select the wrong libgcc.a if a multilib toolchain (like + CodeSourcery) is used. This can be a serious problem and can cause + crashes on Cortex-M3 if the ARM libgcc is used, for example. The fix + is to include ARCHCPUFLAGS on the gcc command line when asking it to + -print-libgcc-file-name. diff --git a/arch/arm/src/Makefile b/arch/arm/src/Makefile index 730d41ba188..7e1cfdb0c82 100644 --- a/arch/arm/src/Makefile +++ b/arch/arm/src/Makefile @@ -85,7 +85,7 @@ LDLIBS = $(patsubst lib%,-l%,$(basename $(notdir $(LINKLIBS)))) BOARDDIR = $(TOPDIR)/arch/$(CONFIG_ARCH)/src/board -LIBGCC = "${shell $(CC) -print-libgcc-file-name}" +LIBGCC = "${shell $(CC) $(ARCHCPUFLAGS) -print-libgcc-file-name}" VPATH = chip:common:$(ARCH_SUBDIR) diff --git a/arch/avr/src/Makefile b/arch/avr/src/Makefile index 7683bcfdd11..fa66d6dfab9 100644 --- a/arch/avr/src/Makefile +++ b/arch/avr/src/Makefile @@ -90,7 +90,7 @@ LDLIBS = $(patsubst lib%,-l%,$(basename $(notdir $(LINKLIBS)))) BOARDDIR = $(TOPDIR)/arch/$(CONFIG_ARCH)/src/board -LIBGCC = "${shell $(CC) -print-libgcc-file-name}" +LIBGCC = "${shell $(CC) $(ARCHCPUFLAGS) -print-libgcc-file-name}" VPATH = chip:common:$(ARCH_SUBDIR) diff --git a/arch/hc/src/Makefile b/arch/hc/src/Makefile index 57a6d43057b..a5e0425a86d 100755 --- a/arch/hc/src/Makefile +++ b/arch/hc/src/Makefile @@ -82,7 +82,7 @@ LDLIBS = $(patsubst lib%,-l%,$(basename $(notdir $(LINKLIBS)))) BOARDDIR = $(TOPDIR)/arch/$(CONFIG_ARCH)/src/board -LIBGCC = "${shell $(CC) -print-libgcc-file-name}" +LIBGCC = "${shell $(CC) $(ARCHCPUFLAGS) -print-libgcc-file-name}" VPATH = chip:common:$(ARCH_SUBDIR) diff --git a/arch/mips/src/Makefile b/arch/mips/src/Makefile index 19981282f49..8d0f4d5af4b 100644 --- a/arch/mips/src/Makefile +++ b/arch/mips/src/Makefile @@ -79,7 +79,7 @@ LDLIBS = $(patsubst lib%,-l%,$(basename $(notdir $(LINKLIBS)))) BOARDDIR = $(TOPDIR)/arch/$(CONFIG_ARCH)/src/board -LIBGCC = "${shell $(CC) -print-libgcc-file-name}" +LIBGCC = "${shell $(CC) $(ARCHCPUFLAGS) -print-libgcc-file-name}" VPATH = chip:common:$(ARCH_SUBDIR) diff --git a/arch/sh/src/Makefile b/arch/sh/src/Makefile index 56fe3ac5ed8..fdf6cc85267 100644 --- a/arch/sh/src/Makefile +++ b/arch/sh/src/Makefile @@ -59,7 +59,7 @@ LDLIBS = $(patsubst lib%,-l%,$(basename $(notdir $(LINKLIBS)))) BOARDDIR = $(TOPDIR)/arch/$(CONFIG_ARCH)/src/board -LIBGCC = ${shell $(CC) -print-libgcc-file-name} +LIBGCC = ${shell $(CC) $(ARCHCPUFLAGS) -print-libgcc-file-name} VPATH = chip:common diff --git a/arch/x86/src/Makefile b/arch/x86/src/Makefile index 6be4053afdb..d7b2140c853 100644 --- a/arch/x86/src/Makefile +++ b/arch/x86/src/Makefile @@ -79,7 +79,7 @@ LDLIBS = $(patsubst lib%,-l%,$(basename $(notdir $(LINKLIBS)))) BOARDDIR = $(TOPDIR)/arch/$(CONFIG_ARCH)/src/board -LIBGCC = "${shell $(CC) -print-libgcc-file-name}" +LIBGCC = "${shell $(CC) $(ARCHCPUFLAGS) -print-libgcc-file-name}" ifeq ($(HOSTOS),FreeBSD) HOST_ARCH = ${shell uname -m 2>/dev/null || echo "Other"} diff --git a/arch/z80/src/Makefile.sdcc b/arch/z80/src/Makefile.sdcc index 24099fc92b6..a9152ea7958 100644 --- a/arch/z80/src/Makefile.sdcc +++ b/arch/z80/src/Makefile.sdcc @@ -75,7 +75,7 @@ VPATH = chip:common:board # Libraries -LIBGCC = ${shell $(CC) -print-libgcc-file-name} +LIBGCC = ${shell $(CC) $(ARCHCPUFLAGS) -print-libgcc-file-name} # Supports dynamic sizing of HEAP. #