build: Move the toolchain library setting to the common place

so all boards support C++ automatically
This commit is contained in:
Xiang Xiao 2020-07-15 20:51:26 +08:00 committed by Alan Carvalho de Assis
parent f5311de6b4
commit 4910d43ab0
36 changed files with 301 additions and 85 deletions

View File

@ -127,9 +127,6 @@ ifeq ($(BOARDMAKE),y)
LDLIBS += -lboard
endif
LIBGCC = "${shell "$(CC)" $(ARCHCPUFLAGS) -print-libgcc-file-name}"
GCC_LIBDIR := ${shell dirname $(LIBGCC)}
VPATH += chip
VPATH += common
VPATH += $(ARCH_SUBDIR)
@ -168,7 +165,7 @@ nuttx$(EXEEXT): $(HEAD_OBJ) board$(DELIM)libboard$(LIBEXT)
$(Q) echo "LD: nuttx"
$(Q) $(LD) --entry=__start $(LDFLAGS) $(LIBPATHS) $(EXTRA_LIBPATHS) \
-o $(NUTTX) $(HEAD_OBJ) $(EXTRA_OBJS) \
$(LDSTARTGROUP) $(LDLIBS) $(EXTRA_LIBS) $(LIBGCC) $(LDENDGROUP)
$(LDSTARTGROUP) $(LDLIBS) $(EXTRA_LIBS) $(LDENDGROUP)
ifneq ($(CONFIG_WINDOWS_NATIVE),y)
$(Q) $(NM) $(NUTTX) | \
grep -v '\(compiled\)\|\(\$(OBJEXT)$$\)\|\( [aUw] \)\|\(\.\.ng$$\)\|\(LASH[RL]DI\)' | \

View File

@ -87,3 +87,18 @@ ifeq ($(CONFIG_ARM_TOOLCHAIN),GNU_EABI)
ARCROSSDEV ?= arm-none-eabi-
MAXOPTIMIZATION ?= -Os
endif
# Add the builtin library
EXTRA_LIBS += -lgcc
EXTRA_LIBPATHS += -L ${dir ${shell $(CC) $(ARCHCPUFLAGS) --print-file-name=libgcc.a}}
ifneq ($(CONFIG_LIBM),y)
EXTRA_LIBS += -lm
EXTRA_LIBPATHS += -L ${dir ${shell $(CC) $(ARCHCPUFLAGS) --print-file-name=libm.a}}
endif
ifeq ($(CONFIG_CXX_LIBSUPCXX),y)
EXTRA_LIBS += lsupc++
EXTRA_LIBPATHS += -L ${dir ${shell $(CC) $(ARCHCPUFLAGS) --print-file-name=libsupc++.a}}
endif

View File

@ -81,3 +81,18 @@ endif
# optimization level will be set to -Os
MAXOPTIMIZATION ?= -Os
# Add the builtin library
EXTRA_LIBS += -lgcc
EXTRA_LIBPATHS += -L "${dir ${shell $(CC) $(ARCHCPUFLAGS) --print-file-name=libgcc.a}}"
ifneq ($(CONFIG_LIBM),y)
EXTRA_LIBS += -lm
EXTRA_LIBPATHS += -L "${dir ${shell $(CC) $(ARCHCPUFLAGS) --print-file-name=libm.a}}"
endif
ifeq ($(CONFIG_CXX_LIBSUPCXX),y)
EXTRA_LIBS += -lsupc++
EXTRA_LIBPATHS += -L "${dir ${shell $(CC) $(ARCHCPUFLAGS) --print-file-name=libsupc++.a}}"
endif

View File

@ -105,3 +105,18 @@ ifeq ($(CONFIG_ARMV7A_TOOLCHAIN),GNU_EABI)
ARCROSSDEV ?= $(TARGET_ARCH)-none-eabi-
MAXOPTIMIZATION ?= -Os
endif
# Add the builtin library
EXTRA_LIBS += -lgcc
EXTRA_LIBPATHS += -L "${dir ${shell $(CC) $(ARCHCPUFLAGS) --print-file-name=libgcc.a}}"
ifneq ($(CONFIG_LIBM),y)
EXTRA_LIBS += -lm
EXTRA_LIBPATHS += -L "${dir ${shell $(CC) $(ARCHCPUFLAGS) --print-file-name=libm.a}}"
endif
ifeq ($(CONFIG_CXX_LIBSUPCXX),y)
EXTRA_LIBS += -lsupc++
EXTRA_LIBPATHS += -L "${dir ${shell $(CC) $(ARCHCPUFLAGS) --print-file-name=libsupc++.a}}"
endif

View File

