aarch64: Add an offset parameter to the movrel macro

With apple tools, the linker fails with errors like these, if the
offset is negative:

ld: in section __TEXT,__text reloc 8: symbol index out of range for architecture arm64

Signed-off-by: Martin Storsjö <martin@martin.st>
pull/258/head
Martin Storsjö 8 years ago
parent a4cfcddcb0
commit c44a8a3eab
  1. 14
      libavutil/aarch64/asm.S

@ -72,15 +72,21 @@ ELF .size \name, . - \name
\name: \name:
.endm .endm
.macro movrel rd, val .macro movrel rd, val, offset=0
#if CONFIG_PIC && defined(__APPLE__) #if CONFIG_PIC && defined(__APPLE__)
.if \offset < 0
adrp \rd, \val@PAGE adrp \rd, \val@PAGE
add \rd, \rd, \val@PAGEOFF add \rd, \rd, \val@PAGEOFF
sub \rd, \rd, -(\offset)
.else
adrp \rd, \val+(\offset)@PAGE
add \rd, \rd, \val+(\offset)@PAGEOFF
.endif
#elif CONFIG_PIC #elif CONFIG_PIC
adrp \rd, \val adrp \rd, \val+\offset
add \rd, \rd, :lo12:\val add \rd, \rd, :lo12:\val+\offset
#else #else
ldr \rd, =\val ldr \rd, =\val+\offset
#endif #endif
.endm .endm

Loading…
Cancel
Save