This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Provide unwind info for x86, x86-64 (and s390{,x}) C++ thunks (PR target/43498)


Hi!

We don't emit unwind info on these targets for C++ thunks, while we do so e.g.
for ppc/ppc64/ia64/sparc*.
I've finally thought about just emitting .cfi_startproc/.cfi_endproc when
-fdwarf2-cfi-asm, but as the thunks are emitted before .eh_frame with
-fno-dwarf2-cfi-asm, it actually isn't any harder to handle it for both
ways of emitting unwind info.

Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?

2010-03-24  Jakub Jelinek  <jakub@redhat.com>

	PR target/43498
	* config/i386/i386.c (x86_output_mi_thunk): Call final_start_function
	at the beginning and final_end_function at the end.
	* config/s390/s390.c (s390_output_mi_thunk): Likewise.

--- gcc/config/i386/i386.c.jj	2010-03-10 19:26:13.000000000 +0100
+++ gcc/config/i386/i386.c	2010-03-24 12:16:04.000000000 +0100
@@ -26188,7 +26188,7 @@ x86_can_output_mi_thunk (const_tree thun
    *(*this + vcall_offset) should be added to THIS.  */
 
 static void
-x86_output_mi_thunk (FILE *file ATTRIBUTE_UNUSED,
+x86_output_mi_thunk (FILE *file,
 		     tree thunk ATTRIBUTE_UNUSED, HOST_WIDE_INT delta,
 		     HOST_WIDE_INT vcall_offset, tree function)
 {
@@ -26196,6 +26196,9 @@ x86_output_mi_thunk (FILE *file ATTRIBUT
   rtx this_param = x86_this_parameter (function);
   rtx this_reg, tmp;
 
+  /* Make sure unwind info is emitted for the thunk if needed.  */
+  final_start_function (emit_barrier (), file, 1);
+
   /* If VCALL_OFFSET, we'll need THIS in a register.  Might as well
      pull it in now and let DELTA benefit.  */
   if (REG_P (this_param))
@@ -26324,6 +26327,7 @@ x86_output_mi_thunk (FILE *file ATTRIBUT
 	  output_asm_insn ("jmp\t{*}%1", xops);
 	}
     }
+  final_end_function ();
 }
 
 static void
--- gcc/config/s390/s390.c.jj	2010-02-15 10:36:00.000000000 +0100
+++ gcc/config/s390/s390.c	2010-03-24 12:16:20.000000000 +0100
@@ -1,6 +1,6 @@
 /* Subroutines used for code generation on IBM S/390 and zSeries
    Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
-   2007, 2008, 2009 Free Software Foundation, Inc.
+   2007, 2008, 2009, 2010 Free Software Foundation, Inc.
    Contributed by Hartmut Penner (hpenner@de.ibm.com) and
                   Ulrich Weigand (uweigand@de.ibm.com) and
                   Andreas Krebbel (Andreas.Krebbel@de.ibm.com).
@@ -9030,6 +9030,9 @@ s390_output_mi_thunk (FILE *file, tree t
   rtx op[10];
   int nonlocal = 0;
 
+  /* Make sure unwind info is emitted for the thunk if needed.  */
+  final_start_function (emit_barrier (), file, 1);
+
   /* Operand 0 is the target function.  */
   op[0] = XEXP (DECL_RTL (function), 0);
   if (flag_pic && !SYMBOL_REF_LOCAL_P (op[0]))
@@ -9279,6 +9282,7 @@ s390_output_mi_thunk (FILE *file, tree t
 	  output_asm_insn (".long\t%3", op);
 	}
     }
+  final_end_function ();
 }
 
 static bool

	Jakub


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]