diff mbox series

[testsuite] cope with rtems implicit -ftls-model=local-exec

Message ID or34qbg9mj.fsf@lxoliva.fsfla.org
State New
Headers show
Series [testsuite] cope with rtems implicit -ftls-model=local-exec | expand

Commit Message

Alexandre Oliva May 21, 2024, 2:51 a.m. UTC
gcc/config/rtems.h's OS_CC1_SPEC changes the -ftls-model default to
local-exec, which breaks some tests that compile with PIC and thus
expect dynamic TLS access models.

I assume the default overriding even with PIC is intended, so I'm
adjusting the testcases.

For those in gcc.dg/tls, I adjusted the ipa dump expectations, so that
they check for tls-local- only, which covers both -dynamic and -exec.

For those in g{cc,++}.target/aarch64/sve, I've added a -ftls-local
overrider, so that the expected opcodes for dynamic TLS are generated.

Regstrapped on x86_64-linux-gnu.  Also tested with gcc-13 targeting
aarch64-rtems6.  Ok to install?


for  gcc/testsuite/ChangeLog

	* gcc.dg/tls/vis-attr-hidden.c: Match tls-local- for both
	-dynamic and -exec.  Note rtems's default.
	* gcc.dg/tls/vis-flag-hidden.c: Likewise.
	* gcc.dg/tls/vis-pragma-hidden.c: Likewise.
	* gcc.target/aarch64/sve/tls_1.c: Override -ftls-model default
	on rtems.
	* gcc.target/aarch64/sve/tls_preserve_2.c: Likewise.
	* gcc.target/aarch64/sve/tls_preserve_3.c: Likewise.
	* g++.target/aarch64/sve/tls_2.C: Likewise.
---
 gcc/testsuite/g++.target/aarch64/sve/tls_2.C       |    1 +
 gcc/testsuite/gcc.dg/tls/vis-attr-hidden.c         |    3 ++-
 gcc/testsuite/gcc.dg/tls/vis-flag-hidden.c         |    3 ++-
 gcc/testsuite/gcc.dg/tls/vis-pragma-hidden.c       |    3 ++-
 gcc/testsuite/gcc.target/aarch64/sve/tls_1.c       |    1 +
 .../gcc.target/aarch64/sve/tls_preserve_2.c        |    1 +
 .../gcc.target/aarch64/sve/tls_preserve_3.c        |    1 +
 7 files changed, 10 insertions(+), 3 deletions(-)
diff mbox series

Patch

diff --git a/gcc/testsuite/g++.target/aarch64/sve/tls_2.C b/gcc/testsuite/g++.target/aarch64/sve/tls_2.C
index a1a2c85e59106..23004d9984d5f 100644
--- a/gcc/testsuite/g++.target/aarch64/sve/tls_2.C
+++ b/gcc/testsuite/g++.target/aarch64/sve/tls_2.C
@@ -2,6 +2,7 @@ 
 /* { dg-require-effective-target tls } */
 /* { dg-options "-O2 -fPIC -msve-vector-bits=256" } */
 /* { dg-require-effective-target fpic } */
+/* { dg-additional-options "-ftls-model=global-dynamic" { target *-*-rtems* } } */
 
 #include <stdint.h>
 
diff --git a/gcc/testsuite/gcc.dg/tls/vis-attr-hidden.c b/gcc/testsuite/gcc.dg/tls/vis-attr-hidden.c
index 0d43fc565b090..007d382fa9a0a 100644
--- a/gcc/testsuite/gcc.dg/tls/vis-attr-hidden.c
+++ b/gcc/testsuite/gcc.dg/tls/vis-attr-hidden.c
@@ -9,4 +9,5 @@  __thread int x;
 
 void reference() { x++; }
 
