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 2/3] libffi/m68k: add callframe info


libffi/
2007-xx-xx  Roman Zippel <zippel@linux-m68k.org>

	* configure.ac (HAVE_AS_CFI_PSEUDO_OP): New test.
	* configure: Regenerate.
	* fficonfig.h.in: Regenerate.
	* src/m68k/sysv.S (CFI_STARTPROC,CFI_ENDPROC,
	CFI_OFFSET,CFI_DEF_CFA): New macros.
	(ffi_call_SYSV): Add callframe annotation.

---
 libffi/configure       |   64 +++++++++++++++++++++++++++++++++++++++++++++++++
 libffi/configure.ac    |   12 +++++++++
 libffi/fficonfig.h.in  |    3 ++
 libffi/src/m68k/sysv.S |   17 +++++++++++++
 4 files changed, 96 insertions(+)

Index: gcc/libffi/configure.ac
===================================================================
--- gcc.orig/libffi/configure.ac
+++ gcc/libffi/configure.ac
@@ -144,6 +144,18 @@ AC_SUBST(HAVE_LONG_DOUBLE)
 
 AC_C_BIGENDIAN
 
+AC_CACHE_CHECK([assembler .cfi pseudo-op support],
+    libffi_cv_as_cfi_pseudo_op, [
+    libffi_cv_as_cfi_pseudo_op=unknown
+    AC_TRY_COMPILE([asm (".cfi_startproc\n\t.cfi_endproc");],,
+		   [libffi_cv_as_cfi_pseudo_op=yes],
+		   [libffi_cv_as_cfi_pseudo_op=no])
+])
+if test "x$libffi_cv_as_cfi_pseudo_op" = xyes; then
+    AC_DEFINE(HAVE_AS_CFI_PSEUDO_OP, 1,
+	      [Define if your assembler supports .cfi_* directives.])
+fi
+
 if test x$TARGET = xSPARC; then
     AC_CACHE_CHECK([assembler and linker support unaligned pc related relocs],
 	libffi_cv_as_sparc_ua_pcrel, [
Index: gcc/libffi/configure
===================================================================
--- gcc.orig/libffi/configure
+++ gcc/libffi/configure
@@ -7387,6 +7387,70 @@ presetting ac_cv_c_bigendian=no (or yes)
 esac
 
 
+echo "$as_me:$LINENO: checking assembler .cfi pseudo-op support" >&5
+echo $ECHO_N "checking assembler .cfi pseudo-op support... $ECHO_C" >&6
+if test "${libffi_cv_as_cfi_pseudo_op+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+
+    libffi_cv_as_cfi_pseudo_op=unknown
+    cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+asm (".cfi_startproc\n\t.cfi_endproc");
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  libffi_cv_as_cfi_pseudo_op=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+libffi_cv_as_cfi_pseudo_op=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+
+fi
+echo "$as_me:$LINENO: result: $libffi_cv_as_cfi_pseudo_op" >&5
+echo "${ECHO_T}$libffi_cv_as_cfi_pseudo_op" >&6
+if test "x$libffi_cv_as_cfi_pseudo_op" = xyes; then
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_AS_CFI_PSEUDO_OP 1
+_ACEOF
+
+fi
+
 if test x$TARGET = xSPARC; then
     echo "$as_me:$LINENO: checking assembler and linker support unaligned pc related relocs" >&5
 echo $ECHO_N "checking assembler and linker support unaligned pc related relocs... $ECHO_C" >&6
Index: gcc/libffi/fficonfig.h.in
===================================================================
--- gcc.orig/libffi/fficonfig.h.in
+++ gcc/libffi/fficonfig.h.in
@@ -27,6 +27,9 @@
    */
 #undef HAVE_ALLOCA_H
 
+/* Define if your assembler supports .cfi_* directives. */
+#undef HAVE_AS_CFI_PSEUDO_OP
+
 /* Define if your assembler supports .register. */
 #undef HAVE_AS_REGISTER_PSEUDO_OP
 
Index: gcc/libffi/src/m68k/sysv.S
===================================================================
--- gcc.orig/libffi/src/m68k/sysv.S
+++ gcc/libffi/src/m68k/sysv.S
@@ -8,6 +8,18 @@
 #include <fficonfig.h>
 #include <ffi.h>
 
+#ifdef HAVE_AS_CFI_PSEUDO_OP
+#define CFI_STARTPROC()		.cfi_startproc
+#define CFI_OFFSET(reg,off)	.cfi_offset	reg,off
+#define CFI_DEF_CFA(reg,off)	.cfi_def_cfa	reg,off
+#define CFI_ENDPROC()		.cfi_endproc
+#else
+#define CFI_STARTPROC()
+#define CFI_OFFSET(reg,off)
+#define CFI_DEF_CFA(reg,off)
+#define CFI_ENDPROC()
+#endif
+
 	.text
 
 	.globl	ffi_call_SYSV
@@ -15,8 +27,12 @@
 	.align	4
 
 ffi_call_SYSV:
+	CFI_STARTPROC()
 	link	%fp,#0
+	CFI_OFFSET(14,-8)
+	CFI_DEF_CFA(14,8)
 	move.l	%d2,-(%sp)
+	CFI_OFFSET(2,-12)
 
 	| Make room for all of the new args.
 	sub.l	12(%fp),%sp
@@ -103,4 +119,5 @@ epilogue:
 	move.l	(%sp)+,%d2
 	unlk	%fp
 	rts
+	CFI_ENDPROC()
 	.size	ffi_call_SYSV,.-ffi_call_SYSV

--


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