@ -141,3 +141,18 @@ ifeq ($(CONFIG_ARMV7M_TOOLCHAIN),CLANG)
MAXOPTIMIZATION ?= -Os
ARCHCPUFLAGS = $(TOOLCHAIN_MCPU) -mthumb $(TOOLCHAIN_MFLOAT)
endif
# Add the builtin library
EXTRA_LIBS += -lgcc
EXTRA_LIBPATHS += -L "${dir ${shell $(CC) $(ARCHCPUFLAGS) --print-file-name=libgcc.a}}"
ifneq ($(CONFIG_LIBM),y)
EXTRA_LIBS += -lm
EXTRA_LIBPATHS += -L "${dir ${shell $(CC) $(ARCHCPUFLAGS) --print-file-name=libm.a}}"
endif
ifeq ($(CONFIG_CXX_LIBSUPCXX),y)
EXTRA_LIBS += -lsupc++
EXTRA_LIBPATHS += -L "${dir ${shell $(CC) $(ARCHCPUFLAGS) --print-file-name=libsupc++.a}}"
endif

View File

@ -87,3 +87,18 @@ ifeq ($(CONFIG_ARMV7R_TOOLCHAIN),GNU_EABI)
ARCROSSDEV ?= $(TARGET_ARCH)-none-eabi-
MAXOPTIMIZATION ?= -Os
endif
# Add the builtin library
EXTRA_LIBS += -lgcc
EXTRA_LIBPATHS += -L "${dir ${shell $(CC) $(ARCHCPUFLAGS) --print-file-name=libgcc.a}}"
ifneq ($(CONFIG_LIBM),y)
EXTRA_LIBS += -lm
EXTRA_LIBPATHS += -L "${dir ${shell $(CC) $(ARCHCPUFLAGS) --print-file-name=libm.a}}"
endif
ifeq ($(CONFIG_CXX_LIBSUPCXX),y)
EXTRA_LIBS += -lsupc++
EXTRA_LIBPATHS += -L "${dir ${shell $(CC) $(ARCHCPUFLAGS) --print-file-name=libsupc++.a}}"
endif

View File

@ -131,3 +131,18 @@ ifeq ($(CONFIG_ARMV8M_TOOLCHAIN),CLANG)
MAXOPTIMIZATION ?= -Os
ARCHCPUFLAGS = $(TOOLCHAIN_MCPU) -mthumb $(TOOLCHAIN_MFLOAT)
endif
# Add the builtin library
EXTRA_LIBS += -lgcc
EXTRA_LIBPATHS += -L "${dir ${shell $(CC) $(ARCHCPUFLAGS) --print-file-name=libgcc.a}}"
ifneq ($(CONFIG_LIBM),y)
EXTRA_LIBS += -lm
EXTRA_LIBPATHS += -L "${dir ${shell $(CC) $(ARCHCPUFLAGS) --print-file-name=libm.a}}"
endif
ifeq ($(CONFIG_CXX_LIBSUPCXX),y)
EXTRA_LIBS += -lsupc++
EXTRA_LIBPATHS += -L "${dir ${shell $(CC) $(ARCHCPUFLAGS) --print-file-name=libsupc++.a}}"
endif

View File

@ -99,8 +99,6 @@ ifeq ($(BOARDMAKE),y)
LDLIBS += -lboard
endif
LIBGCC = "${shell "$(CC)" $(ARCHCPUFLAGS) -print-libgcc-file-name}"
VPATH = chip:common:$(ARCH_SUBDIR)
all: $(HEAD_OBJ) libarch$(LIBEXT)
@ -121,8 +119,9 @@ board/libboard$(LIBEXT):
nuttx$(EXEEXT): $(HEAD_OBJ) board/libboard$(LIBEXT)
@echo "LD: nuttx"
$(Q) $(LD) --entry=__start $(LDFLAGS) $(LIBPATHS) -o $(NUTTX) $(HEAD_OBJ) $(EXTRA_OBJS) \
$(LDSTARTGROUP) $(LDLIBS) $(EXTRA_LIBS) $(LIBGCC) $(LDENDGROUP)
$(Q) $(LD) --entry=__start $(LDFLAGS) $(LIBPATHS) $(EXTRA_LIBPATHS) \
-o $(NUTTX) $(HEAD_OBJ) $(EXTRA_OBJS) \
$(LDSTARTGROUP) $(LDLIBS) $(EXTRA_LIBS) $(LDENDGROUP)
ifneq ($(CONFIG_WINDOWS_NATIVE),y)
$(Q) $(NM) $(NUTTX) | \
grep -v '\(compiled\)\|\(\$(OBJEXT)$$\)\|\( [aUw] \)\|\(\.\.ng$$\)\|\(LASH[RL]DI\)' | \

View File

@ -125,3 +125,18 @@ ifeq ($(CONFIG_AVR_TOOLCHAIN),WINAVR)
MAXOPTIMIZATION ?= -O2
LDFLAGS += -nostartfiles -nodefaultlibs
endif
# Add the builtin library
EXTRA_LIBS += -lgcc
EXTRA_LIBPATHS += -L "${dir ${shell $(CC) $(ARCHCPUFLAGS) --print-file-name=libgcc.a}}"
ifneq ($(CONFIG_LIBM),y)
EXTRA_LIBS += -lm
EXTRA_LIBPATHS += -L "${dir ${shell $(CC) $(ARCHCPUFLAGS) --print-file-name=libm.a}}"
endif
ifeq ($(CONFIG_CXX_LIBSUPCXX),y)
EXTRA_LIBS += -lsupc++
EXTRA_LIBPATHS += -L "${dir ${shell $(CC) $(ARCHCPUFLAGS) --print-file-name=libsupc++.a}}"
endif

