From 7dc5410af04b1693544d34f4046d10ee4409a892 Mon Sep 17 00:00:00 2001 From: "Maciej W. Rozycki" Date: Thu, 26 Apr 2018 21:01:31 +0000 Subject: [PATCH] MIPS/GCC/testsuite: Fix data-sym-pool.c for SVR4 model at -O0 With GCC configurations using the SVR4 rather than the PLT dynamic executable model and the o32 ABI with the data-sym-pool.c test case code like below is produced: .file 1 "data-sym-pool.c" .section .mdebug.abi32 .previous .nan legacy .module fp=xx .module nooddspreg .abicalls .text .align 2 .globl frob .set mips16 .set nomicromips .ent frob .type frob, @function frob: .frame $17,8,$31 # vars= 0, regs= 1/0, args= 0, gp= 0 .mask 0x00020000,-4 .fmask 0x00000000,0 save 8,$17 move $17,$sp lw $2,$L4 move $sp,$17 restore 8,$17 jr $31 .type __pool_frob_3, @object __pool_frob_3: .align 2 $L3: .word __gnu_local_gp $L4: .word 305419896 .type __pend_frob_3, @function __pend_frob_3: .insn .end frob .size frob, .-frob .ident "GCC: (GNU) 8.0.1 20180410 (experimental)" causing a failure due to the unexpected `__gnu_local_gp' entry in the constant pool, even though there is nothing wrong with it as far as the annotation being examined is concerned. Given that the SVR4 vs PLT code model consideration is irrelevant for this test case rather than rewriting the regular expression to match this variant of code just enforce the PLT model by using the `-mplt' option. It is safe to use this option unconditionally as it is silently ignored with configurations that do not support this model, e.g. bare metal ELF. gcc/testsuite/ * gcc.target/mips/data-sym-pool.c (dg-options): Add `-mplt'. From-SVN: r259690 --- gcc/testsuite/ChangeLog | 4 ++++ gcc/testsuite/gcc.target/mips/data-sym-pool.c | 8 ++++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 0e0332513ef..fc0d3dcb9c3 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2018-04-26 Maciej W. Rozycki + + * gcc.target/mips/data-sym-pool.c (dg-options): Add `-mplt'. + 2018-04-26 Eric Botcazou * gnat.dg/loop_optimization24.adb: New test. diff --git a/gcc/testsuite/gcc.target/mips/data-sym-pool.c b/gcc/testsuite/gcc.target/mips/data-sym-pool.c index 805778322e9..c73c8adb9ca 100644 --- a/gcc/testsuite/gcc.target/mips/data-sym-pool.c +++ b/gcc/testsuite/gcc.target/mips/data-sym-pool.c @@ -1,5 +1,5 @@ /* { dg-do compile } */ -/* { dg-options "-mips16 -mcode-readable=yes" } */ +/* { dg-options "-mips16 -mcode-readable=yes -mplt" } */ int frob (void) @@ -20,6 +20,10 @@ $L3: # The label must match. __pend_frob_3: # The symbol must match. .insn - that is `__pool_*'/`__pend_*' symbols inserted around a constant pool. */ + that is `__pool_*'/`__pend_*' symbols inserted around a constant pool. + + This code is built with `-mplt' to prevent the special `__gnu_local_gp' + symbol from being placed in the constant pool at `-O0' for SVR4 code + and consequently interfering with test expectations. */ /* { dg-final { scan-assembler "\tlw\t\\\$\[0-9\]+,(.L(\[0-9\]+))\n.*\t\\.type\t(__pool_frob_\\2), @object\n\\3:\n\t\\.align\t2\n\\1:\n\t\\.word\t305419896\n\t\\.type\t(__pend_frob_\\2), @function\n\\4:\n\t\\.insn\n" } } */ -- 2.30.2