https://sourceware.org/bugzilla/show_bug.cgi?id=18009
Bug ID: 18009 Summary: LDR macro on arm can't generate relative address Product: binutils Version: 2.25 Status: NEW Severity: normal Priority: P2 Component: gas Assignee: unassigned at sourceware dot org Reporter: goswin-v-b at web dot de The arm assembly has a LDR macro to load constants: ldr r0, =symbol This works for symbols (or constants, but that isn't the use case I want) in the same file and section and also for symbols in other sections or files. For external symbols it generates an R_ARM_ABS32 linker reference in the next literals block and adds PC relative addressing to load that. One can also generate a R_ARM_REL32 linker reference writing 1: .word symbol - 1b This correctly stores the relative (to the 1 label) offset of the symbol and fills that in at link time (and generates a .rel.dyn entry for shared code). What does not work is writing 1: ldr r0, =(symbol - 1b) boot.S:49: Error: constant expression expected -- `ldr r0,=(symbol-1b)' this works fine with clangs internal assembler and should work here too. There seems to be no other way to add a R_ARM_REL32 linker reference to the literals block and load that into a register. An alternate this could be something like ldr r0, [pc, =symbol] -- You are receiving this mail because: You are on the CC list for the bug. _______________________________________________ bug-binutils mailing list bug-binutils@gnu.org https://lists.gnu.org/mailman/listinfo/bug-binutils