LLVM Discussion Forums

Options to bypass linker for single-object-file executables

Hi LLVM,

I’m curious about whether there are any readily available shortcuts I can take to generate an executable when all code is available in a single object file with no dependencies. In this case, syscalls are made without the C runtime using assembly routines. It strikes me that the linker has very little (none?) work to do except perhaps relocating sections and emitting the final formatted machine code in ELF/Dwarf/PE format.

Can I do this final step myself? What resources should I read about to go about this? My initial plan of attack was to sort of “reverse engineer” the process based on observing how the linker transforms smaller segments of code with objdump, but of course, an actual specification is preferable.

Thanks!