|
|
22033d |
2016-12-14 Wilco Dijkstra <wdijkstr@arm.com>
|
|
|
22033d |
Jakub Jelinek <jakub@redhat.com>
|
|
|
22033d |
|
|
|
22033d |
PR target/78796
|
|
|
22033d |
* config/aarch64/aarch64.c (aarch64_classify_symbol): Merge large
|
|
|
22033d |
model checks into switch.
|
|
|
22033d |
|
|
|
22033d |
* gcc.dg/tls/pr78796.c: New test.
|
|
|
22033d |
|
|
|
22033d |
--- gcc/config/aarch64/aarch64.c (revision 243645)
|
|
|
22033d |
+++ gcc/config/aarch64/aarch64.c (revision 243646)
|
|
|
22033d |
@@ -4986,6 +4986,9 @@ aarch64_classify_symbol (rtx x,
|
|
|
22033d |
switch (aarch64_cmodel)
|
|
|
22033d |
{
|
|
|
22033d |
case AARCH64_CMODEL_LARGE:
|
|
|
22033d |
+ if (aarch64_tls_symbol_p (x))
|
|
|
22033d |
+ return aarch64_classify_tls_symbol (x);
|
|
|
22033d |
+
|
|
|
22033d |
return SYMBOL_FORCE_TO_MEM;
|
|
|
22033d |
|
|
|
22033d |
case AARCH64_CMODEL_TINY:
|
|
|
22033d |
--- gcc/testsuite/gcc.dg/tls/pr78796.c (nonexistent)
|
|
|
22033d |
+++ gcc/testsuite/gcc.dg/tls/pr78796.c (revision 243646)
|
|
|
22033d |
@@ -0,0 +1,32 @@
|
|
|
22033d |
+/* PR target/78796 */
|
|
|
22033d |
+/* { dg-do run } */
|
|
|
22033d |
+/* { dg-options "-O2" } */
|
|
|
22033d |
+/* { dg-additional-options "-mcmodel=large" { target aarch64-*-* } } */
|
|
|
22033d |
+/* { dg-require-effective-target tls } */
|
|
|
22033d |
+
|
|
|
22033d |
+struct S { int a, b, c, d, e; };
|
|
|
22033d |
+struct S t;
|
|
|
22033d |
+__thread struct S s;
|
|
|
22033d |
+
|
|
|
22033d |
+__attribute__((used, noinline, noclone)) void
|
|
|
22033d |
+foo (int *x, int *y)
|
|
|
22033d |
+{
|
|
|
22033d |
+ asm volatile ("" : : "g" (x), "g" (y) : "memory");
|
|
|
22033d |
+ if (*x != 1 || *y != 2)
|
|
|
22033d |
+ __builtin_abort ();
|
|
|
22033d |
+}
|
|
|
22033d |
+
|
|
|
22033d |
+__attribute__((used, noinline, noclone)) void
|
|
|
22033d |
+bar (void)
|
|
|
22033d |
+{
|
|
|
22033d |
+ foo (&t.c, &s.c);
|
|
|
22033d |
+}
|
|
|
22033d |
+
|
|
|
22033d |
+int
|
|
|
22033d |
+main ()
|
|
|
22033d |
+{
|
|
|
22033d |
+ t.c = 1;
|
|
|
22033d |
+ s.c = 2;
|
|
|
22033d |
+ bar ();
|
|
|
22033d |
+ return 0;
|
|
|
22033d |
+}
|