I’m trying to build a toy backend that produces code without relocation for my toy ELF loader. For now, my InstructionSelection works as intended and for MCInstLowering, I just lower MO_GlobalAddress operands with the following code:
However the backend still tries to use relocation even when I’ve set RelocationModel to Reloc::Static. Further debugging shows that in MCAssembler::evaluateFixup, which in turn calls MCExpr::evaluateAsRelocatableImpl, the evaluation failed due to the MCSymbol is not variable.
That’s where I’m lost with what does variable MCSymbol means, where does it come from and what should I do to fix it. Any help would be appreciated.