Closed H5GG closed 1 year ago
This was discussed when Procursus was first implementing rootless, but @loader_path
works off of the symlink path, not the realpath, which means if you symlink a binary, it won't be able to find its dependencies.
Thank you for your patience and answer, I will continue to look for a feasible way.
I did a test on iphone11(15.1):
I built a test tweak and linked @rpath/CydiaSubstrate.framework/CydiaSubstrate, then I set its rpath to @loader_path/../../../Library/Frameworks .
then i symlink /Library/MobileSubstrate/DynamicLibraries/testweak.dylib to /Library/MobileSubstrate/DynamicLibraries/test/testweak.dylib.
In this way, whether using a real path or a symbol path, dyld can correctly load it and its dependencies (CydiaSubstrate).
I went through the source code of dyld and found that it always resolves @loader_path to the real path:
I don't know how it used to be, but maybe Apple has fixed this problem in the past two years?
I just performed my own tests on this, and you're right, they seem to have fixed it since. In any case, this is not the place for issues like this to be opened, please move this to ProcursusTeam/Procursus#
ok, thank you, i'm really interested in these.
exampes: the install name of the first rootless libraries is "@rpath/usr/lib/libA/libA.dylib" the install name of the second rootless libraries is "@rpath/usr/lib/libB/libB.dylib"
1: libA.dylib link against libB.dylib with "@rpath/usr/lib/libB/libB.dylib" 2: add rpath "@loader_path/../../../" to libA.dylib
so the rpath does not need to contain any fixed path, and we can use the complete subpath of the library in the jb root directory for the install name. And this method is also officially supported by Apple.