#endif
+/* Define if your assembler supports DTPREL relocation. */
+#ifndef USED_FOR_TARGET
+#undef HAVE_AS_DTPREL_RELOC
+#endif
+
+
/* Define if your assembler supports dwarf2 .file/.loc directives, and
preserves file table indices exactly as given. */
#ifndef USED_FOR_TARGET
return DWARF_FRAME_REGISTERS;
}
+#if defined(HAVE_AS_TLS) && defined(HAVE_AS_DTPREL_RELOC)
+/* Implementation of TARGET_ASM_OUTPUT_DWARF_DTPREL. */
+static void
+aarch64_output_dwarf_dtprel (FILE *f, int size, rtx x)
+{
+ /* The AArch64 ABI defines static DTPREL relocations only for 8-byte (.xword)
+ DWARF entries. For any other size there is no valid dtprel(symbol)
+ encoding and rejecting the request. */
+ if (size != 8)
+ {
+ error ("unsupported size %d for DTPREL relocation, allowed: 8", size);
+ return;
+ }
+ fputs ("\t.xword\t", f);
+ fputs ("%dtprel(", f);
+ output_addr_const (f, x);
+ fputs (")", f);
+}
+#endif
+
/* Implement TARGET_DWARF_FRAME_REG_MODE. */
static machine_mode
aarch64_dwarf_frame_reg_mode (int regno)
#undef TARGET_DWARF_FRAME_REG_MODE
#define TARGET_DWARF_FRAME_REG_MODE aarch64_dwarf_frame_reg_mode
+#if defined(HAVE_AS_TLS) && defined(HAVE_AS_DTPREL_RELOC)
+#undef TARGET_ASM_OUTPUT_DWARF_DTPREL
+#define TARGET_ASM_OUTPUT_DWARF_DTPREL aarch64_output_dwarf_dtprel
+#endif
+
#undef TARGET_OUTPUT_CFI_DIRECTIVE
#define TARGET_OUTPUT_CFI_DIRECTIVE aarch64_output_cfi_directive
$as_echo "#define HAVE_AS_AEABI_BUILD_ATTRIBUTES 1" >>confdefs.h
+fi
+
+ # Check if we have binutils support for DTPREL relocation.
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking assembler for support of DTPREL relocation" >&5
+$as_echo_n "checking assembler for support of DTPREL relocation... " >&6; }
+if ${gcc_cv_as_aarch64_dtprel_relocation+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ gcc_cv_as_aarch64_dtprel_relocation=no
+ if test x"$gcc_cv_as" != x; then
+ $as_echo '
+ .xword %dtprel(expr)
+ ' > conftest.s
+ if { ac_try='$gcc_cv_as $gcc_cv_as_flags -o conftest.o conftest.s >&5'
+ { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }; }
+ then
+ gcc_cv_as_aarch64_dtprel_relocation=yes
+ else
+ echo "configure: failed program was" >&5
+ cat conftest.s >&5
+ fi
+ rm -f conftest.o conftest.s
+ fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gcc_cv_as_aarch64_dtprel_relocation" >&5
+$as_echo "$gcc_cv_as_aarch64_dtprel_relocation" >&6; }
+if test $gcc_cv_as_aarch64_dtprel_relocation = yes; then
+
+$as_echo "#define HAVE_AS_DTPREL_RELOC 1" >>confdefs.h
+
fi
# Enable Branch Target Identification Mechanism and Return Address
.aeabi_attribute Tag_Feature_GCS, 1
],,[AC_DEFINE(HAVE_AS_AEABI_BUILD_ATTRIBUTES, 1,
[Define if your assembler supports AEABI build attributes.])])
+ # Check if we have binutils support for DTPREL relocation.
+ gcc_GAS_CHECK_FEATURE([support of DTPREL relocation], gcc_cv_as_aarch64_dtprel_relocation,,
+ [
+ .xword %dtprel(expr)
+ ],,[AC_DEFINE(HAVE_AS_DTPREL_RELOC, 1,
+ [Define if your assembler supports DTPREL relocation.])])
# Enable Branch Target Identification Mechanism and Return Address
# Signing by default.
AC_ARG_ENABLE(standard-branch-protection,
--- /dev/null
+/* { dg-do compile } */
+/* { dg-require-effective-target aarch64_gas_has_dtprel_reloc } */
+/* { dg-options "-O0 -g" } */
+
+#include <stdio.h>
+
+__thread unsigned long rage = 1;
+__thread unsigned long ire = 2;
+
+void*
+increase_rage()
+{
+ ++rage;
+ ++ire;
+ printf ("Rage counter for: %lu/%lu\n", rage, ire);
+}
+
+int
+main ()
+{
+ increase_rage();
+ printf ("Rage counter %lu/%lu\n", rage, ire);
+}
+
+/* { dg-final { scan-assembler ".xword\t%dtprel\\(rage\\)" } } */
+/* { dg-final { scan-assembler ".xword\t%dtprel\\(ire\\)" } } */
}]
}
+# Return 1 if Gas supports DTPREL Relocation on AArch64 target
+proc check_effective_target_aarch64_gas_has_dtprel_reloc { } {
+ if { ![istarget aarch64*-*-*] || ![check_effective_target_tls_native] } {
+ return 0
+ }
+ return [check_no_compiler_messages aarch64_gas_has_dtprel_reloc object {
+ /* Assembly */
+ .xword %dtprel(expr)
+ }]
+}
+
# Create functions to check that the AArch64 assembler supports the
# various architecture extensions via the .arch_extension pseudo-op.