Open nike4613 opened 1 year ago
@llvm/issue-subscribers-lld-macho
This boils down to nasm encoding unwind info quite differently from llvm-mc. Not handling it is definitely a shortcoming on LLD's side, but adding support for this will require quite a bit of rewriting that I'm not available to do now. Sorry about that. Porting the assembler inputs from nasm to llvm-mc is probably your best bet here if you wish to use LLD.
We ended up creating patches for both NASM and LLD, which gives us sane output: The LLD patch The NASM patch
The person who created those patches (@Popax21) noted that particularly the LLVM patch is very hacky and likely incorrect, but sufficient for our purposes.
This issue also occurs using the same command line on Windows:
To reproduce:
nasm -f macho64 -Ox exhelper_macos_x86_64.asm -o exhelper_macos_x86_64.o
llvm-objcopy -x exhelper_macos_x86_64.o exhelper_macos.o
ld64.lld -dylib -arch x86_64 -platform_version macos 10.6 10.6 -x -o exhelper_macos_x86_64.dylib exhelper_macos.o