[cfe-commits] [PATCH] Driver modifications for cross compilation

Chris Lattner clattner at apple.com
Tue Jul 12 18:54:39 PDT 2011


On Jul 12, 2011, at 3:31 PM, Eric Christopher wrote:

> I can see where you're going with this, I think I'd rather use -target for this sort of situation though. More options aren't necessarily better. :)
> 
> So, in my ideal world, here's how I think this would work:
> 
> clang -arch foo
> This will compile for the architecture listed with the current os and environment of the host
> 
> clang -target a-b-c
>  This will compile for the full triple listed, or alternately, whatever we think is reasonable to parse out of the target field (i.e. we may want more options in order to decide which toolchain to pick)

+1, but should -target be -triple?  We can use -target when we have some target/toolchain description mechanism.

> clang -march
>  This unfortunate option is around for compatibility, it'll select a sub arch if used from a single architecture compile, error otherwise.
> clang -mcpu
>  Ditto.

I think that these should fall into "do whatever gcc does for compatibility" camp.

> clang -mtune
>  Slightly more interesting here. It should definitely error if there's more than one architecture listed for now, but there's definitely room for a "I want a way to tune for an architecture, but run on a different one"
> 
> Under the covers we'll want to support things like OS headers, libraries, subprograms to invoke based on the actual "toolchain" we've selected from the universal driver. In this case "toolchain" means a target with associated directives for compiling, assembling, linking, etc including cross compilation support. I'd like to get most, if not all, of these from within a tablegen description as well.
> 
> What do you think? Does anyone else have any additional comments? Keep in mind that comments should be backed up with code (or proven code history in this area) I don't want this to turn into a bike shed discussion.

-Chris



More information about the cfe-commits mailing list