bug-grub
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] Switch to non-deprecated compiler options


From: Jeremy Katz
Subject: Re: [PATCH] Switch to non-deprecated compiler options
Date: 02 Oct 2002 16:52:46 -0400

On Wed, 2002-10-02 at 00:30, Yoshinori K. Okuji wrote:
> At 01 Oct 2002 17:16:06 -0400,
> Jeremy Katz wrote:
> > The use of -m flags for align-jumps, align-loops, and align-functions is
> > deprecated in gcc 3.2  The following patch switches to the supported
> > options of -falign-jumps, -falign-loops, and -falign-functions
> > respectively.
> 
> Since when have -falign-{jumps,loops,functions} been supported? IIRC,
> they are not supported by gcc 2.x, not even by 2.95.3. So I don't
> think it would be a Good Thing to just switch to them. Instead, you
> should check if the compiler accepts them in the configure script.

Whoops, sorry -- I didn't have a copy of 2.95.3 installed and my
timescale for the age of 2.95 was off a bit when I checked in the gcc
changelog.

The following patch should do the check and then use the -f variant if
it exists, falling back to the -m variant if not.

Cheers,

Jeremy

Index: ChangeLog
===================================================================
RCS file: /cvsroot/grub/grub/ChangeLog,v
retrieving revision 1.522
diff -u -u -r1.522 ChangeLog
--- ChangeLog   13 Sep 2002 11:49:56 -0000      1.522
+++ ChangeLog   2 Oct 2002 20:44:53 -0000
@@ -1,3 +1,9 @@
+2002-10-02  Jeremy Katz  <address@hidden>
+
+       * configure.in (CPPFLAGS): Check if -falign-jumps, -falign-loops,
+       and -falign-functions exist to use instead of deprecated machine 
+       dependent versions.
+
 2002-09-13  Yoshinori K. Okuji  <address@hidden>
 
        * stage2/serial.c (fill_input_buf): Take a new argument NOWAIT.
Index: configure.in
===================================================================
RCS file: /cvsroot/grub/grub/configure.in,v
retrieving revision 1.72
diff -u -u -r1.72 configure.in
--- configure.in        8 Sep 2002 02:01:14 -0000       1.72
+++ configure.in        2 Oct 2002 20:44:54 -0000
@@ -108,11 +108,42 @@
   CPPFLAGS=$saved_CPPFLAGS
 ])
 
-# Force no alignment to save space.
-CPPFLAGS="$CPPFLAGS -malign-jumps=1 -malign-loops=1 -malign-functions=1"
-
 if test "x$undef_flag" = xyes; then
   CPPFLAGS="$CPPFLAGS -Wundef"
+fi
+
+# Force no alignment to save space.
+AC_CACHE_CHECK([whether -falign-loops works], falignloop_flag, [
+  saved_CPPFLAGS=$CPPFLAGS
+  CPPFLAGS="-falign-loops=1"
+  AC_TRY_COMPILE(, , falignloop_flag=yes, falignloop_flag=no)
+  CPPFLAGS=$saved_CPPFLAGS
+])
+
+if test "x$falignloop_flag" = xyes; then
+  CPPFLAGS="$CPPFLAGS -falign-loops=1"
+fi
+
+AC_CACHE_CHECK([whether -falign-functions works], falignfunction_flag, [
+  saved_CPPFLAGS=$CPPFLAGS
+  CPPFLAGS="-falign-functions=1"
+  AC_TRY_COMPILE(, , falignfunction_flag=yes, falignfunction_flag=no)
+  CPPFLAGS=$saved_CPPFLAGS
+])
+
+if test "x$falignfunction_flag" = xyes; then
+  CPPFLAGS="$CPPFLAGS -falign-functions=1"
+fi
+
+AC_CACHE_CHECK([whether -falign-jumps works], falignjump_flag, [
+  saved_CPPFLAGS=$CPPFLAGS
+  CPPFLAGS="-falign-jumps=1"
+  AC_TRY_COMPILE(, , falignjump_flag=yes, falignjump_flag=no)
+  CPPFLAGS=$saved_CPPFLAGS
+])
+
+if test "x$falignjump_flag" = xyes; then
+  CPPFLAGS="$CPPFLAGS -falign-jumps=1"
 fi
 
 if test "x$with_binutils" != x; then







reply via email to

[Prev in Thread] Current Thread [Next in Thread]