View File

@ -50,3 +50,18 @@ CROSSDEV = avr32-
ARCHCPUFLAGS = -mpart=uc3b0256
# AVR Tools or avr32-toolchain from https://github.com/jsnyder/avr32-toolchain
# Add the builtin library
EXTRA_LIBS += -lgcc
EXTRA_LIBPATHS += -L "${dir ${shell $(CC) $(ARCHCPUFLAGS) --print-file-name=libgcc.a}}"
ifneq ($(CONFIG_LIBM),y)
EXTRA_LIBS += -lm
EXTRA_LIBPATHS += -L "${dir ${shell $(CC) $(ARCHCPUFLAGS) --print-file-name=libm.a}}"
endif
ifeq ($(CONFIG_CXX_LIBSUPCXX),y)
EXTRA_LIBS += -lsupc++
EXTRA_LIBPATHS += -L "${dir ${shell $(CC) $(ARCHCPUFLAGS) --print-file-name=libsupc++.a}}"
endif

View File

@ -100,7 +100,20 @@ ifeq ($(BOARDMAKE),y)
LDLIBS += -lboard
endif
LIBGCC = "${shell "$(CC)" $(ARCHCPUFLAGS) -print-libgcc-file-name}"
# Add the builtin library
EXTRA_LIBS += -lgcc
EXTRA_LIBPATHS += -L "${dir ${shell $(CC) $(ARCHCPUFLAGS) --print-file-name=libgcc.a}}"
ifneq ($(CONFIG_LIBM),y)
EXTRA_LIBS += -lm
EXTRA_LIBPATHS += -L "${dir ${shell $(CC) $(ARCHCPUFLAGS) --print-file-name=libm.a}}"
endif
ifeq ($(CONFIG_CXX_LIBSUPCXX),y)
EXTRA_LIBS += -lsupc++
EXTRA_LIBPATHS += -L "${dir ${shell $(CC) $(ARCHCPUFLAGS) --print-file-name=libsupc++.a}}"
endif
VPATH = chip:common:$(ARCH_SUBDIR)
@ -121,8 +134,9 @@ board/libboard$(LIBEXT):
nuttx$(EXEEXT): $(HEAD_OBJ) board/libboard$(LIBEXT)
$(Q) echo "LD: nuttx"
$(Q) $(LD) --entry=__start $(LDFLAGS) $(LIBPATHS) -o $(NUTTX) $(HEAD_OBJ) \
$(LDSTARTGROUP) $(LDLIBS) $(EXTRA_LIBS) $(LIBGCC) $(LDENDGROUP)
$(Q) $(LD) --entry=__start $(LDFLAGS) $(LIBPATHS) $(EXTRA_LIBPATHS) \
-o $(NUTTX) $(HEAD_OBJ) $(EXTRA_OBJS) \
$(LDSTARTGROUP) $(LDLIBS) $(EXTRA_LIBS) $(LDENDGROUP)
ifneq ($(CONFIG_WINDOWS_NATIVE),y)
$(Q) $(NM) $(NUTTX) | \
grep -v '\(compiled\)\|\(\$(OBJEXT)$$\)\|\( [aUw] \)\|\(\.\.ng$$\)\|\(LASH[RL]DI\)' | \

View File

@ -97,8 +97,6 @@ ifeq ($(BOARDMAKE),y)
LDLIBS += -lboard
endif
LIBGCC = "${shell "$(CC)" $(ARCHCPUFLAGS) -print-libgcc-file-name}"
VPATH = chip:common:$(ARCH_SUBDIR)
all: $(HEAD_OBJ) libarch$(LIBEXT)
@ -119,8 +117,9 @@ board/libboard$(LIBEXT):
nuttx$(EXEEXT): $(HEAD_OBJ) board/libboard$(LIBEXT)
@echo "LD: nuttx"
$(Q) $(LD) --entry=__start $(LDFLAGS) $(LIBPATHS) -o $(NUTTX) $(HEAD_OBJ) $(EXTRA_OBJS) \
$(LDSTARTGROUP) $(LDLIBS) $(EXTRA_LIBS) $(LIBGCC) $(LDENDGROUP)
$(Q) $(LD) --entry=__start $(LDFLAGS) $(LIBPATHS) $(EXTRA_LIBPATHS) \
-o $(NUTTX) $(HEAD_OBJ) $(EXTRA_OBJS) \
$(LDSTARTGROUP) $(LDLIBS) $(EXTRA_LIBS) $(LDENDGROUP)
ifneq ($(CONFIG_WINDOWS_NATIVE),y)
$(Q) $(NM) $(NUTTX) | \
grep -v '\(compiled\)\|\(\$(OBJEXT)$$\)\|\( [aUw] \)\|\(\.\.ng$$\)\|\(LASH[RL]DI\)' | \

View File

