From patchwork Fri Jun 29 11:33:39 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Muellner X-Patchwork-Id: 936840 Return-Path: X-Original-To: incoming-buildroot@patchwork.ozlabs.org Delivered-To: patchwork-incoming-buildroot@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=busybox.net (client-ip=140.211.166.138; helo=whitealder.osuosl.org; envelope-from=buildroot-bounces@busybox.net; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=theobroma-systems.com Received: from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 41HFN74G5xz9ry1 for ; Fri, 29 Jun 2018 21:51:03 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id 20B13882FF; Fri, 29 Jun 2018 11:51:01 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from whitealder.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 23WA35dNDYxw; Fri, 29 Jun 2018 11:51:00 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by whitealder.osuosl.org (Postfix) with ESMTP id EC1C387F85; Fri, 29 Jun 2018 11:50:59 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138]) by ash.osuosl.org (Postfix) with ESMTP id D48841C01F1 for ; Fri, 29 Jun 2018 11:50:58 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id D1A6E87F85 for ; Fri, 29 Jun 2018 11:50:58 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from whitealder.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id TVDQA7tAZAO0 for ; Fri, 29 Jun 2018 11:50:56 +0000 (UTC) X-Greylist: delayed 00:17:01 by SQLgrey-1.7.6 Received: from mail.theobroma-systems.com (vegas.theobroma-systems.com [144.76.126.164]) by whitealder.osuosl.org (Postfix) with ESMTPS id F119587EE3 for ; Fri, 29 Jun 2018 11:50:55 +0000 (UTC) Received: from [86.59.122.178] (port=47948 helo=purcell.lan) by mail.theobroma-systems.com with esmtpsa (TLS1.2:DHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.80) (envelope-from ) id 1fYreu-0001QY-Ey; Fri, 29 Jun 2018 13:33:48 +0200 From: Christoph Muellner To: buildroot@buildroot.org Date: Fri, 29 Jun 2018 13:33:39 +0200 Message-Id: <20180629113339.59102-1-christoph.muellner@theobroma-systems.com> X-Mailer: git-send-email 2.11.0 Subject: [Buildroot] [PATCH 1/1] toolchain: Fix ld.so copying for multilib toolchains. X-BeenThere: buildroot@busybox.net X-Mailman-Version: 2.1.24 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Philipp Tomsich , Thomas De Schampheleire , Thomas Petazzoni , Christoph Muellner MIME-Version: 1.0 Errors-To: buildroot-bounces@busybox.net Sender: "buildroot" Multilib toolchains can have more than one ld.so files in lib/. Typically one for each lib* directory. However the current copy_toolchain_sysroot implemenation does not support more than one ld.so. This patch addresses this by iterating over all ld.so files in the lib/ directory and choose the one, which has a symlink into $ARCH_LIB_DIR/. An example is a multilib toolchain for aarch64 (LP64 and ILP32), which includes the following entries in lib/: $ ls -l lib/ lrwxrwxrwx 1 user group ld-linux-aarch64_ilp32.so.1 -> ../libilp32/ld-2.27.so lrwxrwxrwx 1 user group ld-linux-aarch64.so.1 -> ../lib64/ld-2.27.so $ARCH_LIB_DIR/ will be detected as lib64. Without the patch no ld.so will be copied. With the patch the second ld.so (the one for LP64) will be copied. Signed-off-by: Christoph Muellner Signed-off-by: Philipp Tomsich --- toolchain/helpers.mk | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/toolchain/helpers.mk b/toolchain/helpers.mk index 1792286add..62c0454be5 100644 --- a/toolchain/helpers.mk +++ b/toolchain/helpers.mk @@ -136,9 +136,14 @@ 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/ ; \ - fi ; \ + find $${ARCH_SYSROOT_DIR}/lib/ -name ld*.so.* -print0 | while IFS= read -r -d '' LD_SO; do \ + LINKTARGET=`realpath $${LD_SO}` ; \ + LINKTARGETDIR=`dirname $${LINKTARGET}` ; \ + LINKTARGETBASE=`basename $${LINKTARGETDIR}` ; \ + if [ "$${LINKTARGETBASE}" = "$${ARCH_LIB_DIR}" ]; then \ + cp -a $${LD_SO} $(STAGING_DIR)/lib/ ; \ + fi ; \ + done ; \ fi ; \ if [ `readlink -f $${SYSROOT_DIR}` != `readlink -f $${ARCH_SYSROOT_DIR}` ] ; then \ if [ ! -d $${ARCH_SYSROOT_DIR}/usr/include ] ; then \