grub-devel
[Top][All Lists]
Advanced

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

[PATCH] Fix for configure on x86_64 (Was: Re: [patch] Fix for building c


From: Jeroen Dekkers
Subject: [PATCH] Fix for configure on x86_64 (Was: Re: [patch] Fix for building correct code on i386-pc (CVS-HEAD))
Date: Wed, 31 May 2006 23:00:51 +0200
User-agent: Wanderlust/2.14.0 (Africa) SEMI/1.14.6 (Maruoka) FLIM/1.14.8 (Shijō) APEL/10.6 Emacs/22.0.50 (x86_64-pc-linux-gnu) MULE/5.0 (SAKAKI)

At Wed, 31 May 2006 02:31:49 +0200,
Yoshinori K. Okuji wrote:
> 
> On Wednesday 31 May 2006 00:00, Hollis Blanchard wrote:
> > On Tue, 2006-05-30 at 22:59 -0500, Harley D. Eades III wrote:
> > > http://lists.gnu.org/archive/html/grub-devel/2006-05/msg00106.html
> >
> > "host" and "target" are unclear to me here. For example, grub-emu would
> > be compiled for the "host", but grub itself would be for the "target"?
> > When would you ever want to build things differently like that?
> 
> This is one of the requested features for GRUB. In GRUB Legacy, some group 
> developed GRUB on Sparc, but for PC by cross-compiling (actually, this was 
> Alcatel). It is a good thing that you can install GRUB for an architecture on 
> another.

It's actually a necessary feature for GRUB on amd64. On amd64 you have
64-bit executables but GRUB will run in 32-bit mode.

When trying to compile on amd64 I already ran into some problems
related to that. First of all on amd64 all binaries are run in 64-bit
mode, so the host CFLAGS variable shouldn't have -m32. Secondly LIBS
is for the host only and shouldn't be defined when running target
tests. As last we set CFLAGS, CC, etc. to the TARGET_*, then we run
some checks and change the TARGET_* flags without updating CC, CFLAGS,
etc to the new version.

The attached patch should fix those problems. I've tested it on i386-pc
and x86_64.


2006-05-31  Jeroen Dekkers  <address@hidden>

        * configure.ac: Don't set host_m32 for x86_64. Also reset LIBS
        for the target-specific tests. Make sure that we also have the
        up-to-date target variables for those tests.

Index: configure.ac
===================================================================
RCS file: /cvsroot/grub/grub2/configure.ac,v
retrieving revision 1.29
diff -u -p -r1.29 configure.ac
--- configure.ac        30 May 2006 00:32:29 -0000      1.29
+++ configure.ac        31 May 2006 19:51:10 -0000
@@ -41,7 +41,6 @@ AC_CANONICAL_HOST
 AC_CANONICAL_TARGET
 
 case "$host_cpu" in
-  x86_64) host_m32=1 ;;
   powerpc64) host_m32=1 ;;
 esac
 
@@ -186,10 +185,12 @@ tmp_CC="$CC"
 tmp_CFLAGS="$CFLAGS"
 tmp_LDFLAGS="$LDFLAGS"
 tmp_CPPFLAGS="$CPPFLAGS"
+tmp_LIBS="$LIBS"
 CC="$TARGET_CC"
 CFLAGS="$TARGET_CFLAGS"
 CPPFLAGS="$TARGET_CPPFLAGS"
 LDFLAGS="$TARGET_LDFLAGS"
+LIBS=""
 
 if test "x$TARGET_CFLAGS" = x; then
   # debug flags.
@@ -232,6 +233,12 @@ AC_SUBST(TARGET_CFLAGS)
 AC_SUBST(TARGET_CPPFLAGS)
 AC_SUBST(TARGET_LDFLAGS)
 
+# Set them to their new values for the tests below.
+CC="$TARGET_CC"
+CFLAGS="$TARGET_CFLAGS"
+CPPFLAGS="$TARGET_CPPFLAGS"
+LDFLAGS="$TARGET_LDFLAGS"
+
 # Defined in aclocal.m4.
 grub_PROG_OBJCOPY_ABSOLUTE
 grub_ASM_USCORE
@@ -252,6 +259,7 @@ CC="$tmp_CC"
 CFLAGS="$tmp_CFLAGS"
 CPPFLAGS="$tmp_CPPFLAGS"
 LDFLAGS="$tmp_LDFLAGS"
+LIBS="$tmp_LIBS"
 
 # Check for options.
 AC_ARG_ENABLE([mm-debug], 





reply via email to

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