-
-
Notifications
You must be signed in to change notification settings - Fork 225
I cannot compile with my linux-arm-musl toolchain with lto enabled. #1146
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
base: main
Are you sure you want to change the base?
Conversation
I get: ../arm-linux-musleabihf/bin/ld: DWARF error: can't find .debug_ranges section. /tmp/ccEOssxO.ltrans0.ltrans.o: in function `frida_try_load_libc_and_raise': <artificial>:(.text+0x13b4): undefined reference to `memcpy' /home/user/dev/blog/frida-musl/cross/install/bin/../lib/gcc/arm-linux-musleabihf/14.2.0/../../../../arm-linux-musleabihf/bin/ld: <artificial>:(.text+0x14dc): undefined reference to `memcpy' I tried a few things, and it's strange why there is a ref to memcpy. However excluding lto works. It appears that the footprint is not largely affected. I'll let Ole decide if this is for consideration I do see that Ole said in another commit that armhf-musl will be included in CI; out of curiosity, which toolchain are you guys using for 32-bit armhf-musl?
Did you rebuild the Frida SDK for armhf-musl using your toolchain? If not you should, to avoid compatibility issues when mixing prebuilt object files with those built by your toolchain. You can grab our toolchain from the GitHub container registry here. If you want to tweak it/build it yourself, you can use our crosstool-NG config together with our crosstool-ng "fork". |
Thanks for replying. However, I somehow totally missed the fact that you have cross-tool repos (lots of repos....). FYI, I have used my own builds with https://github.com/firasuke/mussel and https://github.com/richfelker/musl-cross-make. Since musl is incompatible between 1.1.x and 1.2.x series, I wanted control over which musl version to use, as I target older musl, and I want Frida to be be compatible with system libc.so. I will roll my own toolchain using your CT script and see if it works. Currently I target ARMv6, which is another reason for custom build. Also, I will try out if your CT build removes a really annoying hack in the injection stuff, I seem to need (the mmap pivot fails...). If still present, I might circle back to you regarding this. Thanks! |
Hello Ole,
I do notice that the default linker is still 'ld'; 'gold' is just built and included should the user want to swap. However, I ran into the same LTO issue when rebuilding the helpers: the memcpy linkage thing. In fact, I ran into the other thing in the injector functionality as well; like this
My full patch file is below (for 16.6.6). I know that the header file inclusion is already fixed in 'main' branch. The pivot into mmap doesn't work right (on arm or musl?), so I force it to the backup method of overwriting a chunk of code in the target process. My arm musl patch as of now:
|
Dependency on |
I get:
../arm-linux-musleabihf/bin/ld: DWARF error: can't find .debug_ranges section. /tmp/ccEOssxO.ltrans0.ltrans.o: in function
frida_try_load_libc_and_raise': <artificial>:(.text+0x13b4): undefined reference to
memcpy' /home/user/dev/blog/frida-musl/cross/install/bin/../lib/gcc/arm-linux-musleabihf/14.2.0/../../../../arm-linux-musleabihf/bin/ld: :(.text+0x14dc): undefined reference to `memcpy'I tried a few things, and it's strange why there is a ref to memcpy. However excluding lto works. It appears that the footprint is not largely affected. I'll let Ole decide if this is for consideration
I do see that Ole said in another commit that armhf-musl will be included in CI; out of curiosity, which toolchain are you guys using for 32-bit armhf-musl?