From edf49cd0a3eb52f8a737f82763df9de022a29042 Mon Sep 17 00:00:00 2001 From: mmitchel Date: Sat, 19 May 2001 17:55:49 +0000 Subject: [PATCH] * defaults.h (TARGET_ALLOWS_PROFILING_WITHOUT_FRAME_POINTER): New macro. * tm.texi (TARGET_ALLOWS_PROFILING_WITHOUT_FRAME_POINTER): Document it. * toplev.c (main): If the target does not allow profiling without a frame pointer, issue an error message. * config/i386/linux.h (TARGET_ALLOWS_PROFILING_WITHOUT_FRAME_POINTER): Define it to false. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-3_0-branch@42311 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 11 +++++++++++ gcc/config/i386/linux.h | 9 +++++++++ gcc/defaults.h | 7 +++++++ gcc/tm.texi | 15 +++++++++++++++ gcc/toplev.c | 10 ++++++++++ 5 files changed, 52 insertions(+) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 63bb4582276..04ee3cac8e7 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,14 @@ +2001-05-19 Mark Mitchell + + * defaults.h (TARGET_ALLOWS_PROFILING_WITHOUT_FRAME_POINTER): New + macro. + * tm.texi (TARGET_ALLOWS_PROFILING_WITHOUT_FRAME_POINTER): + Document it. + * toplev.c (main): If the target does not allow profiling without + a frame pointer, issue an error message. + * config/i386/linux.h (TARGET_ALLOWS_PROFILING_WITHOUT_FRAME_POINTER): + Define it to false. + Sat May 19 09:40:45 2001 Denis Chertykov * regrename.c (regrename_optimize): frame pointer register can diff --git a/gcc/config/i386/linux.h b/gcc/config/i386/linux.h index 8f9545c2c71..09cf70ca732 100644 --- a/gcc/config/i386/linux.h +++ b/gcc/config/i386/linux.h @@ -72,6 +72,15 @@ Boston, MA 02111-1307, USA. */ fprintf (FILE, "\tcall\tmcount\n"); \ } +/* True if it is possible to profile code that does not have a frame + pointer. + + The GLIBC version of mcount for the x86 assumes that there is a + frame, so we cannot allow profiling without a frame pointer. */ + +#undef TARGET_ALLOWS_PROFILING_WITHOUT_FRAME_POINTER +#define TARGET_ALLOWS_PROFILING_WITHOUT_FRAME_POINTER false + #undef SIZE_TYPE #define SIZE_TYPE "unsigned int" diff --git a/gcc/defaults.h b/gcc/defaults.h index 58b77409236..22cd3830809 100644 --- a/gcc/defaults.h +++ b/gcc/defaults.h @@ -319,5 +319,12 @@ do { \ #define ASM_PREFERRED_EH_DATA_FORMAT(CODE,GLOBAL) DW_EH_PE_absptr #endif +/* True if it is possible to profile code that does not have a frame + pointer. */ + +#ifndef TARGET_ALLOWS_PROFILING_WITHOUT_FRAME_POINTER +#define TARGET_ALLOWS_PROFILING_WITHOUT_FRAME_POINTER true +#endif + #endif /* GCC_DEFAULTS_H */ diff --git a/gcc/tm.texi b/gcc/tm.texi index 8a9f0170531..caefab51b70 100644 --- a/gcc/tm.texi +++ b/gcc/tm.texi @@ -3998,6 +3998,21 @@ Registers or condition codes clobbered by @code{FUNCTION_PROLOGUE} or @item BLOCK_PROFILER_CODE A C function or functions which are needed in the library to support block profiling. + +@findex TARGET_ALLOWS_PROFILING_WITHOUT_FRAME_POINTER +@item TARGET_ALLOWS_PROFILING_WITHOUT_FRAME_POINTER +On some targets, it is impossible to use profiling when the frame +pointer has been omitted. For example, on x86 GNU/Linux systems, +the @code{mcount} routine provided by the GNU C Library finds the +address of the routine that called the routine that called @code{mcount} +by looking in the immediate caller's stack frame. If the immediate +caller has no frame pointer, this lookup will fail. + +By default, GCC assumes that the target does allow profiling when the +frame pointer is omitted. This macro should be defined to a C +expression that evaluates to @code{false} if the target does not allow +profiling when the frame pointer is omitted. + @end table @node Inlining diff --git a/gcc/toplev.c b/gcc/toplev.c index ddde8ef6613..e825a30d704 100644 --- a/gcc/toplev.c +++ b/gcc/toplev.c @@ -4907,6 +4907,16 @@ main (argc, argv) warning ("this target machine does not have delayed branches"); #endif + /* Some operating systems do not allow profiling without a frame + pointer. */ + if (!TARGET_ALLOWS_PROFILING_WITHOUT_FRAME_POINTER + && profile_flag + && flag_omit_frame_pointer) + { + error ("profiling does not work without a frame pointer"); + flag_omit_frame_pointer = 0; + } + user_label_prefix = USER_LABEL_PREFIX; if (flag_leading_underscore != -1) { -- 2.11.4.GIT