[llvm-dev] Prevent Instruction Fixup from using relocations

Joerg Sonnenberger via llvm-dev llvm-dev at lists.llvm.org
Thu Mar 11 06:59:23 PST 2021


On Thu, Mar 11, 2021 at 06:43:16PM +0800, Zhang via llvm-dev wrote:
> I'm trying to build a toy backend that produces code without
> relocation for my toy ELF loader.

The MC layer is not meant to produce ELF executables, but to produce ELF
relocatable object files. You are still supposed to run a linker on
them. As such, the MC layer will emit relocations for things like symbol
references (e.g. the name of a function) as it is the job of the linker
to resolve those. There are some complications like turning symbol
references into section references, but the same idea applies to those.

Joerg


More information about the llvm-dev mailing list