From: "Javier Martín" <lordhabbit@gmail.com>
To: The development of GRUB 2 <grub-devel@gnu.org>
Subject: Re: [PATCH] remove target_os
Date: Tue, 27 Jan 2009 18:40:09 +0100 [thread overview]
Message-ID: <1233078009.2937.12.camel@localhost> (raw)
In-Reply-To: <497F42B0.3060201@t-online.de>
[-- Attachment #1: Type: text/plain, Size: 2810 bytes --]
El mar, 27-01-2009 a las 18:21 +0100, Christian Franke escribió:
> 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().
In that case, we are dealing with a GCC bug. We might want to require
the user to create a bare "no-OS" cross compiler. These thingies are
most likely only known to OS developers, but you can build a perfectly
good "i686-pc-elf" GCC (only with no libc, of course). This might be the
Right Way (TM) of building boot code, instead of the current way of
using the OS-targetter compiler and trying to tell it not to do what it
was built to do.
>
> 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.
"The opposite" of a the described situation would be a Linux AMD64
machine cross compiling for a Cygwin x86 machine, that is
$build=amd64-linux-gnu and $host=i686-pc-cygwin. In that case,
i686-pc-cygwin-gcc would generate PE executables, and thus grub-pe2elf
_is_ required indeed.
>
> Christian
>
>
>
> _______________________________________________
> Grub-devel mailing list
> Grub-devel@gnu.org
> http://lists.gnu.org/mailman/listinfo/grub-devel
[-- Attachment #2: Esta parte del mensaje está firmada digitalmente --]
[-- Type: application/pgp-signature, Size: 835 bytes --]
next prev parent reply other threads:[~2009-01-27 17:39 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-01-25 23:12 [PATCH] remove target_os Robert Millan
2009-01-26 19:57 ` Christian Franke
2009-01-26 22:17 ` Javier Martín
2009-01-27 16:51 ` Vesa Jääskeläinen
2009-01-27 17:33 ` Javier Martín
2009-02-07 21:53 ` remove OS part of --target=xxx (Re: [PATCH] remove target_os) Robert Millan
2009-01-27 17:21 ` [PATCH] remove target_os Christian Franke
2009-01-27 17:40 ` Javier Martín [this message]
2009-01-27 19:56 ` Christian Franke
2009-01-27 21:52 ` Javier Martín
2009-01-29 7:00 ` Christian Franke
2009-02-07 21:54 ` Robert Millan
2009-02-08 19:59 ` Robert Millan
2009-02-07 21:48 ` Robert Millan
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=1233078009.2937.12.camel@localhost \
--to=lordhabbit@gmail.com \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.