[GHC] #3814: Compile to more than one (sub)-architecture
GHC
trac at galois.com
Thu Jan 14 05:55:44 EST 2010
#3814: Compile to more than one (sub)-architecture
-----------------------------------------------+----------------------------
Reporter: filcab | Owner:
Type: feature request | Status: new
Priority: normal | Milestone:
Component: Compiler | Version: 6.12.1
Keywords: architecture, compiler, x86_64 | Difficulty:
Os: Unknown/Multiple | Testcase:
Architecture: Unknown/Multiple | Failure: None/Unknown
-----------------------------------------------+----------------------------
Description changed by igloo:
Old description:
> GHC, as far as I can tell, can only compile files for one architecture
> (let's call it the "host architecture").
>
> This brings some problems... The biggest of which is that we lose the
> option of building for 32/64 bits in one of the "hybrid" architectures
> (For example, in x86_64-linux or i386-darwin)
>
> If I build a ghc in a x86_64 linux I will only get the x86_64 code
> generator and not the i386 generator. This will stop me from building a
> program which links with a library that only has a 32-bit version.
> If I want a GHC which will only compile for the i386, I will have to
> cross-compile, which is not very pretty.
>
> The same will happen on the Mac OS X side (even though the x86_64-darwin
> port is still on its way...).
>
> But GHC "should" (IMHO) be able to do like GCC and be able to generate
> code for both architecturess (i386 and x86_64), through the usage of
> compiler flags (which would also be passed to any gcc sub-process, if
> need be). At least if it is installed in a x86_64 (and PPC, if PPC64 is
> supported) system.
>
> Even better would be to do like LLVM's llc which enables a user to
> generate an assembly file for a target architecture from any other
> architecture.
>
> Example of an LLVM target list:
> filcab at fry:/stuff/src> llc --version
> Low Level Virtual Machine (http://llvm.org/):
> llvm version 2.7svn
> DEBUG build with assertions.
> Built Jan 10 2010 (00:25:59).
> Host: x86_64-unknown-linux-gnu
> Host CPU: core2
>
> Registered Targets:
> arm - ARM
> c - C backend
> cellspu - STI CBEA Cell SPU [experimental]
> cpp - C++ backend
> mips - Mips
> msil - MSIL backend
> ppc64 - PowerPC 64
> sparc - Sparc
> x86 - 32-bit X86: Pentium-Pro and above
> x86-64 - 64-bit X86: EM64T and AMD64
New description:
GHC, as far as I can tell, can only compile files for one architecture
(let's call it the "host architecture").
This brings some problems... The biggest of which is that we lose the
option of building for 32/64 bits in one of the "hybrid" architectures
(For example, in x86_64-linux or i386-darwin)
If I build a ghc in a x86_64 linux I will only get the x86_64 code
generator and not the i386 generator. This will stop me from building a
program which links with a library that only has a 32-bit version.
If I want a GHC which will only compile for the i386, I will have to
cross-compile, which is not very pretty.
The same will happen on the Mac OS X side (even though the x86_64-darwin
port is still on its way...).
But GHC "should" (IMHO) be able to do like GCC and be able to generate
code for both architecturess (i386 and x86_64), through the usage of
compiler flags (which would also be passed to any gcc sub-process, if need
be). At least if it is installed in a x86_64 (and PPC, if PPC64 is
supported) system.
Even better would be to do like LLVM's llc which enables a user to
generate an assembly file for a target architecture from any other
architecture.
Example of an LLVM target list:
{{{
filcab at fry:/stuff/src> llc --version
Low Level Virtual Machine (http://llvm.org/):
llvm version 2.7svn
DEBUG build with assertions.
Built Jan 10 2010 (00:25:59).
Host: x86_64-unknown-linux-gnu
Host CPU: core2
Registered Targets:
arm - ARM
c - C backend
cellspu - STI CBEA Cell SPU [experimental]
cpp - C++ backend
mips - Mips
msil - MSIL backend
ppc64 - PowerPC 64
sparc - Sparc
x86 - 32-bit X86: Pentium-Pro and above
x86-64 - 64-bit X86: EM64T and AMD64
}}}
--
--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/3814#comment:2>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the Glasgow-haskell-bugs
mailing list