Compile to more than one (sub)-architecture
|Reported by:||filcab||Owned by:|
|Keywords:||architecture, compiler, x86_64||Cc:||filcab+ghc@…, karel.gardas@…, dankna@…, william.knop.nospam@…, shelarcy@…|
|Type of failure:||None/Unknown||Test Case:|
|Related Tickets:||#4163||Differential Revisions:|
Description (last modified by igloo)
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@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
Change History (10)
comment:9 Changed 8 months ago by thomie
- difficulty set to Unknown
- Resolution set to duplicate
- Status changed from new to closed