From e397febfb88c6cb7f72069057a7b8b12c5dfca06 Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Wed, 14 Dec 2016 11:39:36 +0100 Subject: [PATCH] re PR target/78796 (TLS fails to link on aarch64 with -mcmodel=large) PR target/78796 * gcc.dg/tls/pr78796.c: New test. From-SVN: r243645 --- gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gcc.dg/tls/pr78796.c | 32 ++++++++++++++++++++++++++++++ 2 files changed, 37 insertions(+) create mode 100644 gcc/testsuite/gcc.dg/tls/pr78796.c diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 1d1b0346056..ba535647648 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2016-12-14 Jakub Jelinek + + PR target/78796 + * gcc.dg/tls/pr78796.c: New test. + 2016-12-14 Richard Biener PR tree-optimization/78731 diff --git a/gcc/testsuite/gcc.dg/tls/pr78796.c b/gcc/testsuite/gcc.dg/tls/pr78796.c new file mode 100644 index 00000000000..12263da9bb4 --- /dev/null +++ b/gcc/testsuite/gcc.dg/tls/pr78796.c @@ -0,0 +1,32 @@ +/* PR target/78796 */ +/* { dg-do run } */ +/* { dg-options "-O2" } */ +/* { dg-additional-options "-mcmodel=large" { target aarch64-*-* } } */ +/* { dg-require-effective-target tls } */ + +struct S { int a, b, c, d, e; }; +struct S t; +__thread struct S s; + +__attribute__((used, noinline, noclone)) void +foo (int *x, int *y) +{ + asm volatile ("" : : "g" (x), "g" (y) : "memory"); + if (*x != 1 || *y != 2) + __builtin_abort (); +} + +__attribute__((used, noinline, noclone)) void +bar (void) +{ + foo (&t.c, &s.c); +} + +int +main () +{ + t.c = 1; + s.c = 2; + bar (); + return 0; +} -- 2.30.2