@ -258,3 +258,13 @@ ifeq ($(CONFIG_MIPS32_TOOLCHAIN),PINGUINOW)
LDFLAGS += -nostartfiles -nodefaultlibs
LDSCRIPT = mips-elf-debug.ld
endif
# Add the builtin library
EXTRA_LIBS += ${shell $(CC) $(ARCHCPUFLAGS) --print-file-name=libgcc.a}
ifneq ($(CONFIG_LIBM),y)
EXTRA_LIBS += ${shell $(CC) $(ARCHCPUFLAGS) --print-file-name=libm.a}
endif
ifeq ($(CONFIG_CXX_LIBSUPCXX),y)
EXTRA_LIBS += ${shell $(CC) $(ARCHCPUFLAGS) --print-file-name=libsupc++.a}
endif

View File

@ -101,8 +101,6 @@ ifeq ($(BOARDMAKE),y)
LDLIBS += -lboard
endif
LIBGCC = "${shell "$(CC)" $(ARCHCPUFLAGS) -print-libgcc-file-name}"
VPATH = chip:common:$(ARCH_SUBDIR)
all: $(HEAD_OBJ) libarch$(LIBEXT)
@ -122,8 +120,9 @@ board/libboard$(LIBEXT):
$(Q) $(MAKE) -C board TOPDIR="$(TOPDIR)" libboard$(LIBEXT) EXTRAFLAGS="$(EXTRAFLAGS)"
nuttx$(EXEEXT): $(HEAD_OBJ) board/libboard$(LIBEXT)
$(Q) $(LD) --entry=__start $(LDFLAGS) $(LIBPATHS) -o $(NUTTX) $(HEAD_OBJ) $(EXTRA_OBJS) \
$(LDSTARTGROUP) $(LDLIBS) $(EXTRA_LIBS) $(LIBGCC) $(LDENDGROUP)
$(Q) $(LD) --entry=__start $(LDFLAGS) $(LIBPATHS) $(EXTRA_LIBPATHS) \
-o $(NUTTX) $(HEAD_OBJ) $(EXTRA_OBJS) \
$(LDSTARTGROUP) $(LDLIBS) $(EXTRA_LIBS) $(LDENDGROUP)
ifneq ($(CONFIG_WINDOWS_NATIVE),y)
$(Q) $(NM) $(NUTTX) | \
grep -v '\(compiled\)\|\(\$(OBJEXT)$$\)\|\( [aUw] \)\|\(\.\.ng$$\)\|\(LASH[RL]DI\)' | \

View File

@ -91,3 +91,18 @@ ifeq ($(CONFIG_LM32_TOOLCHAIN),GNUL)
ARCROSSDEV ?= lm32-elf-
MAXOPTIMIZATION ?= -Os
endif
# Add the builtin library
EXTRA_LIBS += -lgcc
EXTRA_LIBPATHS += -L "${dir ${shell $(CC) $(ARCHCPUFLAGS) --print-file-name=libgcc.a}}"
ifneq ($(CONFIG_LIBM),y)
EXTRA_LIBS += -lm
EXTRA_LIBPATHS += -L "${dir ${shell $(CC) $(ARCHCPUFLAGS) --print-file-name=libm.a}}"
endif
ifeq ($(CONFIG_CXX_LIBSUPCXX),y)
EXTRA_LIBS += -lsupc++
EXTRA_LIBPATHS += -L "${dir ${shell $(CC) $(ARCHCPUFLAGS) --print-file-name=libsupc++.a}}"
endif

View File

@ -42,3 +42,18 @@ ARCHCPUFLAGS = -march=rv32i
ifeq ($(CONFIG_DEBUG_SYMBOLS),)
MAXOPTIMIZATION ?= -Os
endif
# Add the builtin library
EXTRA_LIBS += -lgcc
EXTRA_LIBPATHS += -L "${dir ${shell $(CC) $(ARCHCPUFLAGS) --print-file-name=libgcc.a}}"
ifneq ($(CONFIG_LIBM),y)
EXTRA_LIBS += -lm
EXTRA_LIBPATHS += -L "${dir ${shell $(CC) $(ARCHCPUFLAGS) --print-file-name=libm.a}}"
endif
ifeq ($(CONFIG_CXX_LIBSUPCXX),y)
EXTRA_LIBS += -lsupc++
EXTRA_LIBPATHS += -L "${dir ${shell $(CC) $(ARCHCPUFLAGS) --print-file-name=libsupc++.a}}"
endif

View File

@ -118,9 +118,6 @@ ifeq ($(BOARDMAKE),y)
LDLIBS += -lboard
endif
LIBGCC = "${shell "$(CC)" $(ARCHCPUFLAGS) -print-libgcc-file-name}"
GCC_LIBDIR := ${shell dirname $(LIBGCC)}
VPATH += chip
VPATH += common
VPATH += $(ARCH_SUBDIR)
@ -161,7 +158,7 @@ nuttx$(EXEEXT): $(HEAD_OBJ) board$(DELIM)libboard$(LIBEXT)
$(Q) echo "LD: nuttx"
$(Q) $(LD) --entry=0x100 $(LDFLAGS) $(LIBPATHS) $(EXTRA_LIBPATHS) \
-o $(NUTTX) $(HEAD_OBJ) $(EXTRA_OBJS) \
$(LDSTARTGROUP) $(LDLIBS) $(EXTRA_LIBS) $(LIBGCC) $(LDENDGROUP)
$(LDSTARTGROUP) $(LDLIBS) $(EXTRA_LIBS) $(LDENDGROUP)
ifneq ($(CONFIG_WINDOWS_NATIVE),y)
$(Q) $(NM) $(NUTTX) | \
grep -v '\(compiled\)\|\(\$(OBJEXT)$$\)\|\( [aUw] \)\|\(\.\.ng$$\)\|\(LASH[RL]DI\)' | \

