From patchwork Mon May 28 19:45:17 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Yann E. MORIN" X-Patchwork-Id: 921680 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.136; helo=silver.osuosl.org; envelope-from=buildroot-bounces@busybox.net; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=free.fr Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="rBMB/d45"; dkim-atps=neutral Received: from silver.osuosl.org (smtp3.osuosl.org [140.211.166.136]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 40vnQH0hLpz9s15 for ; Tue, 29 May 2018 05:45:27 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id 62BCE2215E; Mon, 28 May 2018 19:45:25 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from silver.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 6tRKBFs1l1aG; Mon, 28 May 2018 19:45:24 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by silver.osuosl.org (Postfix) with ESMTP id 2ABD4221A3; Mon, 28 May 2018 19:45:24 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from silver.osuosl.org (smtp3.osuosl.org [140.211.166.136]) by ash.osuosl.org (Postfix) with ESMTP id A7E791BFFDB for ; Mon, 28 May 2018 19:45:22 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id A49C5221A3 for ; Mon, 28 May 2018 19:45:22 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from silver.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Q0Nfkgs+o7YJ for ; Mon, 28 May 2018 19:45:22 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-wm0-f41.google.com (mail-wm0-f41.google.com [74.125.82.41]) by silver.osuosl.org (Postfix) with ESMTPS id DAA7D2207C for ; Mon, 28 May 2018 19:45:21 +0000 (UTC) Received: by mail-wm0-f41.google.com with SMTP id l1-v6so34690703wmb.2 for ; Mon, 28 May 2018 12:45:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=LfcDf3seyFJcvlDK3QSc7xag7Pdjqy2VTwbldgTs6iE=; b=rBMB/d45LmJ3+o7J/JOkpWRrg9d/V4fxHLJM9QCRbQ0ljOj0yH0hl/LclDjamH+d62 0ngPkgfQ4ZJVmzMjvMPXi53tpfWiRAA3WTn4y889s5k6WldOxBcUvjfLAjLmlaZ17inK u/ofEqeZmtI9ZWAUw+kEI1ukqKF1wUIDwssvR7I7+/U4HqkqBbhEsGx7G42Bmh/GwRUb JgsoVtxqHxDI+ddKafCgxjLQzPcIBLVmtNEf7SYUEpoq02q5MfWzyjQ2a4Ubh7eGKE7F 9k2SyJJ8TrJA2DaDrpOaWzk3XCZxwXwxKJ531adgmKO0XUohscZJXvghxhtihjecdUa+ es5w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=LfcDf3seyFJcvlDK3QSc7xag7Pdjqy2VTwbldgTs6iE=; b=fRQGxFDJN7vLO0X7FuG3LV9S08RE+mYZmyvQ3kuwisLnrkTT4ossJgyCYZ0ppMlUOw 3/rYuamZP/A9R+1usTcQVJi8iwJ9Jy9N1dH2sMUacbrZ+UIwjkI7DWwEzLJTKtHqA23Y TbjmlyW0lvRYXfNId3YKF/boppu0bE+3YiS/GU4+YMFIsdoOJMjpxFCqSR76gAoCCFx5 /sEbUxhIPuTwZeUhnZeAEekAZhY0MOl8zJHCwNN7gyXBC/VbI18qOtPJ0qU+vG/n5hhl Zy9tV6OcDqCzQiTJMIq+kTPlLkfkbr5hNgKNaj7YV6oOtq01kP9XhGvxDhPvy4ZpfD+I 8zww== X-Gm-Message-State: ALKqPwdGVrOb7SaWIi0A5rW61P32A9y/rgRlQWT31w7Tc+jKGrpAU943 JTYc72nykf1w8x0OQRLTjqhDGA== X-Google-Smtp-Source: ADUXVKLVYVsIvnWmUw5ckUZAZIBX5uF0fjKtG1aQvbkokSNgeRS18oP4yH+QwZrnMAMS2QKic7qXzQ== X-Received: by 2002:a1c:7507:: with SMTP id o7-v6mr9475937wmc.139.1527536720069; Mon, 28 May 2018 12:45:20 -0700 (PDT) Received: from scaer.bzh.lan (2a01cb088610730081fd7eea83c08e89.ipv6.abo.wanadoo.fr. [2a01:cb08:8610:7300:81fd:7eea:83c0:8e89]) by smtp.gmail.com with ESMTPSA id o138-v6sm18284275wmg.10.2018.05.28.12.45.19 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 28 May 2018 12:45:19 -0700 (PDT) From: "Yann E. MORIN" To: buildroot@buildroot.org Date: Mon, 28 May 2018 21:45:17 +0200 Message-Id: X-Mailer: git-send-email 2.14.1 In-Reply-To: References: Subject: [Buildroot] [PATCH 1/2 v2] package/binutils: switch from symlinks to copies to fix rpath 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: Christophe Priouzeau , "Yann E. MORIN" , Thomas Petazzoni MIME-Version: 1.0 Errors-To: buildroot-bounces@busybox.net Sender: "buildroot" Commit f9cffb6af464 (binutils: replace hard-links with soft-links to fix rpath) has a side effect that when we build for a noMMU target, elf2flt will in turn replace some of the programs installed by binutils, with its own wrappers. For example, it will rename host/TUPLE/bin/ld to ld.real, and add its own wrapper in place of the original. It does the same for host/bin/TUPLE-ld and host/bin/TUPLE-ld.real. However, we had already made ld a symlink to ../../bin/TUPLE-ld, so host/TUPLE/bin/ld.real will still point to host/bin/TUPLE-ld when we want it to point to ld.real instead... This ultimately confuses gcc later on. Of course, the culprit is also elf2flt, which also installs similar hardlinks that would ultimately exhibit the same rpath issue as the one fixed by f9cffb6af464. Note: we haven't had an issue so far with that, because those tools installed by elf2flt only link with libz, which is most often present on the host system. So, all seem well, but is nonetheless broken; this will be fixed in a subsequent commit. But back on topic. If we were to fix elf2flt with similar symlinks, gcc still gets confused. The underlying reason for this confusion is not entirely clear, though... It looks like something is trying to dereference symlinks and gets confused by the result somehow... So, in an attempt to restore some sanity in all this mess, we try to restore the previous behaviour, we no longer use symlinks but just copy the individual tools. Fixes: #11031. Signed-off-by: "Yann E. MORIN" Cc: Christophe Priouzeau Cc: Thomas Petazzoni Cc: Peter Korsgaard Cc: Arnout Vandecappelle --- Changes v1 -> v2: - use copies, not shell wrappers (Arnout) --- package/binutils/binutils.mk | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/package/binutils/binutils.mk b/package/binutils/binutils.mk index be9e652e10..1c05958f9c 100644 --- a/package/binutils/binutils.mk +++ b/package/binutils/binutils.mk @@ -132,12 +132,13 @@ endif # Hardlinks between binaries in different directories cause a problem # with rpath fixup, so we de-hardlink those binaries, and replace them -# with symbolic links. +# with copies instead. BINUTILS_TOOLS = ar as ld ld.bfd nm objcopy objdump ranlib readelf strip define HOST_BINUTILS_FIXUP_HARDLINKS $(foreach tool,$(BINUTILS_TOOLS),\ - rm -f $(HOST_DIR)/$(GNU_TARGET_NAME)/bin/$(tool) ; \ - ln -s ../../bin/$(GNU_TARGET_NAME)-$(tool) $(HOST_DIR)/$(GNU_TARGET_NAME)/bin/$(tool) + rm -f $(HOST_DIR)/$(GNU_TARGET_NAME)/bin/$(tool) && \ + cp -a $(HOST_DIR)/bin/$(GNU_TARGET_NAME)-$(tool) \ + $(HOST_DIR)/$(GNU_TARGET_NAME)/bin/$(tool) ) endef HOST_BINUTILS_POST_INSTALL_HOOKS += HOST_BINUTILS_FIXUP_HARDLINKS