]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
IBM Z: Spectre: Prevent thunk cfi to be emitted with -fno-dwarf2-cfi-asm
authorAndreas Krebbel <krebbel@linux.vnet.ibm.com>
Thu, 12 Apr 2018 10:22:35 +0000 (10:22 +0000)
committerAndreas Krebbel <krebbel@gcc.gnu.org>
Thu, 12 Apr 2018 10:22:35 +0000 (10:22 +0000)
The CFI magic we emit as part of the indirect branch thunks in order to
have somewhat sane unwind information must not be emitted with
-fno-dwarf2-cfi-asm.

gcc/ChangeLog:

2018-04-12  Andreas Krebbel  <krebbel@linux.vnet.ibm.com>

Backport from mainline
2018-04-12  Andreas Krebbel  <krebbel@linux.vnet.ibm.com>

* config/s390/s390.c (s390_output_indirect_thunk_function): Check
also for flag_dwarf2_cfi_asm.

gcc/testsuite/ChangeLog:

2018-04-12  Andreas Krebbel  <krebbel@linux.vnet.ibm.com>

Backport from mainline
2018-04-12  Andreas Krebbel  <krebbel@linux.vnet.ibm.com>

* gcc.target/s390/nobp-no-dwarf2-cfi.c: New test.

From-SVN: r259342

gcc/ChangeLog
gcc/config/s390/s390.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.target/s390/nobp-no-dwarf2-cfi.c [new file with mode: 0644]

index e5c5e1836aefab437869d7cf954f67dd02454c11..5e4003a9dc4bcdb8aabf9bab295bd2f7d763cebc 100644 (file)
@@ -1,3 +1,11 @@
+2018-04-12  Andreas Krebbel  <krebbel@linux.vnet.ibm.com>
+
+       Backport from mainline
+       2018-04-12  Andreas Krebbel  <krebbel@linux.vnet.ibm.com>
+
+       * config/s390/s390.c (s390_output_indirect_thunk_function): Check
+       also for flag_dwarf2_cfi_asm.
+
 2018-04-11  Uros Bizjak  <ubizjak@gmail.com>
 
        * config/alpha/alpha.md (stack_probe_internal): Rename
index b061a680680d061b9fcc4ef6210e0920ce3a705c..e5ff59407c19d176eeae1d907957f9338e06a3b3 100644 (file)
@@ -15429,7 +15429,7 @@ s390_output_indirect_thunk_function (unsigned int regno, bool z10_p)
      Stopping in the thunk: backtrace will point to the thunk target
      is if it was interrupted by a signal.  For a call this means that
      the call chain will be: caller->callee->thunk   */
-  if (flag_asynchronous_unwind_tables)
+  if (flag_asynchronous_unwind_tables && flag_dwarf2_cfi_asm)
     {
       fputs ("\t.cfi_signal_frame\n", asm_out_file);
       fprintf (asm_out_file, "\t.cfi_return_column %d\n", regno);
index 572b25233327f028993add77b51a850c758c83df..659277daab5baf5052656c033c85accb245f6888 100644 (file)
@@ -1,3 +1,10 @@
+2018-04-12  Andreas Krebbel  <krebbel@linux.vnet.ibm.com>
+
+       Backport from mainline
+       2018-04-12  Andreas Krebbel  <krebbel@linux.vnet.ibm.com>
+
+       * gcc.target/s390/nobp-no-dwarf2-cfi.c: New test.
+
 2018-04-10  Thomas Schwinge  <thomas@codesourcery.com>
 
        PR target/85056
diff --git a/gcc/testsuite/gcc.target/s390/nobp-no-dwarf2-cfi.c b/gcc/testsuite/gcc.target/s390/nobp-no-dwarf2-cfi.c
new file mode 100644 (file)
index 0000000..75e32a1
--- /dev/null
@@ -0,0 +1,19 @@
+/* { dg-do run } */
+/* { dg-options "-O3 -march=z900 --save-temps -mfunction-return-reg=thunk -mindirect-branch-table -fno-dwarf2-cfi-asm" } */
+
+/* Make sure that we do not emit .cfi directives when -fno-dwarf2-cfi-asm is being used.  */
+
+int
+main ()
+{
+  return 0;
+}
+
+/* 1 x main
+/* { dg-final { scan-assembler-times "jg\t__s390_indirect_jump" 1 } } */
+/* { dg-final { scan-assembler "ex\t" } } */
+
+/* { dg-final { scan-assembler-not "section\t.s390_indirect_jump" } } */
+/* { dg-final { scan-assembler-not "section\t.s390_indirect_call" } } */
+/* { dg-final { scan-assembler     "section\t.s390_return_reg" } } */
+/* { dg-final { scan-assembler-not "section\t.s390_return_mem" } } */