foo_TARGET_ARCH, foo_TARGET_OS problems
Wolfgang Thaller
wolfgang.thaller at gmx.net
Thu Jan 27 09:49:29 EST 2005
On 27.01.2005, at 05:45, Simon Marlow wrote:
> On 26 January 2005 17:35, Wolfgang Thaller wrote:
>
>>> Remember that in a GHC build:
>>>
>>> - build refers to the platform we're building on
>>> - host refers to the platform we're going to run GHC on
>>> - target refers to the platform that this GHC build targets
>>
>> Autoconf defines build, host and target as follows:
>>
>>> --build=build-type
>>> the type of system on which the package is being configured and
>>> compiled (rarely needed); --host=host-type
>>> the type of system on which the package will run;
>>> --target=target-type
>>> the type of system for which any compiler tools in the package will
>>> produce code.
>>
>> I think that means that we should use *_TARGET_* only in the compiler
>> itself. Everywhere else (libraries, run-time-system) we should
>> actually be using *_HOST_*, because this is the system that the
>> package will run on.
>
> Not really - the RTS and libraries are actually going to run on the
> target. Or maybe you mean the HOST from the point of view of the
> compiler? This is getting too subtle.
The HOST of the RTS and libraries is the TARGET of the compiler. The
HOST of the stage1 compiler will probably be the BUILD of the RTS and
libraries. The RTS and libraries have no TARGET because they don't
generate code.
My point is, that the platform that *any code* runs on should always be
referred to as the HOST from within that code. So the HOST of the RTS
happens to be the TARGET of the compiler itself. This is how GCC does
it, IIRC.
>
> Ideally, GHC would not define any symbols which mentioned HOST or
> TARGET
> at all. If I could change this, I'd make it define foo_OS and foo_ARCH
> instead of foo_TARGET_OS and foo_TARGET_ARCH, but that would make it
> really hard for people to migrate their code.
Why? What are the foo_OS/ARCH macros? What's wrong with sticking to the
standard meanings of HOST and BUILD?
I agree it shouldn't mention TARGET - it only applies to compilers -
but BUILD and HOST make sense for any code, and GHC knows where it is
running (GHC's HOST == the BUILD platform of the code that GHC is
compiling) and what platform it is compiling for (GHC's TARGET == the
HOST platform of the code that GHC is compiling).
> If there are no objections, I'll go ahead and do this.
Slight objection until I see the point of doing things this way :-).
Cheers,
Wolfgang
More information about the Cvs-ghc
mailing list