larmel / lacc

A simple, self-hosting C compiler
MIT License
872 stars 64 forks source link

ld.lld: error: bin/bootstrap/abi.o: unsupported relocation reference #8

Closed ibara closed 5 years ago

ibara commented 6 years ago

Hi --

lacc is unable to build itself when the linker is lld, the LLVM linker. When running make bin/selfhost/lacc, the bootstrap lacc builds and links fine. When the bootstrap lacc tries to build lacc, lld gives the complaint seen in the title of this issue report.

Both GNU ld and GNU gold happily link the selfhosted lacc so this seems to be something unique to lld.

larmel commented 5 years ago

This error was caused by relocation sections being placed before their targets (f.ex .rela.text before .text). Turns out lld is more pedantic than gnu linker, so I fixed some more issues as well before it stopped complaining. Should work now.

Thanks for reporting this. Using lld was very useful to validate the generated object files.

ibara commented 5 years ago

Great! Can confirm that lld can now link the selfhost lacc here too.