grub-devel
[Top][All Lists]
Advanced

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

Re: [PATCH] remove target_os


From: Christian Franke
Subject: Re: [PATCH] remove target_os
Date: Tue, 27 Jan 2009 18:21:52 +0100
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.16) Gecko/20080702 SeaMonkey/1.1.11

Javier Martín wrote:
Unfortunately, gcc has no '-fno_os' option to specify the bare CPU as target.

Might -ffreestanding be what you are looking for?


The option '-ffreestanding' is the same as '-fno-hosted'.

According to gcc (4.3.1) source, '-fno-hosted' clears variable 'flag_hosted' and sets '-fno-builtin'. The latter is already set within GRUB build.

A cleared 'flag_hosted' apparently has only 2 effects:
- disable the special handling of 'main()'.
- #define __STDC_HOSTED__ to 0 instead of 1

There is no effect on the target_os dependent parts of the gcc code generation. For example, on i386, __enable_execute_stack() calls are generated for target_os netbsd, openbsd and cygwin, but not for linux. The emit call is hard-coded in gcc/configs/i386/i386.c:x86_initialize_trampoline().

Other workarounds are needed to support building GRUB with code generators tailored for various target_os.



 AC_MSG_CHECKING([for command to convert module to ELF format])
-case "${host_os}:${target_os}" in
-  cygwin:cygwin) TARGET_OBJ2ELF='grub-pe2elf' ;;
+case "${host_os}" in
+  cygwin) TARGET_OBJ2ELF='grub-pe2elf' ;;
   *) ;;
 esac
This won't work for a Linux cross compiler hosted on Cygwin. It would emit ELF format and does not need pe2elf.

A, say, AMD64 Linux cross compiler hosted on x86 Cygwin would have
$build=i686-pc-cygwin and $host=amd64-linux-gnu. Thus, no conflict ought
to arise even with cross compilation enabled.


But the opposite won't work: $host=i686-pc-cygwin would enable grub-pe2elf, even if this gcc emits ELF for a linux target.

Christian





reply via email to

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