[PATCH] AArch64 GAS: Reject nonzero GOT-entry relocation addends

Sivan Shani sivan.shani@arm.com
Tue Sep 8 14:30:17 GMT 2026


AAELF requires relocations using GDAT, GTLSIDX, GTPREL or GTLSDESC
operations to have a zero addend.

Add a common predicate for the affected BFD relocation codes.  Use it
in tc_gen_reloc to reject nonzero addends before PC-relative adjustment,
and in aarch64_fix_adjustable to preserve symbol identity.

Add LP64 and ILP32 tests covering rejected +1/-1 expressions and
accepted +0/-0 expressions for all relevant instruction mappings.
---
 gas/config/tc-aarch64.c                       |  73 +++++++++--
 .../gas/aarch64/reloc-got-addend-ilp32.d      |   5 +
 .../gas/aarch64/reloc-got-addend-ilp32.l      |  31 +++++
 .../gas/aarch64/reloc-got-addend-ilp32.s      |  79 ++++++++++++
 gas/testsuite/gas/aarch64/reloc-got-addend.d  |   5 +
 gas/testsuite/gas/aarch64/reloc-got-addend.l  |  49 ++++++++
 gas/testsuite/gas/aarch64/reloc-got-addend.s  | 115 ++++++++++++++++++
 7 files changed, 344 insertions(+), 13 deletions(-)
 create mode 100644 gas/testsuite/gas/aarch64/reloc-got-addend-ilp32.d
 create mode 100644 gas/testsuite/gas/aarch64/reloc-got-addend-ilp32.l
 create mode 100644 gas/testsuite/gas/aarch64/reloc-got-addend-ilp32.s
 create mode 100644 gas/testsuite/gas/aarch64/reloc-got-addend.d
 create mode 100644 gas/testsuite/gas/aarch64/reloc-got-addend.l
 create mode 100644 gas/testsuite/gas/aarch64/reloc-got-addend.s

diff --git a/gas/config/tc-aarch64.c b/gas/config/tc-aarch64.c
index c172bbb7527..fd16935d52a 100644
--- a/gas/config/tc-aarch64.c
+++ b/gas/config/tc-aarch64.c
@@ -3490,6 +3490,54 @@ find_reloc_table_entry (char **str)
   return NULL;
 }
 
