Skip to content

Commit e64d3e2

Browse files
committed
Tell armv7l assembler this is a constant
Because armv7 opcodes are only 32 bits, `mov` can only move immediates that are 8 bits or less. There's some wiggle room with shifting and whatnot, but in full generality you need to actually perform a load from a memory address. The assembler will insert the immediate into a literal pool, but that pool has to be <4KB away from the current `pc` at the time of load, so we add `.ltorg` to flush the literal pool at the end of every function.
1 parent 319f2c7 commit e64d3e2

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/trampolines/trampolines_arm.S

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,15 @@
66
.cfi_startproc; \
77
MANGLE(UNDERSCORE(name))##:; \
88
ldr ip, CONCAT(.L,NAMEADDR(name)); \
9-
mov r12, SYMBOL_IDX(idx); \
9+
ldr r12,=#SYMBOL_IDX(idx); \
1010
CONCAT(.L,MANGLE(UNDERSCORE(name))): ;\
1111
add ip, pc, ip; \
1212
ldr pc, [ip]; \
1313
.align 2; \
1414
CONCAT(.L,NAMEADDR(name))##: ; \
1515
.word NAMEADDR(name)##-(CONCAT(.L,MANGLE(UNDERSCORE(name))) + 8); \
1616
.cfi_endproc; \
17+
.ltorg; \
1718

1819
// Generate both `dgemm_` and `dgemm_64_`
1920
#include "ilp64_doubling.h"

0 commit comments

Comments
 (0)