summaryrefslogtreecommitdiffstats
path: root/toolchain/toolchain-external/ext-tool.mk
diff options
context:
space:
mode:
Diffstat (limited to 'toolchain/toolchain-external/ext-tool.mk')
-rw-r--r--toolchain/toolchain-external/ext-tool.mk23
1 files changed, 20 insertions, 3 deletions
diff --git a/toolchain/toolchain-external/ext-tool.mk b/toolchain/toolchain-external/ext-tool.mk
index a45603a43..2a01d6852 100644
--- a/toolchain/toolchain-external/ext-tool.mk
+++ b/toolchain/toolchain-external/ext-tool.mk
@@ -359,6 +359,17 @@ $(STAMP_DIR)/ext-toolchain-checked: $(TOOLCHAIN_EXTERNAL_DEPENDENCIES)
# ARCH_SUBDIR: the relative location of the sysroot of the selected
# multilib variant compared to the main sysroot.
# Ex: mips16/soft-float/el
+#
+# SUPPORT_LIB_DIR: some toolchains, such as recent Linaro toolchains,
+# store GCC support libraries (libstdc++,
+# libgcc_s, etc.) outside of the sysroot. In
+# this case, SUPPORT_LIB_DIR is set to a
+# non-empty value, and points to the directory
+# where these support libraries are
+# available. Those libraries will be copied to
+# our sysroot, and the directory will also be
+# considered when searching libraries for copy
+# to the target filesystem.
$(STAMP_DIR)/ext-toolchain-installed: $(STAMP_DIR)/ext-toolchain-checked
$(Q)LIBC_A_LOCATION=`readlink -f $$(LANG=C $(TOOLCHAIN_EXTERNAL_CC) -print-file-name=libc.a)` ; \
@@ -370,19 +381,25 @@ $(STAMP_DIR)/ext-toolchain-installed: $(STAMP_DIR)/ext-toolchain-checked
ARCH_LIBC_A_LOCATION=`readlink -f $$(LANG=C $(TOOLCHAIN_EXTERNAL_CC) $(TOOLCHAIN_EXTERNAL_CFLAGS) -print-file-name=libc.a)` ; \
ARCH_SYSROOT_DIR=`echo $${ARCH_LIBC_A_LOCATION} | sed -r -e 's:usr/lib(64)?/(.*/)?libc\.a::'` ; \
ARCH_LIB_DIR=`echo $${ARCH_LIBC_A_LOCATION} | sed -r -e 's:.*/usr/(lib(64)?)/(.*/)?libc.a:\1:'` ; \
+ if test `find $${ARCH_SYSROOT_DIR} -name 'libstdc++.a' | wc -l` -eq 0 ; then \
+ LIBSTDCPP_A_LOCATION=`readlink -f $$(LANG=C $(TOOLCHAIN_EXTERNAL_CC) $(TOOLCHAIN_EXTERNAL_CFLAGS) -print-file-name=libstdc++.a)` ; \
+ SUPPORT_LIB_DIR=`echo $${LIBSTDCPP_A_LOCATION} | sed -r -e 's:libstdc\+\+\.a::'` ; \
+ else \
+ SUPPORT_LIB_DIR="" ; \
+ fi ; \
ARCH_SUBDIR=`echo $${ARCH_SYSROOT_DIR} | sed -r -e "s:^$${SYSROOT_DIR}(.*)/$$:\1:"` ; \
mkdir -p $(TARGET_DIR)/lib ; \
if test -z "$(BR2_PREFER_STATIC_LIB)" ; then \
echo "Copy external toolchain libraries to target..." ; \
for libs in $(LIB_EXTERNAL_LIBS); do \
- $(call copy_toolchain_lib_root,$${ARCH_SYSROOT_DIR},$${ARCH_LIB_DIR},$$libs,/lib); \
+ $(call copy_toolchain_lib_root,$${ARCH_SYSROOT_DIR},$${SUPPORT_LIB_DIR},$${ARCH_LIB_DIR},$$libs,/lib); \
done ; \
for libs in $(USR_LIB_EXTERNAL_LIBS); do \
- $(call copy_toolchain_lib_root,$${ARCH_SYSROOT_DIR},$${ARCH_LIB_DIR},$$libs,/usr/lib); \
+ $(call copy_toolchain_lib_root,$${ARCH_SYSROOT_DIR},$${SUPPORT_LIB_DIR},$${ARCH_LIB_DIR},$$libs,/usr/lib); \
done ; \
fi ; \
echo "Copy external toolchain sysroot to staging..." ; \
- $(call copy_toolchain_sysroot,$${SYSROOT_DIR},$${ARCH_SYSROOT_DIR},$${ARCH_SUBDIR},$${ARCH_LIB_DIR}) ; \
+ $(call copy_toolchain_sysroot,$${SYSROOT_DIR},$${ARCH_SYSROOT_DIR},$${ARCH_SUBDIR},$${ARCH_LIB_DIR},$${SUPPORT_LIB_DIR}) ; \
if [ -L $${ARCH_SYSROOT_DIR}/lib64 ] ; then \
$(call create_lib64_symlinks) ; \
fi ; \