grub-devel
[Top][All Lists]
Advanced

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

Re: [PATCH] make grub2 compile with libc-less crosscompilers


From: Patrick Georgi
Subject: Re: [PATCH] make grub2 compile with libc-less crosscompilers
Date: Thu, 31 May 2007 16:59:49 +0200
User-agent: Thunderbird 2.0b2 (X11/20070411)

Hi,

any more comments or questions on this patch, so I can improve it if necessary?


Thanks,
Patrick Georgi
Index: aclocal.m4
===================================================================
RCS file: /sources/grub/grub2/aclocal.m4,v
retrieving revision 1.6
diff -u -r1.6 aclocal.m4
--- aclocal.m4  3 Feb 2007 11:36:13 -0000       1.6
+++ aclocal.m4  19 May 2007 15:07:33 -0000
@@ -188,10 +188,20 @@
 AC_MSG_RESULT([$grub_cv_i386_asm_absolute_without_asterisk])])
 
 
+dnl Build wrapped code with different cflags, restore cflags at the end
+dnl Written by Patrick Georgi
+dnl grub_WRAP_FOR_CFLAGS([CFLAGS],[actual code])
+AC_DEFUN(grub_WRAP_FOR_CFLAGS,
+[save_CFLAGS=$CFLAGS
+CFLAGS="$1"
+$2
+CFLAGS=$save_CFLAGS])
+
 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])
+grub_WRAP_FOR_CFLAGS([-nostdlib -fno-builtin],[
 AC_MSG_CHECKING([if start is defined by the compiler])
 AC_CACHE_VAL(grub_cv_check_start_symbol,
 [AC_TRY_LINK([], [asm ("incl start")],
@@ -215,14 +225,18 @@
 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])
+  dnl assume some default in case none exists (eg. libc-less xcompiler)
+  dnl the code provides both of them
+  AC_DEFINE([START_SYMBOL], [_start])
 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,
 [AC_REQUIRE([AC_PROG_CC])
+grub_WRAP_FOR_CFLAGS([-nostdlib -fno-builtin],[
 AC_MSG_CHECKING([if __bss_start is defined by the compiler])
 AC_CACHE_VAL(grub_cv_check_uscore_uscore_bss_start_symbol,
 [AC_TRY_LINK([], [asm ("incl __bss_start")],
@@ -259,11 +273,13 @@
   AC_MSG_ERROR([none of __bss_start, edata or _edata is defined])
 fi
 ])
+])
 
 dnl Check what symbol is defined as an end symbol.
 dnl Written by Yoshinori K. Okuji.
 AC_DEFUN(grub_CHECK_END_SYMBOL,
 [AC_REQUIRE([AC_PROG_CC])
+grub_WRAP_FOR_CFLAGS([-nostdlib -fno-builtin],[
 AC_MSG_CHECKING([if end is defined by the compiler])
 AC_CACHE_VAL(grub_cv_check_end_symbol,
 [AC_TRY_LINK([], [asm ("incl end")],
@@ -290,6 +306,7 @@
   AC_MSG_ERROR([neither end nor _end is defined])
 fi
 ])
+])
 
 dnl Check if the C compiler has a bug while using nested functions when
 dnl mregparm is used on the i386.  Some gcc versions do not pass the third

reply via email to

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