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