From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1KR4VQ-0004Fz-L9 for mharc-grub-devel@gnu.org; Thu, 07 Aug 2008 08:22:12 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1KR4VP-0004Ek-RX for grub-devel@gnu.org; Thu, 07 Aug 2008 08:22:11 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1KR4VP-0004Db-2n for grub-devel@gnu.org; Thu, 07 Aug 2008 08:22:11 -0400 Received: from [199.232.76.173] (port=44063 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KR4VP-0004DR-0Z for grub-devel@gnu.org; Thu, 07 Aug 2008 08:22:11 -0400 Received: from aybabtu.com ([69.60.117.155]:53405) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1KR4VO-0001aP-OF for grub-devel@gnu.org; Thu, 07 Aug 2008 08:22:10 -0400 Received: from [192.168.10.10] (helo=thorin) by aybabtu.com with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.69) (envelope-from ) id 1KR4Nu-0003h9-2K for grub-devel@gnu.org; Thu, 07 Aug 2008 14:14:26 +0200 Received: from rmh by thorin with local (Exim 4.63) (envelope-from ) id 1KR4UJ-0002f0-RO for grub-devel@gnu.org; Thu, 07 Aug 2008 14:21:03 +0200 Date: Thu, 7 Aug 2008 14:21:03 +0200 From: Robert Millan To: The development of GRUB 2 Message-ID: <20080807122103.GA10038@thorin> References: <1217809888.6283.27.camel@fz.local> <20080804091619.GA737@thorin> <1217854285.27237.6.camel@dv> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="C7zPtVaVf+AK4Oqc" Content-Disposition: inline In-Reply-To: <1217854285.27237.6.camel@dv> Organization: free as in freedom X-Message-Flag: Worried about Outlook viruses? Switch to Thunderbird! www.mozilla.com/thunderbird X-Debbugs-No-Ack: true User-Agent: Mutt/1.5.13 (2006-08-11) X-detected-kernel: by monty-python.gnu.org: Genre and OS details not recognized. Subject: merging i386-efi and x86_64-efi (Re: Current SVN is broken on x86_64) X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: The development of GRUB 2 List-Id: The development of GRUB 2 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Aug 2008 12:22:12 -0000 --C7zPtVaVf+AK4Oqc Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Mon, Aug 04, 2008 at 08:51:25AM -0400, Pavel Roskin wrote: > On Mon, 2008-08-04 at 11:16 +0200, Robert Millan wrote: > > > Furthermore, I had a look and some of the x86_64 versions are just stubs that > > include the i386 one. > > > > Why don't we handle this like Linux? They ship a single directory and use > > #ifdefs where appropiate. That enforces consistency in the dir layout. > > I think we can do it. i386 and x86_64 could be joined into one "x86" > architecture with common headers and sources. Perhaps the users should > still use i386 and x86_64 in configure, but the code should be mostly > common. I gave a try at this, which I haven't completed yet. Here's what I have so far. The biggest stumbling block seems to be that autoconf doesn't make it easy to do AC_CHECK_SIZEOF checks for standard compiling and cross-compiling in the same run (it does support cross-compiling though). I haven't found a way to do it. If I modify types.m4 to export its findings to a variable instead of dumping them to config.h directly, further calls to the same check won't return different results, even if CC / CFLAGS has been adjusted. -- Robert Millan The DRM opt-in fallacy: "Your data belongs to us. We will decide when (and how) you may access your data; but nobody's threatening your freedom: we still allow you to remove your data and not access it at all." --C7zPtVaVf+AK4Oqc Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="efi_build.diff" Index: conf/i386-efi.rmk =================================================================== --- conf/i386-efi.rmk (revision 1787) +++ conf/i386-efi.rmk (working copy) @@ -1,8 +1,8 @@ # -*- makefile -*- -COMMON_ASFLAGS = -nostdinc -fno-builtin -m32 -COMMON_CFLAGS = -fno-builtin -m32 -COMMON_LDFLAGS = -melf_i386 -nostdlib +COMMON_ASFLAGS = -nostdinc -fno-builtin +COMMON_CFLAGS = -fno-builtin +COMMON_LDFLAGS = -nostdlib # Used by various components. These rules need to precede them. normal/lexer.c_DEPENDENCIES = grub_script.tab.h Index: configure.ac =================================================================== --- configure.ac (revision 1787) +++ configure.ac (working copy) @@ -75,7 +75,6 @@ # Adjust CPU unless target was explicitly specified. if test -z "$target_alias"; then case "$target_cpu"-"$platform" in - x86_64-efi) ;; x86_64-*) target_cpu=i386 ;; powerpc64-ieee1275) target_cpu=powerpc ;; esac @@ -84,21 +83,15 @@ # Check if the platform is supported, make final adjustments. case "$target_cpu"-"$platform" in i386-efi) ;; - x86_64-efi) ;; - i386-pc) ;; - i386-coreboot) ;; - i386-linuxbios) platform=coreboot ;; - i386-ieee1275) ;; + i386-pc) target_m32=1 ;; + i386-coreboot) target_m32=1 ;; + i386-linuxbios) target_m32=1 ; platform=coreboot ;; + i386-ieee1275) target_m32=1 ;; powerpc-ieee1275) ;; sparc64-ieee1275) ;; *) AC_MSG_ERROR([platform "$platform" is not supported for target CPU "$target_cpu"]) ;; esac -case "$target_cpu" in - i386 | powerpc) target_m32=1 ;; - x86_64 | sparc64) target_m64=1 ;; -esac - AC_SUBST(target_cpu) AC_SUBST(platform) Index: include/grub/i386/setjmp.h =================================================================== --- include/grub/i386/setjmp.h (revision 1787) +++ include/grub/i386/setjmp.h (working copy) @@ -19,10 +19,19 @@ #ifndef GRUB_SETJMP_CPU_HEADER #define GRUB_SETJMP_CPU_HEADER 1 -typedef unsigned long grub_jmp_buf[6]; +typedef unsigned long grub_jmp_buf[8]; +#ifdef __x86_64__ + +int grub_setjmp (grub_jmp_buf env); +void grub_longjmp (grub_jmp_buf env, int val) __attribute__ ((noreturn)); + +#else + int grub_setjmp (grub_jmp_buf env) __attribute__ ((cdecl, regparm (3))); void grub_longjmp (grub_jmp_buf env, int val) __attribute__ ((noreturn, cdecl, regparm (3))); +#endif + #endif /* ! GRUB_SETJMP_CPU_HEADER */ Index: include/grub/i386/types.h =================================================================== --- include/grub/i386/types.h (revision 1787) +++ include/grub/i386/types.h (working copy) @@ -19,12 +19,24 @@ #ifndef GRUB_TYPES_CPU_HEADER #define GRUB_TYPES_CPU_HEADER 1 +#ifdef __i386__ + /* The size of void *. */ #define GRUB_TARGET_SIZEOF_VOID_P 4 /* The size of long. */ #define GRUB_TARGET_SIZEOF_LONG 4 +#else + +/* The size of void *. */ +#define GRUB_TARGET_SIZEOF_VOID_P 8 + +/* The size of long. */ +#define GRUB_TARGET_SIZEOF_LONG 8 + +#endif + /* i386 is little-endian. */ #undef GRUB_TARGET_WORDS_BIGENDIAN --C7zPtVaVf+AK4Oqc--