diff options
author | Wolfgang Grandegger <wg@grandegger.com> | 2017-07-20 16:35:13 +0200 |
---|---|---|
committer | Thomas Petazzoni <thomas.petazzoni@free-electrons.com> | 2017-07-20 22:29:35 +0200 |
commit | 07b05f439a145edc061c8a2460f849de069c32cb (patch) | |
tree | 4eb5c92ab56d038dc212da89278eb58c0c287058 /package/patchelf/0002-Extract-a-function-for-splitting-a-colon-separated-s.patch | |
parent | f45f0c2d40e3e750d66a9b791ed9e62ac4f69a8f (diff) | |
download | buildroot-07b05f439a145edc061c8a2460f849de069c32cb.tar.gz buildroot-07b05f439a145edc061c8a2460f849de069c32cb.zip |
package/patchelf: add patch for rpath sanitization under a root directory
The patch allows to use patchelf to sanitize the rpath of the buildroot
libraries and binaries using the option "--make-rpath-relative <rootdir>".
Recent versions of patchelf will not built on old Debian and RHEL systems
due to C++11 constructs. Therefore we stick with v0.9 for the time being.
Signed-off-by: Wolfgang Grandegger <wg@grandegger.com>
Acked-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Diffstat (limited to 'package/patchelf/0002-Extract-a-function-for-splitting-a-colon-separated-s.patch')
-rw-r--r-- | package/patchelf/0002-Extract-a-function-for-splitting-a-colon-separated-s.patch | 63 |
1 files changed, 63 insertions, 0 deletions
diff --git a/package/patchelf/0002-Extract-a-function-for-splitting-a-colon-separated-s.patch b/package/patchelf/0002-Extract-a-function-for-splitting-a-colon-separated-s.patch new file mode 100644 index 0000000000..330bea23bc --- /dev/null +++ b/package/patchelf/0002-Extract-a-function-for-splitting-a-colon-separated-s.patch @@ -0,0 +1,63 @@ +From a8452dc7e80eb17572c7458e33a4f4d609e6a3da Mon Sep 17 00:00:00 2001 +From: Tuomas Tynkkynen <tuomas@tuxera.com> +Date: Fri, 3 Jun 2016 23:03:51 +0300 +Subject: [PATCH] Extract a function for splitting a colon-separated string + +We're going to need this logic in another place, so make a function of +this. + +[Upstream-commit: https://github.com/NixOS/patchelf/commit/2e3fdc2030c75c19df6fc2924083cfad53856562] +Signed-off-by: Wolfgang Grandegger <wg@grandegger.com> +--- + src/patchelf.cc | 28 +++++++++++++++++++--------- + 1 file changed, 19 insertions(+), 9 deletions(-) + +diff --git a/src/patchelf.cc b/src/patchelf.cc +index c870638..1d9a772 100644 +--- a/src/patchelf.cc ++++ b/src/patchelf.cc +@@ -57,6 +57,22 @@ unsigned char * contents = 0; + #define ElfFileParamNames Elf_Ehdr, Elf_Phdr, Elf_Shdr, Elf_Addr, Elf_Off, Elf_Dyn, Elf_Sym + + ++static vector<string> splitColonDelimitedString(const char * s){ ++ vector<string> parts; ++ const char * pos = s; ++ while (*pos) { ++ const char * end = strchr(pos, ':'); ++ if (!end) end = strchr(pos, 0); ++ ++ parts.push_back(string(pos, end - pos)); ++ if (*end == ':') ++end; ++ pos = end; ++ } ++ ++ return parts; ++} ++ ++ + static unsigned int getPageSize(){ + return pageSize; + } +@@ -1093,15 +1109,9 @@ void ElfFile<ElfFileParamNames>::modifyRPath(RPathOp op, string newRPath) + + newRPath = ""; + +- char * pos = rpath; +- while (*pos) { +- char * end = strchr(pos, ':'); +- if (!end) end = strchr(pos, 0); +- +- /* Get the name of the directory. */ +- string dirName(pos, end - pos); +- if (*end == ':') ++end; +- pos = end; ++ vector<string> rpathDirs = splitColonDelimitedString(rpath); ++ for (vector<string>::iterator it = rpathDirs.begin(); it != rpathDirs.end(); ++it) { ++ const string & dirName = *it; + + /* Non-absolute entries are allowed (e.g., the special + "$ORIGIN" hack). */ +-- +1.9.1 + |