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

James Molloy james.molloy at arm.com
Fri May 27 06:35:49 PDT 2011


Hi Joerg,

> 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.

Personally, I'm more than happy to only use -mcpu/-march and friends,
however
I see the power in specifying the triple and I'd expect resistance to
removing it
or diluting its power.

Your argument seems to be that functionally, -ccc-host-triple should have
less priority
than -march and friends. Is my interpretation correct? If so, I'm perfectly
happy with 
this as long as the community doesn't object.

> 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.

Given the above debate this is probably a moot point, but I feel that
calling a setter
in a Driver& object that is already passed into that function is cleaner
than adding 
an additional invisible argument *.

Cheers,

James

* Relevant hunk of the diff:

   std::string IgnoredError;
   if (llvm::TargetRegistry::lookupTarget(Prefix, IgnoredError)) {
-    ArgVector.insert(&ArgVector[1],
-      SaveStringInSet(SavedStrings, Prefix));
-    ArgVector.insert(&ArgVector[1],
-      SaveStringInSet(SavedStrings, std::string("-ccc-host-triple")));
+    TheDriver.setDefaultHostTriple(Prefix);
   }
 }

> -----Original Message-----
> From: cfe-dev-bounces at cs.uiuc.edu [mailto:cfe-dev-bounces at cs.uiuc.edu]
> On Behalf Of Joerg Sonnenberger
> Sent: 27 May 2011 14:23
> To: cfe-dev at cs.uiuc.edu
> Subject: Re: [cfe-dev] FW: [PATCH] Driver modifications for cross
> compilation
> 
> 
> 
> Joerg
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev








More information about the cfe-dev mailing list