]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
i386 testsuite: cope with --enable-default-pie
authorAlexandre Oliva <oliva@adacore.com>
Tue, 12 Jul 2022 11:52:24 +0000 (08:52 -0300)
committerAlexandre Oliva <oliva@gnu.org>
Tue, 12 Jul 2022 11:52:24 +0000 (08:52 -0300)
Running the testsuite on a toolchain build with --enable-default-pie
had some unexpected fails.  Adjust the tests to tolerate the effects
of this configuration option on x86_64-linux-gnu and i686-linux-gnu.

The cet-sjlj* tests get offsets before the base symbol name with PIC
or PIE.  A single pattern covering both alternatives somehow triggered
two matches rather than the single expected match, thus my narrowing
the '.*' to not skip line breaks, but that was not enough.  Still
puzzled, I separated the patterns into nonpic and !nonpic, and we get
the expected matchcounts this way.

Tests for -mfentry require an mfentry effective target, which excludes
32-bit x86 with PIC or PIE enabled, that's why the patterns that
accept the PIC sym@RELOC annotations only cover x86_64.  mvc7 is
getting regexps extended to cover PIC reloc annotatios and all of the
named variants, and tightened to avoid unexpected '.' matches.

The pr24414 test stores in an unadorned named variable in an old-style
asm statement, to check that such asm statements get an implicit
memory clobber.  Rewriting the asm into a GCC extended asm with the
variable as an output would remove the regression it checks against.
Problem is, the literal reference to the variable is not PIC, so it's
rejected by the elf64 linker with an error, and flagged with a warning
by the elf32 one.  We could presumably make the variable references
PIC-friendly with #ifdefs, but I doubt that's worth the trouble.  I'm
just arranging for the test to be skipped if PIC or PIE are enabled by
default.

for  gcc/testsuite/ChangeLog

* gcc.target/i386/cet-sjlj-6a.c: Cope with --enable-default-pie.
* gcc.target/i386/cet-sjlj-6b.c: Likewise.
* gcc.target/i386/fentryname3.c: Likewise.
* gcc.target/i386/mvc7.c: Likewise.
* gcc.target/i386/pr24414.c: Likewise.
* gcc.target/i386/pr93492-3.c: Likewise.
* gcc.target/i386/pr93492-5.c: Likewise.
* gcc.target/i386/pr98482-1.c: Likewise.

gcc/testsuite/gcc.target/i386/cet-sjlj-6a.c
gcc/testsuite/gcc.target/i386/cet-sjlj-6b.c
gcc/testsuite/gcc.target/i386/fentryname3.c
gcc/testsuite/gcc.target/i386/mvc7.c
gcc/testsuite/gcc.target/i386/pr24414.c
gcc/testsuite/gcc.target/i386/pr93492-3.c
gcc/testsuite/gcc.target/i386/pr93492-5.c
gcc/testsuite/gcc.target/i386/pr98482-1.c

index 040b297aeb023f9347a7afa2508e702914fbf58c..c3d0eb929424d116bbc7575ba897da92b7aae403 100644 (file)
@@ -2,8 +2,10 @@
 /* { dg-require-effective-target maybe_x32 } */
 /* { dg-options "-O -maddress-mode=short -fcf-protection -mx32" } */
 /* { dg-final { scan-assembler-times "endbr64" 2 } } */
-/* { dg-final { scan-assembler-times "movq\t.*buf\\+8" 1 } } */
-/* { dg-final { scan-assembler-times "subq\tbuf\\+8" 1 } } */
+/* { dg-final { scan-assembler-times "movq\t\[^\n\]*buf\\+8" 1 { target nonpic } } } */
+/* { dg-final { scan-assembler-times "movq\t\[^\n\]*8\\+buf" 1 { target { ! nonpic } } } } */
+/* { dg-final { scan-assembler-times "subq\tbuf\\+8" 1 { target nonpic } } } */
+/* { dg-final { scan-assembler-times "subq\t8\\+buf" 1 { target { ! nonpic } } } } */
 /* { dg-final { scan-assembler-times "shrl\t\\\$3," 1 } } */
 /* { dg-final { scan-assembler-times "rdsspq" 2 } } */
 /* { dg-final { scan-assembler-times "incsspq" 2 } } */
index b2376e710df6ada0b7245a86908127988c67f3fb..4c52685d7d1e1f87d2bacd52567243a3c576a72a 100644 (file)
@@ -2,8 +2,10 @@
 /* { dg-require-effective-target maybe_x32 } */
 /* { dg-options "-O -maddress-mode=long -fcf-protection -mx32" } */
 /* { dg-final { scan-assembler-times "endbr64" 2 } } */
-/* { dg-final { scan-assembler-times "movq\t.*buf\\+16" 1 } } */
-/* { dg-final { scan-assembler-times "subq\tbuf\\+16" 1 } } */
+/* { dg-final { scan-assembler-times "movq\t\[^\n\]*buf\\+16" 1 { target nonpic } } } */
+/* { dg-final { scan-assembler-times "movq\t\[^\n\]*16\\+buf" 1 { target { ! nonpic } } } } */
+/* { dg-final { scan-assembler-times "subq\tbuf\\+16" 1 { target nonpic } } } */
+/* { dg-final { scan-assembler-times "subq\t16\\+buf" 1 { target { ! nonpic } } } } */
 /* { dg-final { scan-assembler-times "shrl\t\\\$3," 1 } } */
 /* { dg-final { scan-assembler-times "rdsspq" 2 } } */
 /* { dg-final { scan-assembler-times "incsspq" 2 } } */
