1From 8c75599b674c73fbfe9c15afeccad54ae88243f5 Mon Sep 17 00:00:00 2001
2From: Bryce Ferguson <bryce.ferguson@rockwellcollins.com>
3Date: Mon, 25 Jun 2018 13:05:07 -0500
4Subject: [PATCH] patchelf: Check ELF endianness before writing new runpath
5
6This commit modifies the way fields are written in the dynamic
7section in order to account the architecture of the target ELF
8file. Instead of copying the raw data, use the helper functions
9to convert endianness.
10
11Link to upstream PR: https://github.com/NixOS/patchelf/pull/151
12
13Signed-off-by: Bryce Ferguson <bryce.ferguson@rockwellcollins.com>
14---
15 src/patchelf.cc | 4 ++--
16 1 file changed, 2 insertions(+), 2 deletions(-)
17
18diff --git a/src/patchelf.cc b/src/patchelf.cc
19index 35b4a33..a33f644 100644
20--- a/src/patchelf.cc
21+++ b/src/patchelf.cc
22@@ -1315,13 +1315,13 @@ void ElfFile<ElfFileParamNames>::modifyRPath(RPathOp op, string rootDir, string
23     debug("new rpath is `%s'\n", newRPath.c_str());
24
25     if (!forceRPath && dynRPath && !dynRunPath) { /* convert DT_RPATH to DT_RUNPATH */
26-        dynRPath->d_tag = DT_RUNPATH;
27+        wri(dynRPath->d_tag, DT_RUNPATH);
28         dynRunPath = dynRPath;
29         dynRPath = 0;
30     }
31
32     if (forceRPath && dynRPath && dynRunPath) { /* convert DT_RUNPATH to DT_RPATH */
33-        dynRunPath->d_tag = DT_IGNORE;
34+        wri(dynRunPath->d_tag, DT_IGNORE);
35     }
36
37     if (newRPath.size() <= rpathSize) {
38--
392.17.0
40
41