diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index d8598505427a0b23f6990491eb5f19c07e844e1e..64a0c1457212b833836eb98c305ab4b0c4bd4ece 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,14 @@
+2001-05-19  Mark Mitchell  <mark@codesourcery.com>
+
+	* 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 07:53:42 2001  Richard Kenner  <kenner@vlsi1.ultra.nyu.edu>
 
 	* recog.c (general_operand): Modify last change to allow it if reload
@@ -102,6 +113,16 @@ Fri May 18 15:39:16 CEST 2001  Jan Hubicka  <jh@suse.cz>
 
 2001-05-18  Mark Mitchell  <mark@codesourcery.com>
 
+	* basic-block.h (struct basic_block_def): Add documentation about
+	what a basic block is, and what the various fields are used for.
+	* flow.c (calculate_globlal_regs_live): Add documentation about
+	how the algorithm works, and how we know that it will terminate.
+	Check that the the inductive assumption that guarantees
+	termination actually holds.
+	(mark_used_regs): Treat conditionally set registers as used.
+	(debug_regset): Add comment.
+	* rtl.texi (cond_exec): Add documentation.
+
 	* function.c (expand_function_start): Avoid creating BLKmode
 	pseudos.
 
diff --git a/gcc/config/i386/linux.h b/gcc/config/i386/linux.h
index a93955092f2b852378175d6f36cb82db484edf9b..108a6fbaac8f469cb8dbd33b27b2914a57e0e148 100644
--- a/gcc/config/i386/linux.h
+++ b/gcc/config/i386/linux.h
@@ -73,6 +73,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 45fb088785fcda6273921cb944d7ad87a6b0030f..452bdfe44cd32982fa98b4caf287b9eadabfa7c1 100644
--- a/gcc/defaults.h
+++ b/gcc/defaults.h
@@ -336,5 +336,12 @@ do {								\
    ? ptrmemfunc_vbit_in_pfn : ptrmemfunc_vbit_in_delta)
 #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 2c1fe71a8e53e440bbd0bfc5b387134584bc75e0..d745902d90ad95cd6ab16a089689279ce984c40c 100644
--- a/gcc/tm.texi
+++ b/gcc/tm.texi
@@ -3992,6 +3992,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 d64cb3a217387bcf0da2284c480f47fd4b844327..802446e4bb558f747806fcf4ee9a9aac7a073245 100644
--- a/gcc/toplev.c
+++ b/gcc/toplev.c
@@ -4932,6 +4932,16 @@ toplev_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)
     {