index bd7c997c178f0be5655877c48cfb0bbb7ecc97e0..c14a4ebb0cf576087093ee1f11ade2ab6560e573 100644 (file)
@@ -3,7 +3,8 @@
 /* { dg-require-profiling "-pg" } */
 /* { dg-options "-pg -mfentry"  } */
 /* { dg-final { scan-assembler "section.*__entry_loc" } } */
-/* { dg-final { scan-assembler "0x0f, 0x1f, 0x44, 0x00, 0x00" } } */
+/* { dg-final { scan-assembler "0x0f, 0x1f, 0x44, 0x00, 0x00" { target nonpic } } } */
+/* { dg-final { scan-assembler "call\t\\*nop@GOTPCREL" { target { ! nonpic } } } } */
 /* { dg-final { scan-assembler-not "__fentry__" } } */
 
 __attribute__((fentry_name("nop"), fentry_section("__entry_loc")))
index 7fb9dded849a51c37cb8854bad1666b2f033f7ef..872cd5975ad347a596efdd0a3290fe05ae842949 100644 (file)
@@ -2,12 +2,12 @@
 /* { dg-require-ifunc "" } */
 
 /* Verify that foo clones are not numbered.  */
-/* { dg-final { scan-assembler "foo.resolver," } } */
-/* { dg-final { scan-assembler "foo.default," } } */
-/* { dg-final { scan-assembler "foo.avx," } } */
-
-/* { dg-final { scan-assembler "slm" } } */
-/* { dg-final { scan-assembler "foo,foo.resolver" } } */
+/* { dg-final { scan-assembler "foo\.resolver," } } */
+/* { dg-final { scan-assembler "foo\.default\[,@\]" } } */
+/* { dg-final { scan-assembler "foo\.avx\[,@\]" } } */
+/* { dg-final { scan-assembler "foo\.arch_core_avx2\[,@\]" } } */
+/* { dg-final { scan-assembler "foo\.arch_slm\[,@\]" } } */
+/* { dg-final { scan-assembler "foo,foo\.resolver" } } */
 
 __attribute__((target_clones("avx","default","arch=slm","arch=core-avx2")))
 int foo ();
index 0acaa001a5c8ad21da7adfd0ac5dbf317d9905f5..6f77fa93cf0ac16fde442155e2bf9da5be5d2f2e 100644 (file)
@@ -1,4 +1,5 @@
 /* { dg-do run } */
+/* { dg-require-effective-target nonpic } */
 /* { dg-options "-O2" } */
 /* { dg-skip-if "asm insert mismatches ABI for Darwin" { *-*-darwin* } } */
 int test;
index 52a19e51513623bb88887a7bc38c95b65700cd49..a625c927f4f0bb5e0e3b27941fe514e3cb28875f 100644 (file)
@@ -10,4 +10,4 @@ f10_endbr (void)
 {
 }
 
-/* { dg-final { scan-assembler "\t\.cfi_startproc\n\tendbr(32|64)\n.*\.LPFE1:\n\tnop\n1:\tcall\t__fentry__\n\tret\n" } } */
+/* { dg-final { scan-assembler "\t\.cfi_startproc\n\tendbr(32|64)\n.*\.LPFE1:\n\tnop\n1:\tcall\t\[^\n\]*__fentry__\[^\n\]*\n\tret\n" } } */
index fcf4ad43aa206c14b41375f9194fd2e1c772119b..5aebb3847f5bebbabb6bf41a8d7419bc068c9bc2 100644 (file)
@@ -8,4 +8,4 @@ foo (void)
 {
 }
 
-/* { dg-final { scan-assembler "\t\.cfi_startproc\n.*\.LPFE1:\n\tnop\n1:\tcall\t__fentry__\n\tret\n" } } */
+/* { dg-final { scan-assembler "\t\.cfi_startproc\n.*\.LPFE1:\n\tnop\n1:\tcall\t\[^\n\]*__fentry__\[^\n\]*\n\tret\n" } } */
index 912cbe0919100696d16fd29ef5525567970a8b16..b1d9619275e72c0d6d376887b0aca87cc2e82ff0 100644 (file)
@@ -1,7 +1,8 @@
 /* { dg-do compile { target { *-*-linux* && lp64 } } } */
 /* { dg-require-effective-target mfentry } */
 /* { dg-options "-fprofile -mfentry -O2 -mcmodel=large" } */
-/* { dg-final { scan-assembler "movabsq\t\\\$__fentry__, %r10\n\tcall\t\\*%r10" } } */
+/* { dg-final { scan-assembler "movabsq\t\\\$__fentry__, %r10\n\tcall\t\\*%r10" { target nonpic } } } */
+/* { dg-final { scan-assembler "movabsq\t\\\$__fentry__@PLTOFF, %r11\n\taddq\t%r11, %r10\n\tcall\t\\*%r10" { target { ! nonpic } } } } */
 
 void
 func (void)