From: Mao Han <han_mao@c-sky.com> To: buildroot@buildroot.org Cc: linux-csky@vger.kernel.org, Mao Han <han_mao@c-sky.com>, Qu Xianmiao <xianmiao_qu@c-sky.com>, Chen Hongdeng <hongdeng_chen@c-sky.com>, Guo Ren <ren_guo@c-sky.com>, Thomas Petazzoni <thomas.petazzoni@bootlin.com>, Mark Corbin <mark.corbin@embecosm.com> Subject: [PATCH 2/2] toolchain: Get ld.so name if available Date: Thu, 2 Jan 2020 11:57:21 +0800 [thread overview] Message-ID: <1577937441-18703-2-git-send-email-han_mao@c-sky.com> (raw) In-Reply-To: <1577937441-18703-1-git-send-email-han_mao@c-sky.com> RISC-V multilib toolchain(github.com/riscv/riscv-gnu-toolchain.git) put multi ld.so with different ABI under sysroot/lib: sysroot/lib/ld-linux-riscv32-ilp32d.so.1 sysroot/lib/ld-linux-riscv32-ilp32.so.1 sysroot/lib/ld-linux-riscv64-lp64d.so.1 sysroot/lib/ld-linux-riscv64-lp64.so.1 Current buildroot script can't handle multi ld.so and report: >>> toolchain-external-custom Copying external toolchain sysroot to staging... /bin/bash: line 0: [: too many arguments This patch try to get the exact name for ld.so and avoid multi ld.so check in the script. Signed-off-by: Qu Xianmiao <xianmiao_qu@c-sky.com> Signed-off-by: Chen Hongdeng <hongdeng_chen@c-sky.com> Signed-off-by: Guo Ren<ren_guo@c-sky.com> Signed-off-by: Mao Han <han_mao@c-sky.com> Cc: Thomas Petazzoni <thomas.petazzoni@bootlin.com> Cc: Mark Corbin <mark.corbin@embecosm.com> --- toolchain/helpers.mk | 10 ++++++++-- toolchain/toolchain-external/pkg-toolchain-external.mk | 3 ++- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/toolchain/helpers.mk b/toolchain/helpers.mk index 03355f5..cc581fc 100644 --- a/toolchain/helpers.mk +++ b/toolchain/helpers.mk @@ -104,6 +104,7 @@ copy_toolchain_sysroot = \ ARCH_SUBDIR="$(strip $3)"; \ ARCH_LIB_DIR="$(strip $4)" ; \ SUPPORT_LIB_DIR="$(strip $5)" ; \ + SPECIFIC_LD_NAME="$(strip $6)" ; \ for i in etc $${ARCH_LIB_DIR} sbin usr usr/$${ARCH_LIB_DIR}; do \ if [ ! -d $${ARCH_SYSROOT_DIR}/$$i ] ; then \ continue ; \ @@ -136,8 +137,13 @@ copy_toolchain_sysroot = \ done ; \ fi ; \ if [ ! -e $(STAGING_DIR)/lib/ld*.so.* ]; then \ - if [ -e $${ARCH_SYSROOT_DIR}/lib/ld*.so.* ]; then \ - cp -a $${ARCH_SYSROOT_DIR}/lib/ld*.so.* $(STAGING_DIR)/lib/ ; \ + if [ "$${SPECIFIC_LD_NAME}" != "" ]; then \ + LD_NAME=$${SPECIFIC_LD_NAME}; \ + else \ + LD_NAME="ld*.so.*"; \ + fi; \ + if [ -e $${ARCH_SYSROOT_DIR}/lib/$${LD_NAME} ]; then \ + cp -a $${ARCH_SYSROOT_DIR}/lib/$${LD_NAME} $(STAGING_DIR)/lib/ ; \ fi ; \ fi ; \ if [ `readlink -f $${SYSROOT_DIR}` != `readlink -f $${ARCH_SYSROOT_DIR}` ] ; then \ diff --git a/toolchain/toolchain-external/pkg-toolchain-external.mk b/toolchain/toolchain-external/pkg-toolchain-external.mk index 13b2468..19cf7d6 100644 --- a/toolchain/toolchain-external/pkg-toolchain-external.mk +++ b/toolchain/toolchain-external/pkg-toolchain-external.mk @@ -425,6 +425,7 @@ define TOOLCHAIN_EXTERNAL_INSTALL_SYSROOT_LIBS $(Q)SYSROOT_DIR="$(call toolchain_find_sysroot,$(TOOLCHAIN_EXTERNAL_CC))" ; \ ARCH_SYSROOT_DIR="$(call toolchain_find_sysroot,$(TOOLCHAIN_EXTERNAL_CC) $(TOOLCHAIN_EXTERNAL_CFLAGS))" ; \ ARCH_LIB_DIR="$(call toolchain_find_libdir,$(TOOLCHAIN_EXTERNAL_CC) $(TOOLCHAIN_EXTERNAL_CFLAGS))" ; \ + SPECIFIC_LD_NAME=`$(TOOLCHAIN_EXTERNAL_READELF) -d $${ARCH_SYSROOT_DIR}$${ARCH_LIB_DIR}/libc*.so|grep ld|grep so|awk '{print $$NF}'|sed "s/\[//g"|sed "s/\]//g"`;\ SUPPORT_LIB_DIR="" ; \ if test `find $${ARCH_SYSROOT_DIR} -name 'libstdc++.a' | wc -l` -eq 0 ; then \ LIBSTDCPP_A_LOCATION=$$(LANG=C $(TOOLCHAIN_EXTERNAL_CC) $(TOOLCHAIN_EXTERNAL_CFLAGS) -print-file-name=libstdc++.a) ; \ @@ -441,7 +442,7 @@ define TOOLCHAIN_EXTERNAL_INSTALL_SYSROOT_LIBS ARCH_SUBDIR=`echo $${ARCH_SYSROOT_DIR} | sed -r -e "s:^$${SYSROOT_DIR}(.*)/$$:\1:"` ; \ fi ; \ $(call MESSAGE,"Copying external toolchain sysroot to staging...") ; \ - $(call copy_toolchain_sysroot,$${SYSROOT_DIR},$${ARCH_SYSROOT_DIR},$${ARCH_SUBDIR},$${ARCH_LIB_DIR},$${SUPPORT_LIB_DIR}) + $(call copy_toolchain_sysroot,$${SYSROOT_DIR},$${ARCH_SYSROOT_DIR},$${ARCH_SUBDIR},$${ARCH_LIB_DIR},$${SUPPORT_LIB_DIR},$${SPECIFIC_LD_NAME}) endef # Create a symlink from (usr/)$(ARCH_LIB_DIR) to lib. -- 2.7.4
WARNING: multiple messages have this Message-ID (diff)
From: Mao Han <han_mao@c-sky.com> To: buildroot@busybox.net Subject: [Buildroot] [PATCH 2/2] toolchain: Get ld.so name if available Date: Thu, 2 Jan 2020 11:57:21 +0800 [thread overview] Message-ID: <1577937441-18703-2-git-send-email-han_mao@c-sky.com> (raw) In-Reply-To: <1577937441-18703-1-git-send-email-han_mao@c-sky.com> RISC-V multilib toolchain(github.com/riscv/riscv-gnu-toolchain.git) put multi ld.so with different ABI under sysroot/lib: sysroot/lib/ld-linux-riscv32-ilp32d.so.1 sysroot/lib/ld-linux-riscv32-ilp32.so.1 sysroot/lib/ld-linux-riscv64-lp64d.so.1 sysroot/lib/ld-linux-riscv64-lp64.so.1 Current buildroot script can't handle multi ld.so and report: >>> toolchain-external-custom Copying external toolchain sysroot to staging... /bin/bash: line 0: [: too many arguments This patch try to get the exact name for ld.so and avoid multi ld.so check in the script. Signed-off-by: Qu Xianmiao <xianmiao_qu@c-sky.com> Signed-off-by: Chen Hongdeng <hongdeng_chen@c-sky.com> Signed-off-by: Guo Ren<ren_guo@c-sky.com> Signed-off-by: Mao Han <han_mao@c-sky.com> Cc: Thomas Petazzoni <thomas.petazzoni@bootlin.com> Cc: Mark Corbin <mark.corbin@embecosm.com> --- toolchain/helpers.mk | 10 ++++++++-- toolchain/toolchain-external/pkg-toolchain-external.mk | 3 ++- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/toolchain/helpers.mk b/toolchain/helpers.mk index 03355f5..cc581fc 100644 --- a/toolchain/helpers.mk +++ b/toolchain/helpers.mk @@ -104,6 +104,7 @@ copy_toolchain_sysroot = \ ARCH_SUBDIR="$(strip $3)"; \ ARCH_LIB_DIR="$(strip $4)" ; \ SUPPORT_LIB_DIR="$(strip $5)" ; \ + SPECIFIC_LD_NAME="$(strip $6)" ; \ for i in etc $${ARCH_LIB_DIR} sbin usr usr/$${ARCH_LIB_DIR}; do \ if [ ! -d $${ARCH_SYSROOT_DIR}/$$i ] ; then \ continue ; \ @@ -136,8 +137,13 @@ copy_toolchain_sysroot = \ done ; \ fi ; \ if [ ! -e $(STAGING_DIR)/lib/ld*.so.* ]; then \ - if [ -e $${ARCH_SYSROOT_DIR}/lib/ld*.so.* ]; then \ - cp -a $${ARCH_SYSROOT_DIR}/lib/ld*.so.* $(STAGING_DIR)/lib/ ; \ + if [ "$${SPECIFIC_LD_NAME}" != "" ]; then \ + LD_NAME=$${SPECIFIC_LD_NAME}; \ + else \ + LD_NAME="ld*.so.*"; \ + fi; \ + if [ -e $${ARCH_SYSROOT_DIR}/lib/$${LD_NAME} ]; then \ + cp -a $${ARCH_SYSROOT_DIR}/lib/$${LD_NAME} $(STAGING_DIR)/lib/ ; \ fi ; \ fi ; \ if [ `readlink -f $${SYSROOT_DIR}` != `readlink -f $${ARCH_SYSROOT_DIR}` ] ; then \ diff --git a/toolchain/toolchain-external/pkg-toolchain-external.mk b/toolchain/toolchain-external/pkg-toolchain-external.mk index 13b2468..19cf7d6 100644 --- a/toolchain/toolchain-external/pkg-toolchain-external.mk +++ b/toolchain/toolchain-external/pkg-toolchain-external.mk @@ -425,6 +425,7 @@ define TOOLCHAIN_EXTERNAL_INSTALL_SYSROOT_LIBS $(Q)SYSROOT_DIR="$(call toolchain_find_sysroot,$(TOOLCHAIN_EXTERNAL_CC))" ; \ ARCH_SYSROOT_DIR="$(call toolchain_find_sysroot,$(TOOLCHAIN_EXTERNAL_CC) $(TOOLCHAIN_EXTERNAL_CFLAGS))" ; \ ARCH_LIB_DIR="$(call toolchain_find_libdir,$(TOOLCHAIN_EXTERNAL_CC) $(TOOLCHAIN_EXTERNAL_CFLAGS))" ; \ + SPECIFIC_LD_NAME=`$(TOOLCHAIN_EXTERNAL_READELF) -d $${ARCH_SYSROOT_DIR}$${ARCH_LIB_DIR}/libc*.so|grep ld|grep so|awk '{print $$NF}'|sed "s/\[//g"|sed "s/\]//g"`;\ SUPPORT_LIB_DIR="" ; \ if test `find $${ARCH_SYSROOT_DIR} -name 'libstdc++.a' | wc -l` -eq 0 ; then \ LIBSTDCPP_A_LOCATION=$$(LANG=C $(TOOLCHAIN_EXTERNAL_CC) $(TOOLCHAIN_EXTERNAL_CFLAGS) -print-file-name=libstdc++.a) ; \ @@ -441,7 +442,7 @@ define TOOLCHAIN_EXTERNAL_INSTALL_SYSROOT_LIBS ARCH_SUBDIR=`echo $${ARCH_SYSROOT_DIR} | sed -r -e "s:^$${SYSROOT_DIR}(.*)/$$:\1:"` ; \ fi ; \ $(call MESSAGE,"Copying external toolchain sysroot to staging...") ; \ - $(call copy_toolchain_sysroot,$${SYSROOT_DIR},$${ARCH_SYSROOT_DIR},$${ARCH_SUBDIR},$${ARCH_LIB_DIR},$${SUPPORT_LIB_DIR}) + $(call copy_toolchain_sysroot,$${SYSROOT_DIR},$${ARCH_SYSROOT_DIR},$${ARCH_SUBDIR},$${ARCH_LIB_DIR},$${SUPPORT_LIB_DIR},$${SPECIFIC_LD_NAME}) endef # Create a symlink from (usr/)$(ARCH_LIB_DIR) to lib. -- 2.7.4
next prev parent reply other threads:[~2020-01-02 4:10 UTC|newest] Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top 2020-01-02 3:57 [PATCH 1/2] package/toolchain-external: ensure ARCH_LIB_DIR exist Mao Han 2020-01-02 3:57 ` [Buildroot] " Mao Han 2020-01-02 3:57 ` Mao Han [this message] 2020-01-02 3:57 ` [Buildroot] [PATCH 2/2] toolchain: Get ld.so name if available Mao Han 2020-01-26 15:31 ` Yann E. MORIN 2020-01-26 15:31 ` Yann E. MORIN 2020-02-05 10:30 ` Thomas De Schampheleire 2020-02-05 10:30 ` Thomas De Schampheleire 2020-01-09 6:27 ` [Buildroot] [PATCH 1/2] package/toolchain-external: ensure ARCH_LIB_DIR exist Mao Han 2020-01-10 10:57 ` Thomas De Schampheleire 2020-01-10 10:57 ` Thomas De Schampheleire 2020-01-10 11:15 ` Thomas Petazzoni 2020-01-10 11:15 ` Thomas Petazzoni 2020-01-13 3:34 ` Mao Han 2020-01-13 3:34 ` Mao Han 2020-01-16 9:36 ` Thomas De Schampheleire 2020-01-16 9:36 ` Thomas De Schampheleire 2020-01-17 2:35 ` Mao Han 2020-01-17 2:35 ` Mao Han 2020-01-24 15:00 ` Thomas De Schampheleire 2020-01-24 15:00 ` Thomas De Schampheleire 2020-01-26 15:34 ` Yann E. MORIN 2020-01-26 15:34 ` Yann E. MORIN 2020-02-17 3:43 ` [Buildroot] 回复:Re: " 毛晗
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=1577937441-18703-2-git-send-email-han_mao@c-sky.com \ --to=han_mao@c-sky.com \ --cc=buildroot@buildroot.org \ --cc=hongdeng_chen@c-sky.com \ --cc=linux-csky@vger.kernel.org \ --cc=mark.corbin@embecosm.com \ --cc=ren_guo@c-sky.com \ --cc=thomas.petazzoni@bootlin.com \ --cc=xianmiao_qu@c-sky.com \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.