On Fri, 12 May 2017, David Miller wrote: > Internally, we have to emit some kind of relocation as GAS makes it's > first pass over the instructions.
Not really, you can defer that until the relaxation pass, e.g. to avoid figuring out what to do about forward local symbol references, especially in complex expressions that may eventually resolve to assembly constants. This is how MIPS16 assembly works for example, due to its dual regular vs extended instruction encoding, so that no artificial relocations had to be invented in GAS for the regular instructions, which never get relocations recorded against in an object file. Any instruction that ends up needing a relocation, if supported (not all encodings do), gets converted to the extended form in the relaxation pass and only then a suitable fixup is attached to it. Of course that may not matter for your specific case, but I think it's worth noting so as to avoid people getting misled about how GAS works. FWIW, Maciej