grub-devel
[Top][All Lists]
Advanced

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

Re: GRUB2 Build on Mac OS X


From: Andrei Warkentin
Subject: Re: GRUB2 Build on Mac OS X
Date: Thu, 8 Dec 2005 13:10:08 -0600

Hello,

There is another issue with GRUB2 on OS X which I am not sure has been brought up yet. Right now, AFAIK (but I haven't tested it), GRUB2 (the part that runs from OpenFrimware) can be built with a bootstrap powerpc-elf-targetted GCC hosted on OS X. However, the local GRUB2 binary (one that can run from OS X and perform installation and some such) needs to be compiled with the OS X compiler. Why? OS X doesn't use ELF - it uses Mach-O. If you want to be able to build GRUB2 in OS X with purely the OS X GCC, then the build procedure must take into account the Mach-O output format. AFAIK, new OpenFirmware versions (3.x) can boot Mach-O binaries but I haven't had a chance to experiment with this yet.

On Dec 8, 2005, at 10:27 AM, Peter Jones wrote:

On Thu, 2005-12-08 at 13:26 +0100, Marco Gerards wrote:

It's not acceptable to me to just remove the nested functions because
someone broke some unofficial build of gcc.  When an executable stack
is not available, there are the following options (as I see them):

I could be wrong, but GCC appears not to have official builds. For any
platform.

That being said, what's the reasoning for using this uncommon and
lossely defined extension in the first place? The way GRUB (both 2 and Legacy) uses nested functions, it's no better than just having a method vector, and certainly not easier to read. Not only that, but the trend going forward is towards *less* support of executable stacks, not more.
I wouldn't expect that to stop with us and for Apple, especially now
that there's widespread support for non-executable pages on Intel
hardware.

For that matter, is there a specific intent to use GNU C rather than
ANSI/ISO C? I haven't extensively read the list archives, so feel free
to point me at them if this has been widely discussed.

Are you saying you don't want Would you be amicable to patches which
change code from using nested functions to a more C-like implementation?
(I don't mean like the patch in my current GRUB Legacy package;
something cleaner than that hacky approach.)

Enable the executable stack using:
1) Set some bit in the ELF file so the OS knows we want this
  (that's what linux does).
2) Enable it using some function.
3) Creating our own stack.

There's a major point of contention being ignored here.  OS vendors
don't want to ship executables which require an executable stack. Full
stop.

So on the apple the right thing to do would be:

1) Fix gcc so nested functions are not fatal.

From many points of view, this would not be "fixing" GCC.

2) fix GRUB using the methods I described above.

Likewise.

Currently in RHEL and Fedora Core, we (somewhat kludgedly) fix GRUB not to need an executable stack for the normal operations that happen during grub-install. If we're ever to move to GRUB 2, it'll either need to not
use nested functions, or I'm going to wind up doing the same
modifications to it.

I really hope you're willing to entertain patches that remove use of
nested functions. If so, I'll certainly put some effort that direction
when next I look at moving RHEL and Fedora to GRUB 2.

--
  Peter



_______________________________________________
Grub-devel mailing list
address@hidden
http://lists.gnu.org/mailman/listinfo/grub-devel





reply via email to

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