[Buildroot] [PATCH 3/9] Add support for multilib external toolchains

Grant Likely grant.likely at secretlab.ca
Thu Oct 16 20:32:30 UTC 2008


From: Grant Likely <grant.likely at secretlab.ca>

Fix buildroot to work with external toolchains using multilib.  Multilib
toolchains have several sets of libraries which they can choose between
depending on the optimization flags.  For example, a single toolchain
could have libraries compiled for both hard and soft floating point.
However, buildroot needs copy the correct version of the libraries to
match the flags used to compile the applications.

This patch adds the CPU optimization flags to the execution of GCC when
determining the location of the libraries to copy.  Passing the
optimization flags makes the library linking and copying consistent.

Tested using CodeSourcery PowerPC toolchain on a Xilinx Virtex5 ppc440
platform.
---

 toolchain/external-toolchain/ext-tool.mk |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)


diff --git a/toolchain/external-toolchain/ext-tool.mk b/toolchain/external-toolchain/ext-tool.mk
index bbf430c..ba10dc7 100644
--- a/toolchain/external-toolchain/ext-tool.mk
+++ b/toolchain/external-toolchain/ext-tool.mk
@@ -10,7 +10,8 @@ copy_toolchain_lib_root = \
 	DST="$(strip $2)"; \
 	STRIP="$(strip $3)"; \
  \
-	LIB_DIR=`$(TARGET_CC) -print-file-name=$${LIB} | sed -e "s,/$${LIB}\$$,,"`; \
+	LIB_DIR=`$(TARGET_CC) $(subst ",,$(BR2_TARGET_OPTIMIZATION)) -print-file-name=$${LIB} | sed -e "s,/$${LIB}\$$,,"`; \
+	MULTILIB=`$(TARGET_CC) $(subst ",,$(BR2_TARGET_OPTIMIZATION)) -print-multi-directory`; \
  \
 	if test -z "$${LIB_DIR}"; then \
 		echo "copy_toolchain_lib_root: lib=$${LIB} not found"; \
@@ -21,7 +22,7 @@ copy_toolchain_lib_root = \
 	for FILE in `find $${LIB_DIR} -maxdepth 1 -type l -name "$${LIB}*"`; do \
 		LIB=`basename $${FILE}`; \
 		while test \! -z "$${LIB}"; do \
-			echo "copy_toolchain_lib_root lib=$${LIB} dst=$${DST}"; \
+			echo "copy_toolchain_lib_root multilib=$${MULTILIB} lib=$${LIB} dst=$${DST}"; \
 			rm -fr $(TARGET_DIR)$${DST}/$${LIB}; \
 			mkdir -p $(TARGET_DIR)$${DST}; \
 			if test -h $${LIB_DIR}/$${LIB}; then \




More information about the buildroot mailing list