From patchwork Mon Jul 13 21:55:08 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Samuel Martin X-Patchwork-Id: 494782 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from silver.osuosl.org (smtp3.osuosl.org [140.211.166.136]) by ozlabs.org (Postfix) with ESMTP id 683211402A9 for ; Tue, 14 Jul 2015 07:55:39 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b=SKRnt5Yf; dkim-atps=neutral Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id 8F0F833584; Mon, 13 Jul 2015 21:55:38 +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 1ZvgQFtlLyDP; Mon, 13 Jul 2015 21:55:30 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by silver.osuosl.org (Postfix) with ESMTP id CA1E333657; Mon, 13 Jul 2015 21:55:24 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from hemlock.osuosl.org (smtp2.osuosl.org [140.211.166.133]) by ash.osuosl.org (Postfix) with ESMTP id E88371C2893 for ; Mon, 13 Jul 2015 21:55:21 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id E664A95693 for ; Mon, 13 Jul 2015 21:55:21 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from hemlock.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 98I-mb1mKf9M for ; Mon, 13 Jul 2015 21:55:21 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-wg0-f48.google.com (mail-wg0-f48.google.com [74.125.82.48]) by hemlock.osuosl.org (Postfix) with ESMTPS id 17DD695619 for ; Mon, 13 Jul 2015 21:55:21 +0000 (UTC) Received: by wgjx7 with SMTP id x7so306332736wgj.2 for ; Mon, 13 Jul 2015 14:55:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=yqOWfB3jv9iyzsef7hJWaYOOdJw/kK/0r4i5hD4JiZY=; b=SKRnt5Yff3pzQ5Ro3B/GRAOtTpzYhcigdT8t7f+zh725vrDVN3VmtCfSB7DA7DRvt2 sZmgNTSG2XDuB4zzW23POJOlCwOm5uE+GqM12VrQkBcoK6Fmq5dvXMbATgD9f38YBidF CjbfMVkcYqDzg9csqDgqonc0iBzKVxN0zd3afRqqYlv30klvg91aCkp4YZaVgtxO2Bji Uv6PlU/I/Ru+7JYrxpQePPo0jO3oCAGyazzGN55HnyRpm2BM7QpToNHokeHr0zV9OmA5 C8EiBPoQO3C+6sL/0gw44rd4ifWm/FZEVUyPmtwi6rxQBGs3hqLwHrGh6UIsGuFbvjye op4Q== X-Received: by 10.180.10.200 with SMTP id k8mr26780556wib.14.1436824519273; Mon, 13 Jul 2015 14:55:19 -0700 (PDT) Received: from bobook.localdomain (AToulouse-657-1-1031-128.w92-134.abo.wanadoo.fr. [92.134.9.128]) by smtp.gmail.com with ESMTPSA id j7sm31499888wjz.11.2015.07.13.14.55.18 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 13 Jul 2015 14:55:18 -0700 (PDT) From: Samuel Martin To: buildroot@buildroot.org Date: Mon, 13 Jul 2015 23:55:08 +0200 Message-Id: <1436824511-1601-2-git-send-email-s.martin49@gmail.com> X-Mailer: git-send-email 2.4.5 In-Reply-To: <1436824511-1601-1-git-send-email-s.martin49@gmail.com> References: <1436824511-1601-1-git-send-email-s.martin49@gmail.com> Subject: [Buildroot] [PATCH v5 2/5] Makefile: add HOST_FIX_RPATH_HOOK to TARGET_FINALIZE_HOOKS X-BeenThere: buildroot@busybox.net X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: buildroot-bounces@busybox.net Sender: "buildroot" This patch adds host-patchelf as a target-finalize dependency, and introduces the HOST_FIX_RPATH_HOOK hook fixing the ELF files' RPATH of the HOST_DIR location (excluding the sysroot). After running this hook, the RPATH from any host ELF files is relative to the binary location itself. Note that, we avoid to fix RPATH in the sysroot, and in the external toolcahin installation location. As a first step toward a fully relocatable SDK, this change allows to get the toolchain relocatable, but not yet the whole SDK. Signed-off-by: Samuel Martin --- changes v4->v5: - add verbose support changes v3->v4: - add host-patchelf to PACKAGES instead of target-finalize (Baruch) - add comment changes v2->v3: - move hook in Makefile (Baruch) --- Makefile | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/Makefile b/Makefile index 546bcd3..4b88116 100644 --- a/Makefile +++ b/Makefile @@ -555,6 +555,22 @@ endef TARGET_FINALIZE_HOOKS += PURGE_LOCALES endif +# RPATH fixing +# - The host hook sets RPATH in host ELF binaries, using relative paths to the +# library locations. +PACKAGES += host-patchelf + +define HOST_FIX_RPATH_HOOK + $(TOPDIR)/support/scripts/fix_rpaths \ + set $(HOST_DIR) \ + $(if $(V),--verbose) \ + --patchelf-program $(HOST_DIR)/usr/bin/patchelf \ + --libdirs $(HOST_DIR)/usr/lib \ + --exclude-dirs sysroot opt/ext-toolchain +endef + +TARGET_FINALIZE_HOOKS += HOST_FIX_RPATH_HOOK + $(TARGETS_ROOTFS): target-finalize target-finalize: $(PACKAGES)