From: Wolfgang Grandegger <wg@grandegger.com>
To: buildroot@busybox.net
Subject: [Buildroot] [RFC PATCH 4/9] core: add {TARGET, STAGING}_SANITIZE_RPATH_HOOK to TARGET_FINALIZE_HOOKS
Date: Fri, 3 Mar 2017 15:18:48 +0100 [thread overview]
Message-ID: <1488550733-3956-5-git-send-email-wg@grandegger.com> (raw)
In-Reply-To: <1488550733-3956-1-git-send-email-wg@grandegger.com>
From: Samuel Martin <s.martin49@gmail.com>
This patch introduces the TARGET_SANITIZE_RPATH_HOOK and
STAGING_SANITIZE_RPATH_HOOK hooks fixing the ELF files' RPATH of
binaries from, respectively, the TARGET_DIR and the STAGING_DIR
locations.
It is a fair assumption that all target package has been built before
reaching the target-finalize target; hence the execution of these hooks
as TARGET_FINALIZE_HOOKS.
After running these hooks, the RPATH from any target ELF files from both
the target and the staging locations won't contain any occurrence of the
sysroot or some build locations.
Signed-off-by: Samuel Martin <s.martin49@gmail.com>
---
Makefile | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/Makefile b/Makefile
index 54c815b..a68c9ce 100644
--- a/Makefile
+++ b/Makefile
@@ -661,6 +661,22 @@ endef
TARGET_FINALIZE_HOOKS += PURGE_LOCALES
endif
+# Function sanitizing target/staging ELF files' RPATH.
+# i.e. it removes paths pointing to the staging or build location from the ELF
+# files' RPATH.
+define TARGET_SANITIZE_RPATH_HOOK
+ PATCHELF=$(HOST_DIR)/usr/bin/patchelf \
+ $(TOPDIR)/support/scripts/fix-rpath target $(TARGET_DIR)
+endef
+
+define STAGING_SANITIZE_RPATH_HOOK
+ PATCHELF=$(HOST_DIR)/usr/bin/patchelf \
+ $(TOPDIR)/support/scripts/fix-rpath staging $(STAGING_DIR)
+endef
+
+TARGET_FINALIZE_HOOKS += TARGET_SANITIZE_RPATH_HOOK \
+ STAGING_SANITIZE_RPATH_HOOK
+
$(TARGETS_ROOTFS): target-finalize
target-finalize: $(PACKAGES)
--
1.9.1
next prev parent reply other threads:[~2017-03-03 14:18 UTC|newest]
Thread overview: 36+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-03-03 14:18 [Buildroot] [RFC PATCH 0/9] Make the buildroot toolchain relocatable Wolfgang Grandegger
2017-03-03 14:18 ` [Buildroot] [RFC PATCH 1/9] package/patchelf: use a recent version and add "--make-rpath-relative" patch Wolfgang Grandegger
2017-03-04 11:26 ` Arnout Vandecappelle
2017-03-04 15:16 ` Wolfgang Grandegger
2017-03-05 23:13 ` Arnout Vandecappelle
2017-03-06 8:42 ` Wolfgang Grandegger
2017-03-06 12:40 ` Arnout Vandecappelle
2017-03-06 13:57 ` Wolfgang Grandegger
2017-03-03 14:18 ` [Buildroot] [RFC PATCH 2/9] support/scripts: add fix-rpath script to sanitize the rpath Wolfgang Grandegger
2017-03-03 14:48 ` Thomas Petazzoni
2017-03-03 16:39 ` Wolfgang Grandegger
2017-03-06 9:07 ` Wolfgang Grandegger
[not found] ` <30db8390-0a94-5449-0c5e-90263576be98@mind.be>
2017-03-07 9:13 ` Wolfgang Grandegger
[not found] ` <7524a67f-d19d-1023-262c-c0b7793e6066@mind.be>
2017-03-08 9:25 ` Wolfgang Grandegger
2017-03-12 20:53 ` Arnout Vandecappelle
2017-03-12 21:10 ` Wolfgang Grandegger
2017-03-13 17:08 ` Arnout Vandecappelle
2017-03-14 7:36 ` Wolfgang Grandegger
2017-03-04 11:39 ` Arnout Vandecappelle
2017-03-04 15:29 ` Wolfgang Grandegger
2017-03-03 14:18 ` [Buildroot] [RFC PATCH 3/9] core: sanitize HOST_DIR at the very end of the build Wolfgang Grandegger
2017-03-04 11:50 ` Arnout Vandecappelle
2017-03-03 14:18 ` Wolfgang Grandegger [this message]
2017-03-03 14:18 ` [Buildroot] [RFC PATCH 5/9] support/scripts: add create-relocation-script for toolchain relocation Wolfgang Grandegger
2017-03-16 17:51 ` Arnout Vandecappelle
2017-03-17 7:10 ` Wolfgang Grandegger
2017-03-17 15:50 ` Arnout Vandecappelle
2017-03-17 17:15 ` Wolfgang Grandegger
2017-03-17 22:09 ` Arnout Vandecappelle
2017-03-03 14:18 ` [Buildroot] [RFC PATCH 6/9] core: create relocate-toolchain.sh in HOST_DIR/usr at the end of the build Wolfgang Grandegger
2017-03-03 14:18 ` [Buildroot] [RFC PATCH 7/9] external-toolchain: check if a buildroot toolchain has already been relocated Wolfgang Grandegger
2017-03-03 14:18 ` [Buildroot] [RFC PATCH 8/9] support/scripts: check-host-rpath now handles $ORIGIN as well Wolfgang Grandegger
2017-03-03 14:46 ` Thomas Petazzoni
2017-03-03 14:56 ` Wolfgang Grandegger
2017-03-03 17:12 ` Wolfgang Grandegger
2017-03-03 14:18 ` [Buildroot] [RFC PATCH 9/9] support/scripts: check-host-rpath now uses patchelf to get the rpath Wolfgang Grandegger
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=1488550733-3956-5-git-send-email-wg@grandegger.com \
--to=wg@grandegger.com \
--cc=buildroot@busybox.net \
/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: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox