* sysdeps/generic/sysdep.h (cfi_offset, cfi_startproc,
authorAndreas Jaeger <aj@suse.de>
Wed, 21 May 2003 09:25:53 +0000 (09:25 +0000)
committerAndreas Jaeger <aj@suse.de>
Wed, 21 May 2003 09:25:53 +0000 (09:25 +0000)
cfi_endproc, cfi_def_cfa, cfi_def_ccfa_register,
cfi_def_cfa_offset, cfi_adjust_cfa_offset, cfi_offset): Define.
* sysdeps/x86_64/sysdep.h (CALL_MCOUNT): Add cfi directives.
(ENTRY): Likewise.
(END): Likewise.

* configure.in: Test for asm cfi directives.

* config.h.in: Add HAVE_ASM_CFI_DIRECTIVES.
2003-05-21  Andreas Jaeger  <aj@suse.de>

* sysdeps/generic/sysdep.h (cfi_offset, cfi_startproc,
cfi_endproc, cfi_def_cfa, cfi_def_ccfa_register,
cfi_def_cfa_offset, cfi_adjust_cfa_offset, cfi_offset): Define.

* sysdeps/x86_64/sysdep.h (CALL_MCOUNT): Add cfi directives.
(ENTRY): Likewise.
(END): Likewise.

* configure.in: Test for asm cfi directives.

* config.h.in: Add HAVE_ASM_CFI_DIRECTIVES.

ChangeLog
config.h.in
configure
configure.in
sysdeps/generic/sysdep.h
sysdeps/x86_64/sysdep.h

index 29791a6..f5e6076 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,17 @@
+2003-05-21  Andreas Jaeger  <aj@suse.de>
+
+       * sysdeps/generic/sysdep.h (cfi_offset, cfi_startproc,
+       cfi_endproc, cfi_def_cfa, cfi_def_ccfa_register,
+       cfi_def_cfa_offset, cfi_adjust_cfa_offset, cfi_offset): Define.
+
+       * sysdeps/x86_64/sysdep.h (CALL_MCOUNT): Add cfi directives.
+       (ENTRY): Likewise.
+       (END): Likewise.
+
+       * configure.in: Test for asm cfi directives.
+
+       * config.h.in: Add HAVE_ASM_CFI_DIRECTIVES.
+
 2003-05-17  Andreas Jaeger  <aj@suse.de>
 
        * sysdeps/unix/sysv/linux/x86_64/syscall.S: Revert last patch.
index cd132ce..ba5a55c 100644 (file)
@@ -31,6 +31,9 @@
 /* Define if weak symbols are available via the `.weakext' directive.  */
 #undef HAVE_ASM_WEAKEXT_DIRECTIVE
 
+/* Define if CFI directives are available.  */
+#undef HAVE_ASM_CFI_DIRECTIVES
+
 /* Define to the assembler line separator character for multiple
    assembler instructions per line.  Default is `;'  */
 #undef ASM_LINE_SEP
index eac55c6..1dfeaa2 100755 (executable)
--- a/configure
+++ b/configure
@@ -5689,6 +5689,39 @@ _ACEOF
   ;;
 esac
 
+echo "$as_me:$LINENO: checking whether CFI directives are supported" >&5
+echo $ECHO_N "checking whether CFI directives are supported... $ECHO_C" >&6
+if test "${libc_cv_asm_cfi_directives+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat > conftest.s <<EOF
+        .text
+        .type   func,@function
+func:
+        .cfi_startproc
+        .cfi_endproc
+EOF
+if { ac_try='${CC-cc} $ASFLAGS -c conftest.s 1>&5'
+  { (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
+  libc_cv_asm_cfi_directives=yes
+else
+  libc_cv_asm_cfi_directives=no
+fi
+rm -f conftest*
+fi
+echo "$as_me:$LINENO: result: $libc_cv_asm_cfi_directives" >&5
+echo "${ECHO_T}$libc_cv_asm_cfi_directives" >&6
+if test $libc_cv_asm_cfi_directives = yes; then
+  cat >>confdefs.h <<\_ACEOF
+#define HAVE_ASM_CFI_DIRECTIVES 1
+_ACEOF
+
+fi
+
 echo "$as_me:$LINENO: checking if -g produces usable source locations for assembler-with-cpp" >&5
 echo $ECHO_N "checking if -g produces usable source locations for assembler-with-cpp... $ECHO_C" >&6
 if test "${libc_cv_cpp_asm_debuginfo+set}" = set; then
index f0511ac..c415f37 100644 (file)
@@ -1502,6 +1502,24 @@ EOF
   ;;
 esac
 
+AC_CACHE_CHECK(whether CFI directives are supported, libc_cv_asm_cfi_directives, [dnl
+cat > conftest.s <<EOF
+        .text
+        .type   func,@function
+func:
+        .cfi_startproc
+        .cfi_endproc
+EOF
+if AC_TRY_COMMAND(${CC-cc} $ASFLAGS -c conftest.s 1>&AS_MESSAGE_LOG_FD); then
+  libc_cv_asm_cfi_directives=yes
+else
+  libc_cv_asm_cfi_directives=no
+fi
+rm -f conftest*])
+if test $libc_cv_asm_cfi_directives = yes; then
+  AC_DEFINE(HAVE_ASM_CFI_DIRECTIVES)
+fi  
+
 AC_CACHE_CHECK(if -g produces usable source locations for assembler-with-cpp,
               libc_cv_cpp_asm_debuginfo, [dnl
 cat > conftest.S <<EOF
index 0d69ac6..3223c97 100644 (file)
 #ifndef JUMPTARGET
 #define JUMPTARGET(sym)                sym
 #endif
+
+/* Makros to generate eh_frame unwind information.  */
+# ifdef HAVE_ASM_CFI_DIRECTIVES
+#  define cfi_startproc        .cfi_startproc
+#  define cfi_endproc  .cfi_endproc
+#  define cfi_def_cfa(reg, off)        .cfi_def_cfa reg, off
+#  define cfi_def_cfa_register(reg)    .cfi_def_cfa_register reg
+#  define cfi_def_cfa_offset(off)      .cfi_def_cfa_offset off
+#  define cfi_adjust_cfa_offset(off)   .cfi_adjust_cfa_offset off
+#  define cfi_offset(reg, off) .cfi_offset reg, off
+# else
+#  define cfi_startproc
+#  define cfi_endproc
+#  define cfi_def_cfa(reg, off)
+#  define cfi_def_cfa_register(reg)
+#  define cfi_def_cfa_offset(off)
+#  define cfi_adjust_cfa_offset(off)
+#  define cfi_offset(reg, off)
+# endif
+
+
 #endif /* __ASSEMBLER__ */
index 99b7e56..122270f 100644 (file)
   ASM_TYPE_DIRECTIVE (C_SYMBOL_NAME(name),@function)                         \
   .align ALIGNARG(4);                                                        \
   C_LABEL(name)                                                                      \
+  cfi_startproc;                                                             \
   CALL_MCOUNT
 
 #undef END
 #define END(name)                                                            \
-  ASM_SIZE_DIRECTIVE(name)                                                   \
+  cfi_endproc;                                                               \
+  ASM_SIZE_DIRECTIVE(name)
 
 /* If compiled for profiling, call `mcount' at the start of each function.  */
 #ifdef PROF
 /* The mcount code relies on a normal frame pointer being on the stack
    to locate our caller, so push one just for its benefit.  */
-#define CALL_MCOUNT \
-  pushq %rbp; movq %rsp, %rbp; call JUMPTARGET(mcount); popq %rbp;
+#define CALL_MCOUNT                                                          \
+  pushq %rbp;                                                                \
+  cfi_adjust_cfa_offset(8);                                                  \
+  movq %rsp, %rbp;                                                           \
+  cfi_def_cfa_register(%rbp);                                                \
+  call JUMPTARGET(mcount);                                                   \
+  popq %rbp;                                                                 \
+  cfi_def_cfa(rsp,8);
 #else
 #define CALL_MCOUNT            /* Do nothing.  */
 #endif