From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1LRu3j-0002l3-Jy for mharc-grub-devel@gnu.org; Tue, 27 Jan 2009 14:57:19 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LRu3h-0002k0-C3 for grub-devel@gnu.org; Tue, 27 Jan 2009 14:57:17 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LRu3f-0002jS-Sm for grub-devel@gnu.org; Tue, 27 Jan 2009 14:57:16 -0500 Received: from [199.232.76.173] (port=52232 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LRu3f-0002jO-IT for grub-devel@gnu.org; Tue, 27 Jan 2009 14:57:15 -0500 Received: from mailout01.t-online.de ([194.25.134.80]:41610) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1LRu3e-0001qF-W1 for grub-devel@gnu.org; Tue, 27 Jan 2009 14:57:15 -0500 Received: from fwd08.aul.t-online.de by mailout01.t-online.de with smtp id 1LRu3Z-0001te-01; Tue, 27 Jan 2009 20:57:09 +0100 Received: from [10.3.2.2] (GD4JHBZZQhyvZYwCJwNSfC9D8rJW61Bc9gIrI3R-bCUxjtqJnNQ3drdr7gRBQMAZ8X@[217.235.218.240]) by fwd08.aul.t-online.de with esmtp id 1LRu3P-2DseQq0; Tue, 27 Jan 2009 20:56:59 +0100 Message-ID: <497F670B.6080902@t-online.de> Date: Tue, 27 Jan 2009 20:56:59 +0100 From: Christian Franke User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.16) Gecko/20080702 SeaMonkey/1.1.11 MIME-Version: 1.0 To: The development of GRUB 2 References: <20090125231241.GA27873@thorin> <497E1596.7040802@t-online.de> <1233008230.24663.8.camel@localhost> <497F42B0.3060201@t-online.de> <1233078009.2937.12.camel@localhost> In-Reply-To: <1233078009.2937.12.camel@localhost> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-ID: GD4JHBZZQhyvZYwCJwNSfC9D8rJW61Bc9gIrI3R-bCUxjtqJnNQ3drdr7gRBQMAZ8X X-TOI-MSGID: ef3339d8-9aa9-40b4-aa28-99ec0b319e1c X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 3) Subject: Re: [PATCH] remove target_os X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: The development of GRUB 2 List-Id: The development of GRUB 2 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 27 Jan 2009 19:57:17 -0000 Javier Martín wrote: > 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. > > Is building a bare 'no-OS' compiler supported by the upstream GCC sources? Probably a too strict prerequisite for building GRUB. >>>>> 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. > Yes - I was wrong, sorry. Robert: Patch is IMO GTG. Christian