From patchwork Mon Jul 13 10:54:28 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Samuel Martin X-Patchwork-Id: 494500 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from hemlock.osuosl.org (smtp2.osuosl.org [140.211.166.133]) by ozlabs.org (Postfix) with ESMTP id 10416140773 for ; Mon, 13 Jul 2015 20:54:45 +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=Lvi6bgcW; dkim-atps=neutral Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id 5F126951BF; Mon, 13 Jul 2015 10:54:44 +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 8PjwL+-OvufT; Mon, 13 Jul 2015 10:54:43 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by hemlock.osuosl.org (Postfix) with ESMTP id CDC0D95236; Mon, 13 Jul 2015 10:54:43 +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 10F6A1C0361 for ; Mon, 13 Jul 2015 10:54:40 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id 0D535951B1 for ; Mon, 13 Jul 2015 10:54:40 +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 TjEEtE0IDADq for ; Mon, 13 Jul 2015 10:54:39 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-wi0-f170.google.com (mail-wi0-f170.google.com [209.85.212.170]) by hemlock.osuosl.org (Postfix) with ESMTPS id 2379D951D5 for ; Mon, 13 Jul 2015 10:54:39 +0000 (UTC) Received: by wiga1 with SMTP id a1so65628865wig.0 for ; Mon, 13 Jul 2015 03:54:37 -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=d7Ee3v7LM4Av3cCmJhpqytgv5+16xx016AAzNiazXHs=; b=Lvi6bgcWwdBsNkJnTyrz/9c9pqC8zU4uulsrQU5HYCyJxBt03YV0O+ctnGx8+2QMpl DJPuRijcoQ8HdeMRPCq93enPAOdxOWrNgCILkmF2JwovcVsEYBgQXDyS6+iIwayDafyS b0SA1NAAMjYtRY5vwVg6nD8ccekryf4iv9Wiq+LMytpXXImtaYItFww1g9F1153E87em 46jEzzZlXdbx8v55W8zuV1IFtYQ+HdQblJquJ/uPP0M4r0js1pqKTfbeNvBWZC/Tk9Ql XgAubuj0FR6WgAa0OFXmTNj3HQHeeOrOjchJ3Rcmf6ud7G13gjIcsCGy03XkCUWLWZft DT2g== X-Received: by 10.180.75.78 with SMTP id a14mr22703000wiw.68.1436784877760; Mon, 13 Jul 2015 03:54:37 -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 dz4sm13906733wib.17.2015.07.13.03.54.36 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 13 Jul 2015 03:54:36 -0700 (PDT) From: Samuel Martin To: buildroot@buildroot.org Date: Mon, 13 Jul 2015 12:54:28 +0200 Message-Id: <1436784870-17417-2-git-send-email-s.martin49@gmail.com> X-Mailer: git-send-email 2.4.5 In-Reply-To: <1436784870-17417-1-git-send-email-s.martin49@gmail.com> References: <1436784870-17417-1-git-send-email-s.martin49@gmail.com> Subject: [Buildroot] [PATCH v4 2/4] 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 tree (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 v3->v4: - add host-patchelf to PACKAGES instead of target-finalize (Baruch) - add comment changes v2->v3: - move hook in Makefile (Baruch) --- Makefile | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/Makefile b/Makefile index daf692e..c161a33 100644 --- a/Makefile +++ b/Makefile @@ -542,6 +542,21 @@ 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) \ + --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)