View File

@ -69,3 +69,18 @@ ARCHPICFLAGS = -fpic -membedded-pic
LDFLAGS += -nostartfiles -nodefaultlibs
LDSCRIPT = or1k-elf-debug.ld
#endif
# Add the builtin library
EXTRA_LIBS += -lgcc
EXTRA_LIBPATHS += -L "${dir ${shell $(CC) $(ARCHCPUFLAGS) --print-file-name=libgcc.a}}"
ifneq ($(CONFIG_LIBM),y)
EXTRA_LIBS += -lm
EXTRA_LIBPATHS += -L "${dir ${shell $(CC) $(ARCHCPUFLAGS) --print-file-name=libm.a}}"
endif
ifeq ($(CONFIG_CXX_LIBSUPCXX),y)
EXTRA_LIBS += -lsupc++
EXTRA_LIBPATHS += -L "${dir ${shell $(CC) $(ARCHCPUFLAGS) --print-file-name=libsupc++.a}}"
endif

View File

@ -93,7 +93,20 @@ ifeq ($(BOARDMAKE),y)
LDLIBS += -lboard
endif
LIBGCC = ${shell "$(CC)" $(ARCHCPUFLAGS) -print-libgcc-file-name}
# Add the builtin library
EXTRA_LIBS += -lgcc
EXTRA_LIBPATHS += -L "${dir ${shell $(CC) $(ARCHCPUFLAGS) --print-file-name=libgcc.a}}"
ifneq ($(CONFIG_LIBM),y)
EXTRA_LIBS += -lm
EXTRA_LIBPATHS += -L "${dir ${shell $(CC) $(ARCHCPUFLAGS) --print-file-name=libm.a}}"
endif
ifeq ($(CONFIG_CXX_LIBSUPCXX),y)
EXTRA_LIBS += -lsupc++
EXTRA_LIBPATHS += -L "${dir ${shell $(CC) $(ARCHCPUFLAGS) --print-file-name=libsupc++.a}}"
endif
VPATH = chip:common
@ -115,8 +128,9 @@ board/libboard$(LIBEXT):
nuttx$(EXEEXT): $(HEAD_OBJ) board/libboard$(LIBEXT)
@echo "LD: nuttx"
$(Q) $(LD) --entry=__start $(LDFLAGS) $(LIBPATHS) -o $(NUTTX) $(HEAD_OBJ) \
$(LDSTARTGROUP) $(LDLIBS) $(EXTRA_LIBS) $(LIBGCC) $(LDENDGROUP)
$(Q) $(LD) --entry=__start $(LDFLAGS) $(LIBPATHS) $(EXTRA_LIBPATHS) \
-o $(NUTTX) $(HEAD_OBJ) $(EXTRA_OBJS) \
$(LDSTARTGROUP) $(LDLIBS) $(EXTRA_LIBS) $(LDENDGROUP)
ifneq ($(CONFIG_WINDOWS_NATIVE),y)
$(Q) $(NM) $(NUTTX) | \
grep -v '\(compiled\)\|\(\$(OBJEXT)$$\)\|\( [aUw] \)\|\(\.\.ng$$\)\|\(LASH[RL]DI\)' | \

View File

@ -122,9 +122,6 @@ ifeq ($(BOARDMAKE),y)
LDLIBS += -lboard
endif
LIBGCC = "${shell "$(CC)" $(ARCHCPUFLAGS) -print-libgcc-file-name}"
GCC_LIBDIR := ${shell dirname $(LIBGCC)}
VPATH += chip
VPATH += common
VPATH += $(ARCH_SUBDIR)
@ -158,7 +155,7 @@ nuttx$(EXEEXT): $(HEAD_OBJ) board/libboard$(LIBEXT)
$(Q) echo "LD: nuttx"
$(Q) $(LD) --entry=__start $(LDFLAGS) $(LIBPATHS) $(EXTRA_LIBPATHS) \
-o $(NUTTX) $(HEAD_OBJ) $(EXTRA_OBJS) \
$(LDSTARTGROUP) $(LDLIBS) $(EXTRA_LIBS) $(LIBGCC) $(LDENDGROUP)
$(LDSTARTGROUP) $(LDLIBS) $(EXTRA_LIBS) $(LDENDGROUP)
ifneq ($(CONFIG_WINDOWS_NATIVE),y)
$(Q) $(NM) $(NUTTX) | \
grep -v '\(compiled\)\|\(\$(OBJEXT)$$\)\|\( [aUw] \)\|\(\.\.ng$$\)\|\(LASH[RL]DI\)' | \

