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