+/* Return true if TYPE creates a GOT entry using one of the AAELF64
+   GDAT, GTLSIDX, GTPREL or GTLSDESC operations.  Such relocations must
+   preserve the identity of the referenced symbol and have a zero
+   addend.  */
+
+static bool
+aarch64_reloc_creates_got_entry_p (bfd_reloc_code_real_type type)
+{
+  switch (type)
+    {
+    case BFD_RELOC_AARCH64_ADR_GOT_PAGE:
+    case BFD_RELOC_AARCH64_GOT_LD_PREL19:
+    case BFD_RELOC_AARCH64_LD_GOT_LO12_NC:
+    case BFD_RELOC_AARCH64_LD32_GOT_LO12_NC:
+    case BFD_RELOC_AARCH64_LD32_GOTPAGE_LO14:
+    case BFD_RELOC_AARCH64_LD64_GOTOFF_LO15:
+    case BFD_RELOC_AARCH64_LD64_GOTPAGE_LO15:
+    case BFD_RELOC_AARCH64_LD64_GOT_LO12_NC:
+    case BFD_RELOC_AARCH64_MOVW_GOTOFF_G0_NC:
+    case BFD_RELOC_AARCH64_MOVW_GOTOFF_G1:
+    case BFD_RELOC_AARCH64_TLSDESC_ADD_LO12:
+    case BFD_RELOC_AARCH64_TLSDESC_ADR_PAGE21:
+    case BFD_RELOC_AARCH64_TLSDESC_ADR_PREL21:
+    case BFD_RELOC_AARCH64_TLSDESC_LD_LO12_NC:
+    case BFD_RELOC_AARCH64_TLSDESC_LD32_LO12_NC:
+    case BFD_RELOC_AARCH64_TLSDESC_LD64_LO12:
+    case BFD_RELOC_AARCH64_TLSDESC_LD_PREL19:
+    case BFD_RELOC_AARCH64_TLSDESC_OFF_G0_NC:
+    case BFD_RELOC_AARCH64_TLSDESC_OFF_G1:
+    case BFD_RELOC_AARCH64_TLSGD_ADD_LO12_NC:
+    case BFD_RELOC_AARCH64_TLSGD_ADR_PAGE21:
+    case BFD_RELOC_AARCH64_TLSGD_ADR_PREL21:
+    case BFD_RELOC_AARCH64_TLSGD_MOVW_G0_NC:
+    case BFD_RELOC_AARCH64_TLSGD_MOVW_G1:
+    case BFD_RELOC_AARCH64_TLSIE_ADR_GOTTPREL_PAGE21:
+    case BFD_RELOC_AARCH64_TLSIE_LD_GOTTPREL_LO12_NC:
+    case BFD_RELOC_AARCH64_TLSIE_LD32_GOTTPREL_LO12_NC:
+    case BFD_RELOC_AARCH64_TLSIE_LD64_GOTTPREL_LO12_NC:
+    case BFD_RELOC_AARCH64_TLSIE_LD_GOTTPREL_PREL19:
+    case BFD_RELOC_AARCH64_TLSIE_MOVW_GOTTPREL_G0_NC:
+    case BFD_RELOC_AARCH64_TLSIE_MOVW_GOTTPREL_G1:
+      return true;
+
+    default:
+      return false;
+    }
+}
+
 /* Returns 0 if the relocation should never be forced,
    1 if the relocation must be forced, and -1 if either
    result is OK.  */
@@ -10292,7 +10340,16 @@ arelent *
 tc_gen_reloc (asection * section, fixS * fixp)
 {
   arelent *reloc;
-  bfd_reloc_code_real_type code;
+  bfd_reloc_code_real_type code = fixp->fx_r_type;
+
+  /* Check the expression addend before adjusting PC-relative fixups.  */
+  if (aarch64_reloc_creates_got_entry_p (code) && fixp->fx_offset != 0)
+    {
+      as_bad_where (fixp->fx_file, fixp->fx_line,
+		    _("%s relocation does not support a non-zero addend"),
+		    bfd_get_reloc_code_name (code));
+      return NULL;
+    }
 
   reloc = notes_alloc (sizeof (arelent));
   reloc->sym_ptr_ptr = notes_alloc (sizeof (asymbol *));
@@ -10308,7 +10365,6 @@ tc_gen_reloc (asection * section, fixS * fixp)
     }
   reloc->addend = fixp->fx_offset;
 
