-
-
Notifications
You must be signed in to change notification settings - Fork 505
Allow multiple modifications in same call #361
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
d306abe
e268662
dc375bc
d02a3ec
e589fe3
b92a6e8
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -36,3 +36,4 @@ Makefile | |
.direnv/ | ||
.vscode/ | ||
.idea/ | ||
result |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
#! /bin/sh -e | ||
Mic92 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
SCRATCH=scratch/$(basename $0 .sh) | ||
PATCHELF=$(readlink -f "../src/patchelf") | ||
|
||
rm -rf ${SCRATCH} | ||
mkdir -p ${SCRATCH} | ||
|
||
cp simple ${SCRATCH}/ | ||
cp libfoo.so ${SCRATCH}/ | ||
cp libbar.so ${SCRATCH}/ | ||
|
||
cd ${SCRATCH} | ||
|
||
libcldd=$(ldd ./simple | awk '/ => / { print $3 }' | grep -E "(libc.so|ld-musl)") | ||
|
||
# We have to set the soname on these libraries | ||
${PATCHELF} --set-soname libbar.so ./libbar.so | ||
Comment on lines
+16
to
+17
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Interestingly discussed with @trws that if the shared object doesn't have a DT_SONAME, it won't make use of the previously discovered loaded shared object. This was discovered while writing this test. You can see below that
|
||
|
||
# Add a libbar.so so we can rewrite it later | ||
${PATCHELF} --add-needed libbar.so ./simple | ||
|
||
# Make the NEEDED in libfoo the same as simple | ||
# This is a current "bug" in musl | ||
# https://www.openwall.com/lists/musl/2021/12/21/1 | ||
${PATCHELF} --replace-needed libbar.so $(readlink -f ./libbar.so) ./libfoo.so | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @Mic92 please read the linked mailing issue I opened for why we have to do this for musl This should now succeed on musl and glibc proving the fix of the bug. |
||
|
||
${PATCHELF} --replace-needed libc.so.6 ${libcldd} \ | ||
--replace-needed libbar.so $(readlink -f ./libbar.so) \ | ||
--add-needed $(readlink -f ./libfoo.so) \ | ||
./simple | ||
|
||
exitCode=0 | ||
./simple || exitCode=$? | ||
|
||
if test "$exitCode" != 0; then | ||
ldd ./simple | ||
exit 1 | ||
fi |
Uh oh!
There was an error while loading. Please reload this page.