Grub Development Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Patrick Georgi <patrick@georgi-clan.de>
To: grub-devel@gnu.org
Subject: Re: [PATCH] make grub2 compile with libc-less crosscompilers
Date: Thu, 31 May 2007 16:59:49 +0200	[thread overview]
Message-ID: <f3mnra$fuj$1@sea.gmane.org> (raw)
In-Reply-To: <464F1811.7060507@georgi-clan.de>

[-- Attachment #1: Type: text/plain, Size: 111 bytes --]

Hi,

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


Thanks,
Patrick Georgi

[-- Attachment #2: patch-20070519-1-grub2-configure-script-on-libc-less-cross-compiler --]
[-- Type: text/plain, Size: 2353 bytes --]

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

      parent reply	other threads:[~2007-05-31 14:59 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-05-19 15:30 [PATCH] make grub2 compile with libc-less crosscompilers Patrick Georgi
2007-05-19 17:44 ` Yoshinori K. Okuji
2007-05-19 17:53   ` Patrick Georgi
2007-05-20 17:45   ` Stefan Reinauer
2007-06-04 17:03   ` Patrick Georgi
2007-05-31 14:59 ` Patrick Georgi [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='f3mnra$fuj$1@sea.gmane.org' \
    --to=patrick@georgi-clan.de \
    --cc=grub-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox