-
-
Notifications
You must be signed in to change notification settings - Fork 477
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
34 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
int a_symbol_name; | ||
int foo() { return a_symbol_name; } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
#! /bin/sh -e | ||
|
||
PATCHELF=$(readlink -f "../src/patchelf") | ||
SCRATCH="scratch/$(basename "$0" .sh)" | ||
READELF=${READELF:-readelf} | ||
|
||
LIB_NAME="${PWD}/libshared-rpath.so" | ||
|
||
rm -rf "${SCRATCH}" | ||
mkdir -p "${SCRATCH}" | ||
cd "${SCRATCH}" | ||
|
||
nm -D "${LIB_NAME}" | grep a_symbol_name | ||
|
||
echo "Rename the rpath to something larger than the original" | ||
# Pathelf should detect that the rpath string is shared with the symbol name string and avoid | ||
# tainting the string with Xs | ||
"${PATCHELF}" --set-rpath a_very_big_rpath_that_is_larger_than_original --output liblarge-rpath.so "${LIB_NAME}" | ||
echo "Checking symbol is still there" | ||
nm -D liblarge-rpath.so | grep a_symbol_name | ||
|
||
echo "Rename the rpath to something shorter than the original" | ||
# Pathelf should detect that the rpath string is shared with the symbol name string and avoid | ||
# overwriting the existing string | ||
"${PATCHELF}" --set-rpath shrt_rpth --output libshort-rpath.so "${LIB_NAME}" | ||
echo "Checking symbol is still there" | ||
nm -D libshort-rpath.so | grep a_symbol_name |