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