*unresolved_reloc_p = false;
break;
+ case BFD_RELOC_AARCH64_TLS_DTPREL:
+ if (input_section->flags & SEC_ALLOC)
+ return bfd_reloc_notsupported;
+ value -= dtpoff_base (info);
+ value += rel->r_addend;
+
+ bfd_put_64 (output_bfd, value, contents + rel->r_offset);
+
+ *unresolved_reloc_p = false;
+ break;
+
case BFD_RELOC_AARCH64_TLSDESC_OFF_G0_NC:
case BFD_RELOC_AARCH64_TLSDESC_OFF_G1:
if (globals->root.sgot == NULL)
{
struct reloc_table_entry *reloc;
+ /* Check for %dtprel(var) syntax */
+ if (*input_line_pointer == '%')
+ {
+ if (strncmp (input_line_pointer, "%dtprel(", 8) == 0)
+ {
+ input_line_pointer += 8;
+
+ expression (&exp);
+
+ /* Ensure we have a closing parenthesis */
+ if (*input_line_pointer == ')')
+ input_line_pointer++;
+ else
+ {
+ as_bad (_("missing ')' after %%dtprel"));
+ ignore_rest_of_line ();
+ return;
+ }
+
+ addressT where = frag_now_fix ();
+ fix_new_exp (frag_now, where, nbytes, &exp, 0,
+ BFD_RELOC_AARCH64_TLS_DTPREL);
+
+ char *dest = frag_more (nbytes);
+ memset (dest, 0, nbytes);
+ continue;
+ }
+
+ else
+ {
+ as_bad (_("unknown relocation operator"));
+ ignore_rest_of_line ();
+ return;
+ }
+ }
+
expression (&exp);
if (exp.X_op != O_symbol)
case BFD_RELOC_AARCH64_TLSLE_MOVW_TPREL_G1:
case BFD_RELOC_AARCH64_TLSLE_MOVW_TPREL_G1_NC:
case BFD_RELOC_AARCH64_TLSLE_MOVW_TPREL_G2:
+ case BFD_RELOC_AARCH64_TLS_DTPREL:
S_SET_THREAD_LOCAL (fixP->fx_addsy);
/* Should always be exported to object file, see
aarch64_force_relocation(). */
--- /dev/null
+#as:
+#objdump: -r
+#target: aarch64*-*-*
+
+#...
+RELOCATION RECORDS FOR \[\.debug_info\]:
+OFFSET +TYPE +VALUE
+0*0 R_AARCH64_TLS_DTPREL64 +var
+0*8 R_AARCH64_TLS_DTPREL64 +var\+0x0+1
+#...
--- /dev/null
+.section .tdata,"awT",@progbits
+.skip 8 // Force var to have an offset of 8
+.globl var
+var:
+ .word 0
+
+.section .debug_info,"",@progbits
+ .xword %dtprel(var), %dtprel(var+1)
run_dump_test "tls-relax-ld-le-small-ilp32"
run_dump_test "tls-relax-ld-le-tiny"
run_dump_test "tls-relax-ld-le-tiny-ilp32"
+run_dump_test "tls-debug"
run_dump_test "tls-desc-ie"
run_dump_test "tls-desc-ie-ilp32"
run_dump_test "tls-relax-gdesc-le-2"
--- /dev/null
+#source: tls-debug.s
+#ld: -shared -T relocs.ld -e0
+#objdump: -s -j .debug_info
+
+#...
+Contents of section .debug_info:
+#...
+ [0-9a-f]+ 08000000 00000000 09000000 00000000 .*
+#...
--- /dev/null
+.section .tdata,"awT",@progbits
+.skip 8 // Force var to have an offset of 8
+.globl var
+var:
+ .word 0
+
+.section .debug_info,"",@progbits
+ .xword %dtprel(var)
+ .xword %dtprel(var+1)