Open rsesek opened 2 years ago
@llvm/issue-subscribers-lld-macho
Yeah, this is a known deviation in behavior. See the commit message in https://reviews.llvm.org/D84714. Only thing really stopping us is implementation complexity. I've punted on it since the workaround (-headerpad
and -headerpad_max_install_names
like you mentioned) seem easy enough.
I guess the advantage of implementing #53549 is that we don't have to waste any space at all in the header...
I've noticed that Mach-O lld does not leave the same amount of padding in the output image as ld64, which means sometimes install_name_tool can fail. Small example:
dylib.c
exe.c
Then run the following commands (you may need to tweak
-isysroot
) using ld64:Then repeat with lld:
If you repeat the link of exe.c with
-Wl,-headerpad_max_install_names
then it succeeds.The repro also requires adding some other dependent dylibs so that the padding that lld does leave gets consumed.
I'm not sure this is a bug per se, or just an acceptable change in behavior. I actually think it'd be preferable to address issue #53549 rather than changing this.