Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1LgmID-0007aB-7G for mharc-grub-devel@gnu.org; Mon, 09 Mar 2009 16:41:45 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LgmIB-0007Xu-48 for grub-devel@gnu.org; Mon, 09 Mar 2009 16:41:43 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LgmI8-0007VS-KV for grub-devel@gnu.org; Mon, 09 Mar 2009 16:41:42 -0400 Received: from [199.232.76.173] (port=33933 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LgmI8-0007V2-BH for grub-devel@gnu.org; Mon, 09 Mar 2009 16:41:40 -0400 Received: from c60.cesmail.net ([216.154.195.49]:16975) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_ARCFOUR_SHA1:16) (Exim 4.60) (envelope-from ) id 1LgmI7-0004Y1-L6 for grub-devel@gnu.org; Mon, 09 Mar 2009 16:41:39 -0400 Received: from unknown (HELO smtprelay2.cesmail.net) ([192.168.1.112]) by c60.cesmail.net with ESMTP; 09 Mar 2009 16:41:37 -0400 Received: from [192.168.0.22] (static-72-92-88-10.phlapa.fios.verizon.net [72.92.88.10]) by smtprelay2.cesmail.net (Postfix) with ESMTPSA id 9DEF134C6D for ; Mon, 9 Mar 2009 16:41:14 -0400 (EDT) From: Pavel Roskin To: grub-devel@gnu.org Content-Type: text/plain Date: Mon, 09 Mar 2009 16:41:35 -0400 Message-Id: <1236631295.22674.20.camel@mj> Mime-Version: 1.0 X-Mailer: Evolution 2.24.5 (2.24.5-1.fc10) Content-Transfer-Encoding: 7bit X-detected-operating-system: by monty-python.gnu.org: Genre and OS details not recognized. Subject: [PATCH] Eliminate grub_CHECK_START_SYMBOL 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: Mon, 09 Mar 2009 20:41:43 -0000 Hello! It should be possible to compile grub for i386-pc on a pure x64_64 system with i386 support in the compiler and binutils, but without 32-bit libc or its headers. It requires several unrelated changes. This is the first step. It's a pure simplification. The grub_CHECK_START_SYMBOL defines START_SYMBOL either as "start" or as "_start". But it really doesn't matter. START_SYMBOL is only used in kern/i386/pc/startup.S, where both "start" and "_start" are explicitly defined labels pointing to the same code. EXT_C(start) also expands to "start" or "_start", so it can be replaced with "_start" as well. ChangeLog: * kern/i386/pc/startup.S: Replace EXT_C(start) and START_SYMBOL with _start, as it's always equal to start. * configure.ac: Don't call grub_CHECK_START_SYMBOL. It's not needed, as we no longer use START_SYMBOL. * aclocal.m4 (grub_CHECK_START_SYMBOL): Remove. Index: kern/i386/pc/startup.S =================================================================== --- kern/i386/pc/startup.S (revision 2024) +++ kern/i386/pc/startup.S (working copy) @@ -53,7 +53,7 @@ #include #include -#define ABS(x) ((x) - EXT_C(start) + GRUB_BOOT_MACHINE_KERNEL_ADDR + 0x200) +#define ABS(x) ((x) - _start + GRUB_BOOT_MACHINE_KERNEL_ADDR + 0x200) .file "startup.S" @@ -77,14 +77,14 @@ * These MUST be at byte offset 6 and 7 of the executable * DO NOT MOVE !!! */ - . = EXT_C(start) + 0x6 + . = _start + 0x6 .byte GRUB_BOOT_VERSION_MAJOR, GRUB_BOOT_VERSION_MINOR /* * This is a special data area 8 bytes from the beginning. */ - . = EXT_C(start) + 0x8 + . = _start + 0x8 VARIABLE(grub_total_module_size) .long 0 @@ -103,7 +103,7 @@ * Leave some breathing room for the prefix. */ - . = EXT_C(start) + GRUB_KERNEL_MACHINE_DATA_END + . = _start + GRUB_KERNEL_MACHINE_DATA_END /* * Support for booting GRUB from a Multiboot boot loader (e.g. GRUB itself). @@ -202,7 +202,7 @@ #if defined(ENABLE_LZO) /* decompress the compressed part and put the result at 1MB */ movl $GRUB_MEMORY_MACHINE_DECOMPRESSION_ADDR, %esi - movl $(START_SYMBOL + GRUB_KERNEL_MACHINE_RAW_SIZE), %edi + movl $(_start + GRUB_KERNEL_MACHINE_RAW_SIZE), %edi pushl %esi pushl EXT_C(grub_compressed_size) @@ -214,7 +214,7 @@ cld #elif defined(ENABLE_LZMA) movl $GRUB_MEMORY_MACHINE_DECOMPRESSION_ADDR, %edi - movl $(START_SYMBOL + GRUB_KERNEL_MACHINE_RAW_SIZE), %esi + movl $(_start + GRUB_KERNEL_MACHINE_RAW_SIZE), %esi pushl %edi pushl %esi movl EXT_C(grub_kernel_image_size), %ecx @@ -239,7 +239,7 @@ movl EXT_C(grub_total_module_size), %ecx movl EXT_C(grub_kernel_image_size), %esi addl %ecx, %esi - addl $START_SYMBOL, %esi + addl $_start, %esi decl %esi movl $END_SYMBOL, %edi addl %ecx, %edi @@ -282,7 +282,7 @@ .long 0 VARIABLE(grub_start_addr) - .long START_SYMBOL + .long _start VARIABLE(grub_end_addr) .long END_SYMBOL @@ -510,7 +510,7 @@ * The code beyond this point is compressed. Assert that the uncompressed * code fits GRUB_KERNEL_MACHINE_RAW_SIZE. */ - . = EXT_C(start) + GRUB_KERNEL_MACHINE_RAW_SIZE + . = _start + GRUB_KERNEL_MACHINE_RAW_SIZE /* * This call is special... it never returns... in fact it should simply Index: configure.ac =================================================================== --- configure.ac (revision 2024) +++ configure.ac (working copy) @@ -383,7 +383,6 @@ CFLAGS="$TARGET_CFLAGS -nostdlib $TARGET_IMG_LDFLAGS_AC -Wl,-Ttext,8000,--defsym,___main=0x8100" fi if test "x$platform" = xpc; then - grub_CHECK_START_SYMBOL grub_CHECK_BSS_START_SYMBOL grub_CHECK_END_SYMBOL fi Index: aclocal.m4 =================================================================== --- aclocal.m4 (revision 2024) +++ aclocal.m4 (working copy) @@ -224,39 +224,6 @@ AC_MSG_RESULT([$grub_cv_i386_asm_absolute_without_asterisk])]) -dnl Check what symbol is defined as a start symbol. -dnl Written by Yoshinori K. Okuji. -AC_DEFUN(grub_CHECK_START_SYMBOL, -[AC_REQUIRE([AC_PROG_CC]) -AC_MSG_CHECKING([if start is defined by the compiler]) -AC_CACHE_VAL(grub_cv_check_start_symbol, -[AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], - [[asm ("incl start")]])], - [grub_cv_check_start_symbol=yes], - [grub_cv_check_start_symbol=no])]) - -AC_MSG_RESULT([$grub_cv_check_start_symbol]) - -AC_MSG_CHECKING([if _start is defined by the compiler]) -AC_CACHE_VAL(grub_cv_check_uscore_start_symbol, -[AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], - [[asm ("incl _start")]])], - [grub_cv_check_uscore_start_symbol=yes], - [grub_cv_check_uscore_start_symbol=no])]) - -AC_MSG_RESULT([$grub_cv_check_uscore_start_symbol]) - -AH_TEMPLATE([START_SYMBOL], [Define it to either start or _start]) - -if test "x$grub_cv_check_start_symbol" = xyes; then - AC_DEFINE([START_SYMBOL], [start]) -elif test "x$grub_cv_check_uscore_start_symbol" = xyes; then - AC_DEFINE([START_SYMBOL], [_start]) -else - AC_MSG_ERROR([neither start nor _start is defined]) -fi -]) - dnl Check what symbol is defined as a bss start symbol. dnl Written by Michael Hohmoth and Yoshinori K. Okuji. AC_DEFUN(grub_CHECK_BSS_START_SYMBOL, -- Regards, Pavel Roskin