aarch64: Add parentheses around the offset parameter in movrel
[ffmpeg.git] / libavutil / aarch64 / asm.S
index 850f16b415b8d39440ae05dcdd52db61e636f740..86d36cd57fe2e0d28660cf40ef28b44eea7a76f8 100644 (file)
@@ -52,25 +52,41 @@ FUNC    .func   \name
     .endif
 .endm
 
-.macro  const   name, align=2
+.macro  const   name, align=2, relocate=0
     .macro endconst
 ELF     .size   \name, . - \name
         .purgem endconst
     .endm
+#if HAVE_SECTION_DATA_REL_RO
+.if \relocate
+        .section        .data.rel.ro
+.else
         .section        .rodata
+.endif
+#elif !defined(__MACH__)
+        .section        .rodata
+#else
+        .const_data
+#endif
         .align          \align
 \name:
 .endm
 
-.macro  movrel rd, val
+.macro  movrel rd, val, offset=0
 #if CONFIG_PIC && defined(__APPLE__)
+    .if \offset < 0
         adrp            \rd, \val@PAGE
         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
-        adrp            \rd, \val
-        add             \rd, \rd, :lo12:\val
+        adrp            \rd, \val+(\offset)
+        add             \rd, \rd, :lo12:\val+(\offset)
 #else
-        ldr             \rd, =\val
+        ldr             \rd, =\val+\offset
 #endif
 .endm