[m-dev.] diff: Add `-fomit-frame-pointer' to CFLAGS_FOR_GOTOS on mips-*

Fergus Henderson fjh at cs.mu.OZ.AU
Wed Sep 15 04:05:02 AEST 1999


Estimated hours taken: 2

Fix a bug where tests/hard_coded/integer_test.m failed
on munta in grade asm_fast.gc with options -O0 when linked
against a library compiled with -O0 and --split-c-files.
The problem was due to `-O0' plus `--split-c-files' causing
gcc to be invoked without `-O2 -fomit-frame-pointer'; the
lack of `-fomit-frame-pointer' caused problems for non-local gotos.

configure.in:
        Add `-fomit-frame-pointer' to CFLAGS_FOR_GOTOS on mips-*.

	This is related to my change of 1998/05/20 which did the
	same thing for alpha:
	    | configure.in:
	    |  Add `-fomit-frame-pointer' to CFLAGS_FOR_GOTOS on alpha-*.
            |  Empirically, this seems to be needed, otherwise lots of
            |  the test cases fail when compiled with `--no-c-optimize'.
            |  (It might also be needed for other architectures, I don't know.)

	This time I also added some comments explaining why this is needed.

Workspace: /home/mercury0/fjh/mercury
Index: configure.in
===================================================================
RCS file: /home/mercury1/repository/mercury/configure.in,v
retrieving revision 1.179
diff -u -r1.179 configure.in
--- configure.in	1999/09/13 06:34:24	1.179
+++ configure.in	1999/09/14 17:55:31
@@ -1246,13 +1246,22 @@
 #-----------------------------------------------------------------------------#
 #
 # On sparc, x86, and probably on other architectures,
-# for egcs 1.1, if we're using non-local gotos, then we need
-# `-fno-gcse -fno-function-cse'.
-# (Actually I don't know if _both_ of these are needed.
-# Maybe you can get away with just one of them.)
-# Earlier versions of gcc will just ignore those arguments,
-# so we don't need to conditionalize that on the gcc version.
+# if we're using non-local gotos, then for egcs 1.1, we need
+# `-fno-gcse -fno-function-cse', and for gcc 2.8 we need `-fno-function-cse'.
+# Otherwise gcc generates code which initializes registers in the function
+# prologue and expects them to be valid later on, which doesn't work with
+# non-local gotos, since we jump directly into the middle of a function.
+# (Actually I don't know if `-fno-functions-cse' is really needed.
+# Maybe you can get away without it.  But better to err on the safe side...)
 #
+# For alpha and for mips, and probably on other architectures, when using
+# non-local gotos we need -fomit-frame-pointer, otherwise when compiling
+# with --no-c-optimize we run into a problem similar to the one above:
+# Gcc generates code which initializes the frame pointer in the
+# function prologue, and then expects it to be valid later on, which
+# doesn't work with non-local gotos, since we jump directly into the
+# middle of a function.
+#
 # For Irix 5, gcc labels don't work with shared libraries,
 # so if we're using gcc labels, we need to use non-shared libraries,
 # which means passing -non_shared and -mno-abicalls and also setting
@@ -1278,6 +1287,11 @@
 		CFLAGS_FOR_GOTOS="$CFLAGS_FOR_GOTOS -non_shared -mno-abicalls"
 LIBRARY_PATH="$NONSHARED_LIB_DIR:/usr/lib/nonshared:$LIBRARY_PATH"
 		export LIBRARY_PATH
+		;;
+esac
+case "$host" in
+	mips-*)
+		CFLAGS_FOR_GOTOS="$CFLAGS_FOR_GOTOS -fomit-frame-pointer"
 		;;
 	i?86-*)
 		CC="$CC -fno-builtin -fno-omit-frame-pointer"

-- 
Fergus Henderson <fjh at cs.mu.oz.au>  |  "I have always known that the pursuit
WWW: <http://www.cs.mu.oz.au/~fjh>  |  of excellence is a lethal habit"
PGP: finger fjh at 128.250.37.3        |     -- the last words of T. S. Garp.
--------------------------------------------------------------------------
mercury-developers mailing list
Post messages to:       mercury-developers at cs.mu.oz.au
Administrative Queries: owner-mercury-developers at cs.mu.oz.au
Subscriptions:          mercury-developers-request at cs.mu.oz.au
--------------------------------------------------------------------------



More information about the developers mailing list