The attr-retain tests scan for the R section flag on .text, .data, .bss
and .rodata.  Alpha places small objects in the gp-relative small data
area instead, emitting .sdata/.sbss with an additional "s" flag, so scans
such as .rodata.*,"aR" do not match even though the retain flag itself is
emitted correctly.

The tests already compile with -G0 on powerpc ilp32 for this reason.  Do
the same on alpha, which fixes 57 failures across the C and C++ testsuites.

gcc/testsuite/ChangeLog:

        * c-c++-common/attr-retain-2.c: Also pass -G0 on alpha.
        * c-c++-common/attr-retain-3.c: Likewise.
        * c-c++-common/attr-retain-4.c: Likewise.
        * gcc.c-torture/compile/attr-retain-1.c: Likewise.
        * gcc.c-torture/compile/attr-retain-2.c: Likewise.
---
 gcc/testsuite/c-c++-common/attr-retain-2.c          | 3 +++
 gcc/testsuite/c-c++-common/attr-retain-3.c          | 3 +++
 gcc/testsuite/c-c++-common/attr-retain-4.c          | 3 +++
 gcc/testsuite/gcc.c-torture/compile/attr-retain-1.c | 3 +++
 gcc/testsuite/gcc.c-torture/compile/attr-retain-2.c | 3 +++
 5 files changed, 15 insertions(+)

diff --git ./gcc/testsuite/c-c++-common/attr-retain-2.c 
./gcc/testsuite/c-c++-common/attr-retain-2.c
index 1fe721ea364..f77f9fed05b 100644
--- ./gcc/testsuite/c-c++-common/attr-retain-2.c
+++ ./gcc/testsuite/c-c++-common/attr-retain-2.c
@@ -1,5 +1,8 @@
 /* { dg-do compile { target gnu_retain } } */
 /* { dg-options "-Wall -O2" } */
+/* Alpha places small objects in gp-relative sdata/sbss, which carry an
+   extra "s" section flag the scans do not match. */
+/* { dg-additional-options "-G0" { target alpha*-*-* } } */
 
 static int xyzzy __attribute__((__used__, __retain__)) = 1; 
 
diff --git ./gcc/testsuite/c-c++-common/attr-retain-3.c 
./gcc/testsuite/c-c++-common/attr-retain-3.c
index 383403987c6..f5724f1ecfb 100644
--- ./gcc/testsuite/c-c++-common/attr-retain-3.c
+++ ./gcc/testsuite/c-c++-common/attr-retain-3.c
@@ -1,5 +1,8 @@
 /* { dg-do compile { target gnu_retain } } */
 /* { dg-options "-Wall -O2 -fcommon" } */
+/* Alpha places small objects in gp-relative sdata/sbss, which carry an
+   extra "s" section flag the scans do not match. */
+/* { dg-additional-options "-G0" { target alpha*-*-* } } */
 
 static int xyzzy __attribute__((__used__, __retain__)); 
 
diff --git ./gcc/testsuite/c-c++-common/attr-retain-4.c 
./gcc/testsuite/c-c++-common/attr-retain-4.c
index bf5899e0ac4..3f0c7d52d19 100644
--- ./gcc/testsuite/c-c++-common/attr-retain-4.c
+++ ./gcc/testsuite/c-c++-common/attr-retain-4.c
@@ -1,5 +1,8 @@
 /* { dg-do compile { target gnu_retain } } */
 /* { dg-options "-Wall -O2 -fcommon" } */
+/* Alpha places small objects in gp-relative sdata/sbss, which carry an
+   extra "s" section flag the scans do not match. */
+/* { dg-additional-options "-G0" { target alpha*-*-* } } */
 
 int xyzzy __attribute__((__used__, __retain__)); 
 
diff --git ./gcc/testsuite/gcc.c-torture/compile/attr-retain-1.c 
./gcc/testsuite/gcc.c-torture/compile/attr-retain-1.c
index 963c7860dfa..e10acfa57bb 100644
--- ./gcc/testsuite/gcc.c-torture/compile/attr-retain-1.c
+++ ./gcc/testsuite/gcc.c-torture/compile/attr-retain-1.c
@@ -1,6 +1,9 @@
 /* { dg-do compile { target gnu_retain } } */
 /* Prevent readonly data from being put in writable sdata for 32-bit powerpc. 
*/
 /* { dg-options "-G0" { target { powerpc*-*-* && ilp32 } } } */
+/* Alpha places small objects in gp-relative sdata/sbss, which carry an
+   extra "s" section flag the scans do not match. */
+/* { dg-additional-options "-G0" { target alpha*-*-* } } */
 /* { dg-final { scan-assembler ".text.*,\"axR\"" } } */
 /* { dg-final { scan-assembler ".bss.*,\"awR\"" } } */
 /* { dg-final { scan-assembler ".data.*,\"awR\"" } } */
diff --git ./gcc/testsuite/gcc.c-torture/compile/attr-retain-2.c 
./gcc/testsuite/gcc.c-torture/compile/attr-retain-2.c
index 5ae043411d9..dd5ed90d7ff 100644
--- ./gcc/testsuite/gcc.c-torture/compile/attr-retain-2.c
+++ ./gcc/testsuite/gcc.c-torture/compile/attr-retain-2.c
@@ -13,5 +13,8 @@
 /* { dg-options "-ffunction-sections -fdata-sections" } */
 /* Prevent readonly data from being put in writable sdata for 32-bit powerpc. 
*/
 /* { dg-options "-ffunction-sections -fdata-sections -G0" { target { 
powerpc*-*-* && ilp32 } } } */
+/* Alpha places small objects in gp-relative sdata/sbss, which carry an
+   extra "s" section flag the scans do not match. */
+/* { dg-additional-options "-G0" { target alpha*-*-* } } */
 
 #include "attr-retain-1.c"
-- 
2.54.0

Reply via email to