View File

@ -103,3 +103,18 @@ endif
ifeq ($(CONFIG_DEBUG_SYMBOLS),)
MAXOPTIMIZATION ?= -Os
endif
# Add the builtin library
EXTRA_LIBS += -lgcc
EXTRA_LIBPATHS += -L "${dir ${shell $(CC) $(ARCHCPUFLAGS) --print-file-name=libgcc.a}}"
ifneq ($(CONFIG_LIBM),y)
EXTRA_LIBS += -lm
EXTRA_LIBPATHS += -L "${dir ${shell $(CC) $(ARCHCPUFLAGS) --print-file-name=libm.a}}"
endif
ifeq ($(CONFIG_CXX_LIBSUPCXX),y)
EXTRA_LIBS += -lsupc++
EXTRA_LIBPATHS += -L "${dir ${shell $(CC) $(ARCHCPUFLAGS) --print-file-name=libsupc++.a}}"
endif

View File

@ -83,3 +83,18 @@ endif
ifeq ($(CONFIG_DEBUG_SYMBOLS),)
MAXOPTIMIZATION ?= -Os
endif
# Add the builtin library
EXTRA_LIBS += -lgcc
EXTRA_LIBPATHS += -L "${dir ${shell $(CC) $(ARCHCPUFLAGS) --print-file-name=libgcc.a}}"
ifneq ($(CONFIG_LIBM),y)
EXTRA_LIBS += -lm
EXTRA_LIBPATHS += -L "${dir ${shell $(CC) $(ARCHCPUFLAGS) --print-file-name=libm.a}}"
endif
ifeq ($(CONFIG_CXX_LIBSUPCXX),y)
EXTRA_LIBS += -lsupc++
EXTRA_LIBPATHS += -L "${dir ${shell $(CC) $(ARCHCPUFLAGS) --print-file-name=libsupc++.a}}"
endif

View File

@ -97,14 +97,19 @@ ifeq ($(BOARDMAKE),y)
LDLIBS += -lboard
endif
LIBGCC = "${shell "$(CC)" $(ARCHCPUFLAGS) -print-libgcc-file-name}"
# Add the builtin library
ifeq ($(HOSTOS),FreeBSD)
HOST_ARCH = ${shell uname -m 2>/dev/null || echo "Other"}
ifeq ($(HOST_ARCH),amd64)
LDFLAGS += -melf_i386
LIBGCC = "/usr/lib32/libgcc.a"
endif
EXTRA_LIBS += -lgcc
EXTRA_LIBPATHS += -L "${dir ${shell $(CC) $(ARCHCPUFLAGS) --print-file-name=libgcc.a}}"
ifneq ($(CONFIG_LIBM),y)
EXTRA_LIBS += -lm
EXTRA_LIBPATHS += -L "${dir ${shell $(CC) $(ARCHCPUFLAGS) --print-file-name=libm.a}}"
endif
ifeq ($(CONFIG_CXX_LIBSUPCXX),y)
EXTRA_LIBS += -lsupc++
EXTRA_LIBPATHS += -L "${dir ${shell $(CC) $(ARCHCPUFLAGS) --print-file-name=libsupc++.a}}"
endif
VPATH = chip:common:$(ARCH_SUBDIR)
@ -127,8 +132,9 @@ board/libboard$(LIBEXT):
nuttx$(EXEEXT): $(HEAD_OBJ) board/libboard$(LIBEXT)
@echo "LD: nuttx$(EXEEXT)"
$(Q) $(LD) --entry=__start $(LDFLAGS) $(LIBPATHS) -o $(NUTTX) $(HEAD_OBJ) $(EXTRA_OBJS) \
$(LDSTARTGROUP) $(LDLIBS) $(EXTRA_LIBS) $(LIBGCC) $(LDENDGROUP)
$(Q) $(LD) --entry=__start $(LDFLAGS) $(LIBPATHS) $(EXTRA_LIBPATHS) \
-o $(NUTTX) $(HEAD_OBJ) $(EXTRA_OBJS) \
$(LDSTARTGROUP) $(LDLIBS) $(EXTRA_LIBS) $(LDENDGROUP)
ifneq ($(CONFIG_WINDOWS_NATIVE),y)
$(Q) $(NM) $(NUTTX) | \
grep -v '\(compiled\)\|\(\$(OBJEXT)$$\)\|\( [aUw] \)\|\(\.\.ng$$\)\|\(LASH[RL]DI\)' | \

View File

