Skip to content

Commit

Permalink
* When using --force-rpath and the executable already has a
Browse files Browse the repository at this point in the history
  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.
  • Loading branch information
edolstra committed May 7, 2009
1 parent fe0f879 commit ae660b9
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/patchelf.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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, ...)
{
Expand Down Expand Up @@ -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());
Expand Down

0 comments on commit ae660b9

Please sign in to comment.