Add .data.rel.ro.local to read only sections in gcc.dg/array-quals-1.c
[official-gcc.git] / gcc / testsuite / gcc.dg / array-quals-1.c
blobe379f6121b7c74a048bdd266a3821a686b9dce3d
1 /* Test for various combinations of const, arrays and typedefs:
2 should never actually get const on the final array type, but
3 all should end up in a read-only section. PR c/12165. */
4 /* Origin: Joseph Myers <jsm@polyomino.org.uk> */
5 /* { dg-do compile } */
6 /* { dg-options "-Wno-discarded-array-qualifiers" } */
7 /* { dg-additional-options "-fno-pie" { target pie } } */
8 /* The MMIX port always switches to the .data section at the end of a file. */
9 /* { dg-final { scan-assembler-not "\\.data(?!\\.rel\\.ro)" { xfail powerpc*-*-aix* mmix-*-* x86_64-*-mingw* } } } */
10 /* { dg-final { scan-assembler-symbol-section {^_?a$} {^\.(const|rodata|srodata|sdata)|\[RO\]} } } */
11 static const int a[2] = { 1, 2 };
12 /* { dg-final { scan-assembler-symbol-section {^_?a1$} {^\.(const|rodata|srodata|sdata)|\[RO\]} } } */
13 const int a1[2] = { 1, 2 };
14 typedef const int ci;
15 /* { dg-final { scan-assembler-symbol-section {^_?b$} {^\.(const|rodata|srodata|sdata)|\[RO\]} } } */
16 static ci b[2] = { 3, 4 };
17 /* { dg-final { scan-assembler-symbol-section {^_?b1$} {^\.(const|rodata|srodata|sdata)|\[RO\]} } } */
18 ci b1[2] = { 3, 4 };
19 typedef int ia[2];
20 /* { dg-final { scan-assembler-symbol-section {^_?c$} {^\.(const|rodata|srodata|sdata)|\[RO\]} } } */
21 static const ia c = { 5, 6 };
22 /* { dg-final { scan-assembler-symbol-section {^_?c1$} {^\.(const|rodata|srodata|sdata)|\[RO\]} } } */
23 const ia c1 = { 5, 6 };
24 typedef const int cia[2];
25 /* { dg-final { scan-assembler-symbol-section {^_?d$} {^\.(const|rodata|srodata|sdata)|\[RO\]} } } */
26 static cia d = { 7, 8 };
27 /* { dg-final { scan-assembler-symbol-section {^_?d1$} {^\.(const|rodata|srodata|sdata)|\[RO\]} } } */
28 cia d1 = { 7, 8 };
29 /* { dg-final { scan-assembler-symbol-section {^_?e$} {^\.(const|rodata|srodata|sdata)|\[RO\]} } } */
30 static cia e[2] = { { 1, 2 }, { 3, 4 } };
31 /* { dg-final { scan-assembler-symbol-section {^_?e1$} {^\.(const|rodata|srodata|sdata)|\[RO\]} } } */
32 cia e1[2] = { { 1, 2 }, { 3, 4 } };
33 /* { dg-final { scan-assembler-symbol-section {^_?p$} {^\.(const|rodata|srodata|sdata|data.rel.ro.local)|\[RW\]} } } */
34 void *const p = &a;
35 /* { dg-final { scan-assembler-symbol-section {^_?q$} {^\.(const|rodata|srodata|sdata|data.rel.ro.local)|\[RW\]} } } */
36 void *const q = &b;
37 /* { dg-final { scan-assembler-symbol-section {^_?r$} {^\.(const|rodata|srodata|sdata|data.rel.ro.local)|\[RW\]} } } */
38 void *const r = &c;
39 /* { dg-final { scan-assembler-symbol-section {^_?s$} {^\.(const|rodata|srodata|sdata|data.rel.ro.local)|\[RW\]} } } */
40 void *const s = &d;
41 /* { dg-final { scan-assembler-symbol-section {^_?t$} {^\.(const|rodata|srodata|sdata|data.rel.ro.local)|\[RW\]} } } */
42 void *const t = &e;
43 /* { dg-final { scan-assembler-symbol-section {^_?p1$} {^\.(const|rodata|srodata|sdata|data.rel.ro.local)|\[RW\]} } } */
44 void *const p1 = &a1;
45 /* { dg-final { scan-assembler-symbol-section {^_?q1$} {^\.(const|rodata|srodata|sdata|data.rel.ro.local)|\[RW\]} } } */
46 void *const q1 = &b1;
47 /* { dg-final { scan-assembler-symbol-section {^_?r1$} {^\.(const|rodata|srodata|sdata|data.rel.ro.local)|\[RW\]} } } */
48 void *const r1 = &c1;
49 /* { dg-final { scan-assembler-symbol-section {^_?s1$} {^\.(const|rodata|srodata|sdata|data.rel.ro.local)|\[RW\]} } } */
50 void *const s1 = &d1;
51 /* { dg-final { scan-assembler-symbol-section {^_?t1$} {^\.(const|rodata|srodata|sdata|data.rel.ro.local)|\[RW\]} } } */
52 void *const t1 = &e1;