-/* { dg-final { scan-ipa-dump "Varpool flags: tls-local-dynamic" "whole-program" } } */
+/* rtems defaults to local-exec, others should get local-dynamic.  */
+/* { dg-final { scan-ipa-dump "Varpool flags: tls-local-" "whole-program" } } */
diff --git a/gcc/testsuite/gcc.dg/tls/vis-flag-hidden.c b/gcc/testsuite/gcc.dg/tls/vis-flag-hidden.c
index a15df092d4d0c..baf248dc3babc 100644
--- a/gcc/testsuite/gcc.dg/tls/vis-flag-hidden.c
+++ b/gcc/testsuite/gcc.dg/tls/vis-flag-hidden.c
@@ -9,4 +9,5 @@  __thread int x;
 
 void reference() { x++; }
 
-/* { dg-final { scan-ipa-dump "Varpool flags: tls-local-dynamic" "whole-program" } } */
+/* rtems defaults to local-exec, others should get local-dynamic.  */
+/* { dg-final { scan-ipa-dump "Varpool flags: tls-local-" "whole-program" } } */
diff --git a/gcc/testsuite/gcc.dg/tls/vis-pragma-hidden.c b/gcc/testsuite/gcc.dg/tls/vis-pragma-hidden.c
index 1be97644243ab..50cd010924cfb 100644
--- a/gcc/testsuite/gcc.dg/tls/vis-pragma-hidden.c
+++ b/gcc/testsuite/gcc.dg/tls/vis-pragma-hidden.c
@@ -13,4 +13,5 @@  __thread int x;
 
 void reference() { x++; }
 
-/* { dg-final { scan-ipa-dump "Varpool flags: tls-local-dynamic" "whole-program" } } */
+/* rtems defaults to local-exec, others should get local-dynamic.  */
+/* { dg-final { scan-ipa-dump "Varpool flags: tls-local-" "whole-program" } } */
diff --git a/gcc/testsuite/gcc.target/aarch64/sve/tls_1.c b/gcc/testsuite/gcc.target/aarch64/sve/tls_1.c
index 43c52bc2b9061..71f354dfe1b48 100644
--- a/gcc/testsuite/gcc.target/aarch64/sve/tls_1.c
+++ b/gcc/testsuite/gcc.target/aarch64/sve/tls_1.c
@@ -1,5 +1,6 @@ 
 /* { dg-options "-O2 -fPIC -msve-vector-bits=256" } */
 /* { dg-require-effective-target fpic } */
+/* { dg-additional-options "-ftls-model=global-dynamic" { target *-*-rtems* } } */
 
 typedef unsigned int v8si __attribute__((vector_size(32)));
 
diff --git a/gcc/testsuite/gcc.target/aarch64/sve/tls_preserve_2.c b/gcc/testsuite/gcc.target/aarch64/sve/tls_preserve_2.c
index 20e939fbb85b4..1f477ba8c2599 100644
--- a/gcc/testsuite/gcc.target/aarch64/sve/tls_preserve_2.c
+++ b/gcc/testsuite/gcc.target/aarch64/sve/tls_preserve_2.c
@@ -2,6 +2,7 @@ 
 /* { dg-options "-O3 -fpic -msve-vector-bits=256 -fno-schedule-insns" } */
 /* { dg-require-effective-target fpic } */
 /* { dg-require-effective-target tls_native } */
+/* { dg-additional-options "-ftls-model=global-dynamic" { target *-*-rtems* } } */
 
 typedef float v8si __attribute__ ((vector_size (32)));
 
diff --git a/gcc/testsuite/gcc.target/aarch64/sve/tls_preserve_3.c b/gcc/testsuite/gcc.target/aarch64/sve/tls_preserve_3.c
index a19908f29b6a1..6e1a82698bde2 100644
--- a/gcc/testsuite/gcc.target/aarch64/sve/tls_preserve_3.c
+++ b/gcc/testsuite/gcc.target/aarch64/sve/tls_preserve_3.c
@@ -2,6 +2,7 @@ 
 /* { dg-options "-O3 -fpic -msve-vector-bits=512 -fno-schedule-insns" } */
 /* { dg-require-effective-target fpic } */
 /* { dg-require-effective-target tls_native } */
+/* { dg-additional-options "-ftls-model=global-dynamic" { target *-*-rtems* } } */
 
 typedef float v16si __attribute__ ((vector_size (64)));