[cfe-dev] FW: [PATCH] Driver modifications for cross compilation

Joerg Sonnenberger joerg at britannica.bec.de
Fri May 27 06:22:59 PDT 2011


On Fri, May 27, 2011 at 01:56:20PM +0100, James Molloy wrote:
> My patch assumes that if -ccc-host-triple is specified, it is specified by
> the user and as such overrides any -mcpu=/-march=/-mos= inferred choice. I'd
> argue that the correct behaviour in ParseProgName should be to set
> Driver::DefaultHostTriple.

I disagree that -ccc-host-triple should override -mcpu/-march etc.
That's just not the way how many toolchains work. In fact, it is
completely contrary to how most systems operate.

Consider the NetBSD cross-compiling toolchain as one of the most
integrated systems in this regard. The target triple is fixed for each
architecture (i486--netbsdelf, x86_64--netbsd, etc.). If the user wants
to optimise for a specific CPU, she can add -mcpu or -march via the
appropiate variables. It doesn't make sense to change the target triple
for that.

ParseProgName works this way as it makes sure that only local state is
modified. That feels a lot cleaner than adjusting global variables.
Consider a clang daemon as an example that might be useful to implement
at some point.

Joerg



More information about the cfe-dev mailing list