[GHC] #11470: Support changing cross compiler target at runtime
GHC
ghc-devs at haskell.org
Sun Feb 14 20:36:28 UTC 2016
#11470: Support changing cross compiler target at runtime
-------------------------------------+-------------------------------------
Reporter: ezyang | Owner:
Type: feature request | Status: new
Priority: normal | Milestone:
Component: Compiler | Version: 7.10.3
Resolution: | Keywords:
Operating System: Unknown/Multiple | Architecture:
| Unknown/Multiple
Type of failure: None/Unknown | Test Case:
Blocked By: | Blocking:
Related Tickets: #11378 | Differential Rev(s):
Wiki Page: |
-------------------------------------+-------------------------------------
Comment (by luite):
I'd be happy to help with this. Fortunately there is not all that much
information about the target platform hardcoded in GHC anymore.
I think a new cross compilation target could be added by pointing GHC to
some target-specific `settings` file. This file should also specify how to
run TH and GHCi (for example via the external interpreter for general TH
and by loading code from another package DB for host-only TH)
We would create an `initialize-target` tool that:
* queries the toolchain and generates an appropriate `settings` file
* (possibly) builds an initial set of packages for the target, similar
to what ships with GHC
I think this is still reasonably straightforward, and I think it would be
a good first step, and would mainly involve separating part of the build
system and making sure that all relevant configuration options can indeed
be specified by `settings`. This should allow cross compilers to load
native code for plugins (the code generator for the target could even be a
plugin).
For the next step, my main concern would be how to match up the host and
target architecture package databases for things like host-only TH. Say a
cross compiler needs to run some host-only TH, which means it probably
needs to load some code from a host-arch package DB:
* Who is responsible for the code to be there? Will `cabal-install` make
sure that a host version of a package is built and registered before a
target version?
* ABI hashes will likely be different between architectures: do we just
require transitive version numbers to be the same? Or should there be a
way to link hashes between architectures? (if we match on version numbers,
i suspect we may lose things like cabal flag settings)
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/11470#comment:7>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list