-  code = fixp->fx_r_type;
   switch (code)
     {
     case BFD_RELOC_16:
@@ -10408,17 +10464,8 @@ aarch64_fix_adjustable (fixS *fixp)
   if (symbol_get_bfdsym (fixp->fx_addsy)->flags & BSF_FUNCTION)
     return false;
 
-  /* GOT relocations cannot have an offset or use section-relative symbols.  */
-  if (fixp->fx_r_type == BFD_RELOC_AARCH64_ADR_GOT_PAGE
-      || fixp->fx_r_type == BFD_RELOC_AARCH64_GOT_LD_PREL19
-      || fixp->fx_r_type == BFD_RELOC_AARCH64_LD_GOT_LO12_NC
-      || fixp->fx_r_type == BFD_RELOC_AARCH64_LD32_GOT_LO12_NC
-      || fixp->fx_r_type == BFD_RELOC_AARCH64_LD32_GOTPAGE_LO14
-      || fixp->fx_r_type == BFD_RELOC_AARCH64_LD64_GOTOFF_LO15
-      || fixp->fx_r_type == BFD_RELOC_AARCH64_LD64_GOTPAGE_LO15
-      || fixp->fx_r_type == BFD_RELOC_AARCH64_LD64_GOT_LO12_NC
-      || fixp->fx_r_type == BFD_RELOC_AARCH64_MOVW_GOTOFF_G0_NC
-      || fixp->fx_r_type == BFD_RELOC_AARCH64_MOVW_GOTOFF_G1)
+  /* GOT-entry relocations must retain the referenced symbol's identity.  */
+  if (aarch64_reloc_creates_got_entry_p (fixp->fx_r_type))
     return false;
 
   return true;
diff --git a/gas/testsuite/gas/aarch64/reloc-got-addend-ilp32.d b/gas/testsuite/gas/aarch64/reloc-got-addend-ilp32.d
new file mode 100644
index 00000000000..391024ab91c
--- /dev/null
+++ b/gas/testsuite/gas/aarch64/reloc-got-addend-ilp32.d
@@ -0,0 +1,5 @@
+#name: AArch64 ILP32 GOT-entry relocations require zero addends
+#as: -mabi=ilp32
+#error_output: reloc-got-addend-ilp32.l
+# This test is only valid on ELF based ports.
+#notarget: *-*-*coff *-*-pe *-*-wince *-*-*aout* *-*-netbsd
diff --git a/gas/testsuite/gas/aarch64/reloc-got-addend-ilp32.l b/gas/testsuite/gas/aarch64/reloc-got-addend-ilp32.l
new file mode 100644
index 00000000000..d2d719fba07
--- /dev/null
+++ b/gas/testsuite/gas/aarch64/reloc-got-addend-ilp32.l
@@ -0,0 +1,31 @@
+[^:]*: Assembler messages:
+.*: Error: BFD_RELOC_AARCH64_GOT_LD_PREL19 relocation does not support a non-zero addend
+.*: Error: BFD_RELOC_AARCH64_GOT_LD_PREL19 relocation does not support a non-zero addend
+.*: Error: BFD_RELOC_AARCH64_ADR_GOT_PAGE relocation does not support a non-zero addend
+.*: Error: BFD_RELOC_AARCH64_ADR_GOT_PAGE relocation does not support a non-zero addend
+.*: Error: BFD_RELOC_AARCH64_LD32_GOT_LO12_NC relocation does not support a non-zero addend
+.*: Error: BFD_RELOC_AARCH64_LD32_GOT_LO12_NC relocation does not support a non-zero addend
+.*: Error: BFD_RELOC_AARCH64_LD32_GOTPAGE_LO14 relocation does not support a non-zero addend
+.*: Error: BFD_RELOC_AARCH64_LD32_GOTPAGE_LO14 relocation does not support a non-zero addend
+.*: Error: BFD_RELOC_AARCH64_TLSGD_ADR_PREL21 relocation does not support a non-zero addend
+.*: Error: BFD_RELOC_AARCH64_TLSGD_ADR_PREL21 relocation does not support a non-zero addend
+.*: Error: BFD_RELOC_AARCH64_TLSGD_ADR_PAGE21 relocation does not support a non-zero addend
+.*: Error: BFD_RELOC_AARCH64_TLSGD_ADR_PAGE21 relocation does not support a non-zero addend
+.*: Error: BFD_RELOC_AARCH64_TLSGD_ADD_LO12_NC relocation does not support a non-zero addend
+.*: Error: BFD_RELOC_AARCH64_TLSGD_ADD_LO12_NC relocation does not support a non-zero addend
+.*: Error: BFD_RELOC_AARCH64_TLSIE_LD_GOTTPREL_PREL19 relocation does not support a non-zero addend
+.*: Error: BFD_RELOC_AARCH64_TLSIE_LD_GOTTPREL_PREL19 relocation does not support a non-zero addend
+.*: Error: BFD_RELOC_AARCH64_TLSIE_ADR_GOTTPREL_PAGE21 relocation does not support a non-zero addend
+.*: Error: BFD_RELOC_AARCH64_TLSIE_ADR_GOTTPREL_PAGE21 relocation does not support a non-zero addend
+.*: Error: BFD_RELOC_AARCH64_TLSIE_LD32_GOTTPREL_LO12_NC relocation does not support a non-zero addend
+.*: Error: BFD_RELOC_AARCH64_TLSIE_LD32_GOTTPREL_LO12_NC relocation does not support a non-zero addend
+.*: Error: BFD_RELOC_AARCH64_TLSDESC_LD_PREL19 relocation does not support a non-zero addend
+.*: Error: BFD_RELOC_AARCH64_TLSDESC_LD_PREL19 relocation does not support a non-zero addend
+.*: Error: BFD_RELOC_AARCH64_TLSDESC_ADR_PREL21 relocation does not support a non-zero addend
+.*: Error: BFD_RELOC_AARCH64_TLSDESC_ADR_PREL21 relocation does not support a non-zero addend
+.*: Error: BFD_RELOC_AARCH64_TLSDESC_ADR_PAGE21 relocation does not support a non-zero addend
+.*: Error: BFD_RELOC_AARCH64_TLSDESC_ADR_PAGE21 relocation does not support a non-zero addend
+.*: Error: BFD_RELOC_AARCH64_TLSDESC_LD32_LO12_NC relocation does not support a non-zero addend
+.*: Error: BFD_RELOC_AARCH64_TLSDESC_LD32_LO12_NC relocation does not support a non-zero addend
+.*: Error: BFD_RELOC_AARCH64_TLSDESC_ADD_LO12 relocation does not support a non-zero addend
+.*: Error: BFD_RELOC_AARCH64_TLSDESC_ADD_LO12 relocation does not support a non-zero addend
diff --git a/gas/testsuite/gas/aarch64/reloc-got-addend-ilp32.s b/gas/testsuite/gas/aarch64/reloc-got-addend-ilp32.s
new file mode 100644
index 00000000000..35715284d7a
--- /dev/null
+++ b/gas/testsuite/gas/aarch64/reloc-got-addend-ilp32.s
@@ -0,0 +1,79 @@
+	.text
+
+	/* GDAT relocations.  */
+	ldr	x0, :got:data+1
+	ldr	x0, :got:data-1
+	ldr	x0, :got:data+0
+	ldr	x0, :got:data-0
+	adrp	x0, :got:data+1
+	adrp	x0, :got:data-1
+	adrp	x0, :got:data+0
+	adrp	x0, :got:data-0
+	ldr	x0, [x0, #:got_lo12:data+1]
+	ldr	x0, [x0, #:got_lo12:data-1]
+	ldr	x0, [x0, #:got_lo12:data+0]
+	ldr	x0, [x0, #:got_lo12:data-0]
+	ldr	x0, [x0, #:gotpage_lo14:data+1]
+	ldr	x0, [x0, #:gotpage_lo14:data-1]
+	ldr	x0, [x0, #:gotpage_lo14:data+0]
+	ldr	x0, [x0, #:gotpage_lo14:data-0]
+
+	/* GTLSIDX relocations.  */
+	adr	x0, :tlsgd:tls+1
+	adr	x0, :tlsgd:tls-1
+	adr	x0, :tlsgd:tls+0
+	adr	x0, :tlsgd:tls-0
+	adrp	x0, :tlsgd:tls+1
+	adrp	x0, :tlsgd:tls-1
+	adrp	x0, :tlsgd:tls+0
+	adrp	x0, :tlsgd:tls-0
+	add	x0, x0, #:tlsgd_lo12:tls+1
+	add	x0, x0, #:tlsgd_lo12:tls-1
+	add	x0, x0, #:tlsgd_lo12:tls+0
+	add	x0, x0, #:tlsgd_lo12:tls-0
+
+	/* GTPREL relocations.  */
+	ldr	x0, :gottprel:tls+1
+	ldr	x0, :gottprel:tls-1
+	ldr	x0, :gottprel:tls+0
+	ldr	x0, :gottprel:tls-0
+	adrp	x0, :gottprel:tls+1
+	adrp	x0, :gottprel:tls-1
+	adrp	x0, :gottprel:tls+0
+	adrp	x0, :gottprel:tls-0
+	ldr	x0, [x0, #:gottprel_lo12:tls+1]
+	ldr	x0, [x0, #:gottprel_lo12:tls-1]
+	ldr	x0, [x0, #:gottprel_lo12:tls+0]
+	ldr	x0, [x0, #:gottprel_lo12:tls-0]
+
+	/* GTLSDESC relocations.  */
+	ldr	x0, :tlsdesc:tls+1
+	ldr	x0, :tlsdesc:tls-1
+	ldr	x0, :tlsdesc:tls+0
+	ldr	x0, :tlsdesc:tls-0
+	adr	x0, :tlsdesc:tls+1
+	adr	x0, :tlsdesc:tls-1
+	adr	x0, :tlsdesc:tls+0
+	adr	x0, :tlsdesc:tls-0
+	adrp	x0, :tlsdesc:tls+1
+	adrp	x0, :tlsdesc:tls-1
+	adrp	x0, :tlsdesc:tls+0
+	adrp	x0, :tlsdesc:tls-0
+	ldr	x0, [x0, #:tlsdesc_lo12:tls+1]
+	ldr	x0, [x0, #:tlsdesc_lo12:tls-1]
+	ldr	x0, [x0, #:tlsdesc_lo12:tls+0]
+	ldr	x0, [x0, #:tlsdesc_lo12:tls-0]
+	add	x0, x0, #:tlsdesc_lo12:tls+1
+	add	x0, x0, #:tlsdesc_lo12:tls-1
+	add	x0, x0, #:tlsdesc_lo12:tls+0
+	add	x0, x0, #:tlsdesc_lo12:tls-0
+
+	.data
+	.space	4
+data:
+	.word	0
+
+	.section .tdata, "awT", @progbits
+	.space	4
+tls:
+	.word	0
diff --git a/gas/testsuite/gas/aarch64/reloc-got-addend.d b/gas/testsuite/gas/aarch64/reloc-got-addend.d
new file mode 100644
index 00000000000..f817f0e8527
--- /dev/null
+++ b/gas/testsuite/gas/aarch64/reloc-got-addend.d
@@ -0,0 +1,5 @@
+#name: AArch64 GOT-entry relocations require zero addends
+#as: -mabi=lp64
+#error_output: reloc-got-addend.l
+# This test is only valid on ELF based ports.
+#notarget: *-*-*coff *-*-pe *-*-wince *-*-*aout* *-*-netbsd
diff --git a/gas/testsuite/gas/aarch64/reloc-got-addend.l b/gas/testsuite/gas/aarch64/reloc-got-addend.l
new file mode 100644
index 00000000000..d0f83b76bcb
--- /dev/null
+++ b/gas/testsuite/gas/aarch64/reloc-got-addend.l
@@ -0,0 +1,49 @@
+[^:]*: Assembler messages:
+.*: Error: BFD_RELOC_AARCH64_GOT_LD_PREL19 relocation does not support a non-zero addend
+.*: Error: BFD_RELOC_AARCH64_GOT_LD_PREL19 relocation does not support a non-zero addend
+.*: Error: BFD_RELOC_AARCH64_ADR_GOT_PAGE relocation does not support a non-zero addend
+.*: Error: BFD_RELOC_AARCH64_ADR_GOT_PAGE relocation does not support a non-zero addend
+.*: Error: BFD_RELOC_AARCH64_LD64_GOT_LO12_NC relocation does not support a non-zero addend
+.*: Error: BFD_RELOC_AARCH64_LD64_GOT_LO12_NC relocation does not support a non-zero addend
+.*: Error: BFD_RELOC_AARCH64_MOVW_GOTOFF_G0_NC relocation does not support a non-zero addend
+.*: Error: BFD_RELOC_AARCH64_MOVW_GOTOFF_G0_NC relocation does not support a non-zero addend
+.*: Error: BFD_RELOC_AARCH64_MOVW_GOTOFF_G1 relocation does not support a non-zero addend
+.*: Error: BFD_RELOC_AARCH64_MOVW_GOTOFF_G1 relocation does not support a non-zero addend
+.*: Error: BFD_RELOC_AARCH64_LD64_GOTOFF_LO15 relocation does not support a non-zero addend
+.*: Error: BFD_RELOC_AARCH64_LD64_GOTOFF_LO15 relocation does not support a non-zero addend
+.*: Error: BFD_RELOC_AARCH64_LD64_GOTPAGE_LO15 relocation does not support a non-zero addend
+.*: Error: BFD_RELOC_AARCH64_LD64_GOTPAGE_LO15 relocation does not support a non-zero addend
+.*: Error: BFD_RELOC_AARCH64_TLSGD_ADR_PREL21 relocation does not support a non-zero addend
+.*: Error: BFD_RELOC_AARCH64_TLSGD_ADR_PREL21 relocation does not support a non-zero addend
+.*: Error: BFD_RELOC_AARCH64_TLSGD_ADR_PAGE21 relocation does not support a non-zero addend
+.*: Error: BFD_RELOC_AARCH64_TLSGD_ADR_PAGE21 relocation does not support a non-zero addend
+.*: Error: BFD_RELOC_AARCH64_TLSGD_ADD_LO12_NC relocation does not support a non-zero addend
+.*: Error: BFD_RELOC_AARCH64_TLSGD_ADD_LO12_NC relocation does not support a non-zero addend
+.*: Error: BFD_RELOC_AARCH64_TLSGD_MOVW_G0_NC relocation does not support a non-zero addend
+.*: Error: BFD_RELOC_AARCH64_TLSGD_MOVW_G0_NC relocation does not support a non-zero addend
+.*: Error: BFD_RELOC_AARCH64_TLSGD_MOVW_G1 relocation does not support a non-zero addend
+.*: Error: BFD_RELOC_AARCH64_TLSGD_MOVW_G1 relocation does not support a non-zero addend
+.*: Error: BFD_RELOC_AARCH64_TLSIE_LD_GOTTPREL_PREL19 relocation does not support a non-zero addend
+.*: Error: BFD_RELOC_AARCH64_TLSIE_LD_GOTTPREL_PREL19 relocation does not support a non-zero addend
+.*: Error: BFD_RELOC_AARCH64_TLSIE_ADR_GOTTPREL_PAGE21 relocation does not support a non-zero addend
+.*: Error: BFD_RELOC_AARCH64_TLSIE_ADR_GOTTPREL_PAGE21 relocation does not support a non-zero addend
+.*: Error: BFD_RELOC_AARCH64_TLSIE_LD64_GOTTPREL_LO12_NC relocation does not support a non-zero addend
+.*: Error: BFD_RELOC_AARCH64_TLSIE_LD64_GOTTPREL_LO12_NC relocation does not support a non-zero addend
+.*: Error: BFD_RELOC_AARCH64_TLSIE_MOVW_GOTTPREL_G0_NC relocation does not support a non-zero addend
+.*: Error: BFD_RELOC_AARCH64_TLSIE_MOVW_GOTTPREL_G0_NC relocation does not support a non-zero addend
+.*: Error: BFD_RELOC_AARCH64_TLSIE_MOVW_GOTTPREL_G1 relocation does not support a non-zero addend
+.*: Error: BFD_RELOC_AARCH64_TLSIE_MOVW_GOTTPREL_G1 relocation does not support a non-zero addend
+.*: Error: BFD_RELOC_AARCH64_TLSDESC_LD_PREL19 relocation does not support a non-zero addend
+.*: Error: BFD_RELOC_AARCH64_TLSDESC_LD_PREL19 relocation does not support a non-zero addend
+.*: Error: BFD_RELOC_AARCH64_TLSDESC_ADR_PREL21 relocation does not support a non-zero addend
+.*: Error: BFD_RELOC_AARCH64_TLSDESC_ADR_PREL21 relocation does not support a non-zero addend
+.*: Error: BFD_RELOC_AARCH64_TLSDESC_ADR_PAGE21 relocation does not support a non-zero addend
+.*: Error: BFD_RELOC_AARCH64_TLSDESC_ADR_PAGE21 relocation does not support a non-zero addend
+.*: Error: BFD_RELOC_AARCH64_TLSDESC_LD64_LO12 relocation does not support a non-zero addend
+.*: Error: BFD_RELOC_AARCH64_TLSDESC_LD64_LO12 relocation does not support a non-zero addend
+.*: Error: BFD_RELOC_AARCH64_TLSDESC_ADD_LO12 relocation does not support a non-zero addend
+.*: Error: BFD_RELOC_AARCH64_TLSDESC_ADD_LO12 relocation does not support a non-zero addend
+.*: Error: BFD_RELOC_AARCH64_TLSDESC_OFF_G0_NC relocation does not support a non-zero addend
+.*: Error: BFD_RELOC_AARCH64_TLSDESC_OFF_G0_NC relocation does not support a non-zero addend
+.*: Error: BFD_RELOC_AARCH64_TLSDESC_OFF_G1 relocation does not support a non-zero addend
+.*: Error: BFD_RELOC_AARCH64_TLSDESC_OFF_G1 relocation does not support a non-zero addend
diff --git a/gas/testsuite/gas/aarch64/reloc-got-addend.s b/gas/testsuite/gas/aarch64/reloc-got-addend.s
new file mode 100644
index 00000000000..3acbca736aa
--- /dev/null
+++ b/gas/testsuite/gas/aarch64/reloc-got-addend.s
@@ -0,0 +1,115 @@
+	.text
+
+	/* GDAT relocations.  */
+	ldr	x0, :got:data+1
+	ldr	x0, :got:data-1
+	ldr	x0, :got:data+0
+	ldr	x0, :got:data-0
+	adrp	x0, :got:data+1
+	adrp	x0, :got:data-1
+	adrp	x0, :got:data+0
+	adrp	x0, :got:data-0
+	ldr	x0, [x0, #:got_lo12:data+1]
+	ldr	x0, [x0, #:got_lo12:data-1]
+	ldr	x0, [x0, #:got_lo12:data+0]
+	ldr	x0, [x0, #:got_lo12:data-0]
+	movk	x0, #:gotoff_g0_nc:data+1
+	movk	x0, #:gotoff_g0_nc:data-1
+	movk	x0, #:gotoff_g0_nc:data+0
+	movk	x0, #:gotoff_g0_nc:data-0
+	movz	x0, #:gotoff_g1:data+1
+	movz	x0, #:gotoff_g1:data-1
+	movz	x0, #:gotoff_g1:data+0
+	movz	x0, #:gotoff_g1:data-0
+	ldr	x0, [x0, #:gotoff_lo15:data+1]
+	ldr	x0, [x0, #:gotoff_lo15:data-1]
+	ldr	x0, [x0, #:gotoff_lo15:data+0]
+	ldr	x0, [x0, #:gotoff_lo15:data-0]
+	ldr	x0, [x0, #:gotpage_lo15:data+1]
+	ldr	x0, [x0, #:gotpage_lo15:data-1]
+	ldr	x0, [x0, #:gotpage_lo15:data+0]
+	ldr	x0, [x0, #:gotpage_lo15:data-0]
+
+	/* GTLSIDX relocations.  */
+	adr	x0, :tlsgd:tls+1
+	adr	x0, :tlsgd:tls-1
+	adr	x0, :tlsgd:tls+0
+	adr	x0, :tlsgd:tls-0
+	adrp	x0, :tlsgd:tls+1
+	adrp	x0, :tlsgd:tls-1
+	adrp	x0, :tlsgd:tls+0
+	adrp	x0, :tlsgd:tls-0
+	add	x0, x0, #:tlsgd_lo12:tls+1
+	add	x0, x0, #:tlsgd_lo12:tls-1
+	add	x0, x0, #:tlsgd_lo12:tls+0
+	add	x0, x0, #:tlsgd_lo12:tls-0
+	movk	x0, #:tlsgd_g0_nc:tls+1
+	movk	x0, #:tlsgd_g0_nc:tls-1
+	movk	x0, #:tlsgd_g0_nc:tls+0
+	movk	x0, #:tlsgd_g0_nc:tls-0
+	movz	x0, #:tlsgd_g1:tls+1
+	movz	x0, #:tlsgd_g1:tls-1
+	movz	x0, #:tlsgd_g1:tls+0
+	movz	x0, #:tlsgd_g1:tls-0
+
+	/* GTPREL relocations.  */
+	ldr	x0, :gottprel:tls+1
+	ldr	x0, :gottprel:tls-1
+	ldr	x0, :gottprel:tls+0
+	ldr	x0, :gottprel:tls-0
+	adrp	x0, :gottprel:tls+1
+	adrp	x0, :gottprel:tls-1
+	adrp	x0, :gottprel:tls+0
+	adrp	x0, :gottprel:tls-0
+	ldr	x0, [x0, #:gottprel_lo12:tls+1]
+	ldr	x0, [x0, #:gottprel_lo12:tls-1]
+	ldr	x0, [x0, #:gottprel_lo12:tls+0]
+	ldr	x0, [x0, #:gottprel_lo12:tls-0]
+	movk	x0, #:gottprel_g0_nc:tls+1
+	movk	x0, #:gottprel_g0_nc:tls-1
+	movk	x0, #:gottprel_g0_nc:tls+0
+	movk	x0, #:gottprel_g0_nc:tls-0
+	movz	x0, #:gottprel_g1:tls+1
+	movz	x0, #:gottprel_g1:tls-1
+	movz	x0, #:gottprel_g1:tls+0
+	movz	x0, #:gottprel_g1:tls-0
+
+	/* GTLSDESC relocations.  */
+	ldr	x0, :tlsdesc:tls+1
+	ldr	x0, :tlsdesc:tls-1
+	ldr	x0, :tlsdesc:tls+0
+	ldr	x0, :tlsdesc:tls-0
+	adr	x0, :tlsdesc:tls+1
+	adr	x0, :tlsdesc:tls-1
+	adr	x0, :tlsdesc:tls+0
+	adr	x0, :tlsdesc:tls-0
+	adrp	x0, :tlsdesc:tls+1
+	adrp	x0, :tlsdesc:tls-1
+	adrp	x0, :tlsdesc:tls+0
+	adrp	x0, :tlsdesc:tls-0
+	ldr	x0, [x0, #:tlsdesc_lo12:tls+1]
+	ldr	x0, [x0, #:tlsdesc_lo12:tls-1]
+	ldr	x0, [x0, #:tlsdesc_lo12:tls+0]
+	ldr	x0, [x0, #:tlsdesc_lo12:tls-0]
+	add	x0, x0, #:tlsdesc_lo12:tls+1
+	add	x0, x0, #:tlsdesc_lo12:tls-1
+	add	x0, x0, #:tlsdesc_lo12:tls+0
+	add	x0, x0, #:tlsdesc_lo12:tls-0
+	movk	x0, #:tlsdesc_off_g0_nc:tls+1
+	movk	x0, #:tlsdesc_off_g0_nc:tls-1
+	movk	x0, #:tlsdesc_off_g0_nc:tls+0
+	movk	x0, #:tlsdesc_off_g0_nc:tls-0
+	movz	x0, #:tlsdesc_off_g1:tls+1
+	movz	x0, #:tlsdesc_off_g1:tls-1
+	movz	x0, #:tlsdesc_off_g1:tls+0
+	movz	x0, #:tlsdesc_off_g1:tls-0
+
+	.data
+	.space	8
+data:
+	.xword	0
+
+	.section .tdata, "awT", @progbits
+	.space	8
+tls:
+	.xword	0
-- 
2.43.0



More information about the Binutils mailing list