diff options
author | Eelco Dolstra <e.dolstra@tudelft.nl> | 2009-05-07 15:05:34 (GMT) |
---|---|---|
committer | Eelco Dolstra <e.dolstra@tudelft.nl> | 2009-05-07 15:05:34 (GMT) |
commit | ae660b94d8137148c59cd8b4bbe961d6eee68488 (patch) | |
tree | b1e026dad380a2c811e86ebfc1aaad545a51038a | |
parent | fe0f87930962c8817d6f836f5c7f1b24635f8204 (diff) | |
download | patchelf-ae660b94d8137148c59cd8b4bbe961d6eee68488.zip patchelf-ae660b94d8137148c59cd8b4bbe961d6eee68488.tar.gz patchelf-ae660b94d8137148c59cd8b4bbe961d6eee68488.tar.bz2 |
* When using --force-rpath and the executable already has a
DT_RUNPATH, get rid of it. Sometimes you really want a DT_RPATH
rather than a DT_RUNPATH, since the former is global (affects
the search path of dependencies as well) while the latter is local.
-rw-r--r-- | src/patchelf.cc | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/patchelf.cc b/src/patchelf.cc index 9b17192..58404d9 100644 --- a/src/patchelf.cc +++ b/src/patchelf.cc @@ -205,6 +205,9 @@ I ElfFile<ElfFileParamNames>::rdi(I i) #define DT_GNU_HASH 0x6ffffef5 #endif +/* Ugly: used to erase DT_RUNPATH when using --force-rpath. */ +#define DT_IGNORE 0x00726e67 + static void debug(const char * format, ...) { @@ -959,6 +962,10 @@ void ElfFile<ElfFileParamNames>::modifyRPath(RPathOp op, string newRPath) dynRunPath = dynRPath; dynRPath = 0; } + + if (forceRPath && dynRPath && dynRunPath) { /* convert DT_RUNPATH to DT_RPATH */ + dynRunPath->d_tag = DT_IGNORE; + } if (newRPath.size() <= rpathSize) { strcpy(rpath, newRPath.c_str()); |