diff options
author | Eelco Dolstra <e.dolstra@tudelft.nl> | 2005-09-29 15:58:41 (GMT) |
---|---|---|
committer | Eelco Dolstra <e.dolstra@tudelft.nl> | 2005-09-29 15:58:41 (GMT) |
commit | 64e3c5d087dc5c94bf2bc5698608daf546fdcf2d (patch) | |
tree | 36358d765ea090dd04bbf095dec5f0ca6378496b /src | |
parent | a49db8e56956a9f3a53873977b49090bfc8025cd (diff) | |
download | patchelf-64e3c5d087dc5c94bf2bc5698608daf546fdcf2d.zip patchelf-64e3c5d087dc5c94bf2bc5698608daf546fdcf2d.tar.gz patchelf-64e3c5d087dc5c94bf2bc5698608daf546fdcf2d.tar.bz2 |
* Add an operation `--print-rpath' to print the RPATH of the library
or executable and exit.
Diffstat (limited to 'src')
-rw-r--r-- | src/patchelf.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/src/patchelf.c b/src/patchelf.c index adf1c8f..a957aa1 100644 --- a/src/patchelf.c +++ b/src/patchelf.c @@ -16,6 +16,7 @@ static char * fileName = 0; static char * newInterpreter = 0; static int doShrinkRPath = 0; +static int printRPath = 0; static int printInterpreter = 0; @@ -188,7 +189,7 @@ static void concat(char * dst, char * src) static void shrinkRPath(void) { /* Shrink the RPATH. */ - if (doShrinkRPath) { + if (doShrinkRPath || printRPath) { /* Find the .dynamic section. */ int i, dynSec = 0; @@ -241,6 +242,11 @@ static void shrinkRPath(void) } } + if (printRPath) { + printf("%s\n", rpath ? rpath : ""); + exit(0); + } + if (!rpath) { fprintf(stderr, "no RPATH to shrink\n"); return; @@ -311,7 +317,7 @@ static void shrinkRPath(void) static void patchElf(void) { - if (!printInterpreter) + if (!printInterpreter && !printRPath) fprintf(stderr, "patching ELF file `%s'\n", fileName); mode_t fileMode; @@ -395,6 +401,7 @@ int main(int argc, char * * argv) [--interpreter FILENAME]\n\ [--print-interpreter]\n\ [--shrink-rpath]\n\ + [--print-rpath]\n\ FILENAME\n", argv[0]); return 1; } @@ -411,6 +418,9 @@ int main(int argc, char * * argv) else if (strcmp(argv[i], "--shrink-rpath") == 0) { doShrinkRPath = 1; } + else if (strcmp(argv[i], "--print-rpath") == 0) { + printRPath = 1; + } else break; } |