@ -84,10 +84,19 @@ ifeq ($(BOARDMAKE),y)
LDLIBS += -lboard
endif
LIBGCC = "${shell "$(CC)" $(ARCHCPUFLAGS) -print-libgcc-file-name}"
# Add the builtin library
ifeq ($(HOSTOS),FreeBSD)
HOST_ARCH = ${shell uname -m 2>/dev/null || echo "Other"}
EXTRA_LIBS += -lgcc
EXTRA_LIBPATHS += -L "${dir ${shell $(CC) $(ARCHCPUFLAGS) --print-file-name=libgcc.a}}"
ifneq ($(CONFIG_LIBM),y)
EXTRA_LIBS += -lm
EXTRA_LIBPATHS += -L "${dir ${shell $(CC) $(ARCHCPUFLAGS) --print-file-name=libm.a}}"
endif
ifeq ($(CONFIG_CXX_LIBSUPCXX),y)
EXTRA_LIBS += -lsupc++
EXTRA_LIBPATHS += -L "${dir ${shell $(CC) $(ARCHCPUFLAGS) --print-file-name=libsupc++.a}}"
endif
VPATH = chip:common:$(ARCH_SUBDIR)
@ -118,8 +127,9 @@ board/libboard$(LIBEXT):
nuttx$(EXEEXT): board/libboard$(LIBEXT)
@echo "LD: nuttx$(EXEEXT)"
$(Q) $(LD) $(LDFLAGS) $(LIBPATHS) -o $(NUTTX) $(EXTRA_OBJS) \
$(LDSTARTGROUP) $(LIBGCC) --whole-archive --no-relax $(LDLIBS) $(EXTRA_LIBS) $(LDENDGROUP)
$(Q) $(LD) $(LDFLAGS) $(LIBPATHS) $(EXTRA_LIBPATHS) \
-o $(NUTTX) $(EXTRA_OBJS) \
$(LDSTARTGROUP) $(EXTRA_LIBS) --whole-archive --no-relax $(LDLIBS) $(LDENDGROUP)
ifneq ($(CONFIG_WINDOWS_NATIVE),y)
$(Q) $(NM) $(NUTTX) | \
grep -v '\(compiled\)\|\(\$(OBJEXT)$$\)\|\( [aUw] \)\|\(\.\.ng$$\)\|\(LASH[RL]DI\)' | \

View File

@ -98,8 +98,6 @@ ifeq ($(BOARDMAKE),y)
LDLIBS += -lboard
endif
LIBGCC = "${shell "$(CC)" $(ARCHCPUFLAGS) -print-libgcc-file-name}"
VPATH = chip:common:$(ARCH_SUBDIR)
all: $(STARTUP_OBJS) libarch$(LIBEXT)
@ -120,8 +118,9 @@ board/libboard$(LIBEXT):
nuttx$(EXEEXT): $(STARTUP_OBJS) board/libboard$(LIBEXT)
@echo "LD: nuttx"
$(Q) $(LD) --entry=__start $(LDFLAGS) $(LIBPATHS) -o $(NUTTX) $(STARTUP_OBJS) $(EXTRA_OBJS) \
$(LDSTARTGROUP) $(LDLIBS) $(EXTRA_LIBS) $(LIBGCC) $(LDENDGROUP)
$(Q) $(LD) --entry=__start $(LDFLAGS) $(LIBPATHS) $(EXTRA_LIBPATHS) \
-o $(NUTTX) $(STARTUP_OBJS) $(EXTRA_OBJS) \
$(LDSTARTGROUP) $(LDLIBS) $(EXTRA_LIBS) $(LDENDGROUP)
ifneq ($(CONFIG_WINDOWS_NATIVE),y)
$(Q) $(NM) $(NUTTX) | \
grep -v '\(compiled\)\|\(\$(OBJEXT)$$\)\|\( [aUw] \)\|\(\.\.ng$$\)\|\(LASH[RL]DI\)' | \

View File

@ -57,3 +57,18 @@ ifeq ($(CONFIG_DEBUG_CUSTOMOPT),y)
else
MAXOPTIMIZATION := -Os
endif
# Add the builtin library
EXTRA_LIBS += -lgcc
EXTRA_LIBPATHS += -L "${dir ${shell $(CC) $(ARCHCPUFLAGS) --print-file-name=libgcc.a}}"
ifneq ($(CONFIG_LIBM),y)
EXTRA_LIBS += -lm
EXTRA_LIBPATHS += -L "${dir ${shell $(CC) $(ARCHCPUFLAGS) --print-file-name=libm.a}}"
endif
ifeq ($(CONFIG_CXX_LIBSUPCXX),y)
EXTRA_LIBS += -lsupc++
EXTRA_LIBPATHS += -L "${dir ${shell $(CC) $(ARCHCPUFLAGS) --print-file-name=libsupc++.a}}"
endif

View File

@ -74,10 +74,6 @@ BOARDDIR = $(TOPDIR)/arch/$(CONFIG_ARCH)/src/board
VPATH = chip:common:board
# Libraries
LIBGCC = ${shell "$(CC)" $(ARCHCPUFLAGS) -print-libgcc-file-name}
# Targets
all: $(HEAD_OBJ) libarch$(LIBEXT)

View File

@ -74,10 +74,6 @@ BOARDDIR = $(TOPDIR)\arch\$(CONFIG_ARCH)\src\board
VPATH = chip:common:board
# Libraries
LIBGCC = ${shell "$(CC)" $(ARCHCPUFLAGS) -print-libgcc-file-name}
# Targets
all: $(HEAD_OBJ) libarch$(LIBEXT)

View File

