[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH] Eliminate grub_CHECK_START_SYMBOL
From: |
Pavel Roskin |
Subject: |
[PATCH] Eliminate grub_CHECK_START_SYMBOL |
Date: |
Mon, 09 Mar 2009 16:41:35 -0400 |
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 <multiboot.h>
#include <multiboot2.h>
-#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
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [PATCH] Eliminate grub_CHECK_START_SYMBOL,
Pavel Roskin <=