@ -54,10 +54,6 @@ else
LDSCRIPT = flash-ocram.ld
endif
LIBSUPXX = ${shell $(CC) $(CXXFLAGS) --print-file-name=libsupc++.a}
EXTRA_LIBPATHS = -L "${shell dirname "$(LIBSUPXX)"}"
EXTRA_LIBS = -lsupc++
ifeq ($(CONFIG_CYGWIN_WINTOOL),y)
ARCHSCRIPT = -T "${shell cygpath -w $(BOARD_DIR)$(DELIM)scripts$(DELIM)$(LDSCRIPT)}"
else

View File

@ -54,10 +54,6 @@ else
LDSCRIPT = flash-ocram.ld
endif
LIBSUPXX = ${shell $(CC) $(CXXFLAGS) --print-file-name=libsupc++.a}
EXTRA_LIBPATHS = -L "${shell dirname "$(LIBSUPXX)"}"
EXTRA_LIBS = -lsupc++
ifeq ($(CONFIG_CYGWIN_WINTOOL),y)
ARCHSCRIPT = -T "${shell cygpath -w $(BOARD_DIR)$(DELIM)scripts$(DELIM)$(LDSCRIPT)}"
else

View File

@ -135,5 +135,5 @@ endif
# NEVER use 'override' variables
# NUTTX_EXTRA_LIBS and NUTTX_EXTRA_LIBPATHS are defined by out-of-repository
EXTRA_LIBS := $(NUTTX_EXTRA_LIBS) $(ARCH_LIBS)
EXTRA_LIBPATHS := $(NUTTX_EXTRA_LIBPATHS) $(ARCH_LIBPATHS)
EXTRA_LIBS += $(NUTTX_EXTRA_LIBS) $(ARCH_LIBS)
EXTRA_LIBPATHS += $(NUTTX_EXTRA_LIBPATHS) $(ARCH_LIBPATHS)

View File

@ -33,10 +33,6 @@ OBJCOPY = $(CROSSDEV)objcopy
OBJDUMP = $(CROSSDEV)objdump
LDSCRIPT = ld.script
LIBSUPXX = ${shell $(CC) $(CXXFLAGS) --print-file-name=libsupc++.a}
EXTRA_LIBPATHS = -L "${shell dirname "$(LIBSUPXX)"}"
EXTRA_LIBS = -lsupc++
ifeq ($(CONFIG_CYGWIN_WINTOOL),y)
ARCHSCRIPT = -T "${shell cygpath -w $(BOARD_DIR)$(DELIM)scripts$(DELIM)$(LDSCRIPT)}"
else

View File

@ -49,10 +49,6 @@ OBJCOPY = $(CROSSDEV)objcopy
OBJDUMP = $(CROSSDEV)objdump
LDSCRIPT = ld.script
LIBSUPXX = ${shell $(CC) $(CXXFLAGS) --print-file-name=libsupc++.a}
EXTRA_LIBPATHS = -L "${shell dirname "$(LIBSUPXX)"}"
EXTRA_LIBS = -lsupc++
ifeq ($(CONFIG_CYGWIN_WINTOOL),y)
ARCHSCRIPT = -T "${shell cygpath -w \
$(BOARD_DIR)$(DELIM)scripts$(DELIM)$(LDSCRIPT)}"

View File

@ -68,12 +68,6 @@ ifeq ($(CONFIG_LIBCXX),y)
ifneq ($(CONFIG_CXX_EXCEPTION),y)
CXXFLAGS += -fno-exceptions -fno-rtti -fcheck-new -D_LIBCPP_NO_EXCEPTIONS
endif
# supc++ is always needed with libcxx
LIBSUPXX = ${shell $(CC) $(CFLAGS) --print-file-name=libsupc++.a}
EXTRA_LIBPATHS = -L "${shell dirname "$(LIBSUPXX)"}"
EXTRA_LIBS = -lsupc++
endif
NXFLATLDFLAGS1 = -r -d -warn-common

View File

@ -127,10 +127,6 @@ LDLINKFLAGS = $(ARCHSCRIPT) # Link flags used with $(LD)
CCLINKFLAGS = $(ARCHSCRIPT) # Link flags used with $(CC)
LDFLAGS = $(ARCHSCRIPT) # For backward compatibility, same as CCLINKFLAGS
LIBSUPXX = ${shell $(CC) $(CXXFLAGS) --print-file-name=libsupc++.a}
EXTRA_LIBPATHS = -L "${shell dirname "$(LIBSUPXX)"}"
EXTRA_LIBS = -lsupc++
ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
CCLINKFLAGS += -g
endif

View File

@ -282,7 +282,6 @@ if [ "X${USRONLY}" != "Xy" ]; then
echo "LDENDGROUP = ${LDENDGROUP}" >>"${EXPORTDIR}/scripts/Make.defs"
echo "LDFLAGS = ${LDFLAGS}" >>"${EXPORTDIR}/scripts/Make.defs"
echo "LDSTARTGROUP = ${LDSTARTGROUP}" >>"${EXPORTDIR}/scripts/Make.defs"
echo "LIBGCC = ${LIBGCC}" >>"${EXPORTDIR}/scripts/Make.defs"
fi
# Copy the system map file(s)