[cfe-dev] ccc-gcc-name equivalent to call as and ld directly

Damjan Marion damjan.marion at gmail.com
Mon Jun 20 07:36:02 PDT 2011



On Jun 20, 2011, at 4:07 PM, James Molloy wrote:

> Hi,
> 
> This comes back to the same as a previous conversation:
> http://article.gmane.org/gmane.comp.compilers.clang.devel/15299
> 
> Reliance on GCC to point the way to the correct assembler and linker makes
> sense for Linux because of its heavily GCC-centric view of the world, but
> seems more of a hindrance for cross-compilation development, both baremetal
> and cross-OS.
> 
> I believe that Renato is incorrect in the behaviour he noted - Clang sets
> the host triple based on the exec prefix, and will pull out the OS part so
> use the FreeBSD Toolchain class instead of the GCC-oriented "Unknown" class.
> 
> Not only this but the default behaviour in not just the FreeBSD toolchain
> but any other is to look for the bare tool name "as"/"ld" instead of first
> trying a triple-prefixed version ("arm-none-freebsd-as").
> 
> Cheers,
> 
> James
> 
> 
>> -----Original Message-----
>> From: rengolin at gmail.com [mailto:rengolin at gmail.com] On Behalf Of
>> Renato Golin
>> Sent: 20 June 2011 14:58
>> To: Damjan Marion
>> Cc: cfe-dev at cs.uiuc.edu; James Molloy
>> Subject: Re: [cfe-dev] ccc-gcc-name equivalent to call as and ld
>> directly
>> 
>> On 17 June 2011 15:05, Damjan Marion <damjan.marion at gmail.com> wrote:
>>> I wonder about possibility to introduce similar cmd line parameters
>> (i.e. -ccc-gas-name and -ccc-ld-name ) to specify cross-assembler and
>> cross-linker directly.
>>> 
>>> This will also avoid need for having gcc in toolchain.
>> 
>> Hi Damjan,
>> 
>> I'm not sure, but I believe that if you call clang as
>> "arm-none-freebsd-clang" (via symlink), it'll set the target triple
>> automatically and should default to looking for "arm-none-freebsd-as"
>> and so on.
>> 
>> If it doesn't do that yet, it should. James might know more about it,
>> as he was fiddling with that recently.
>> 
>> Regarding the parameters, I don't object having them. It makes it
>> easier to build automated tests where you want to change the
>> assemblers and linkers at will.
>> 
>> cheers,
>> --renato

Hi James, Renato,

At least on Darwin this trick with symlink doesn't work. clang still tries to run /usr/bin/as.

My understanding is that currently only clang on NetBSD host is taking into account -ccc-host-triple to construct command line to invoke AS and LD. I submit a patch[1] to implement the same on FreeBSD and 
Darwin, but this bug is still in NEW state after 2 months. With this patch cross-compiling works fine for me.

However I think that it will be nice to have possibility to specify custom AS and LD from command line and avoid messing with symlinks. If there is common agreement that this should be implemented, I can write a patch. However I don't want to spend time if there is no interest to include it into SVN.

Cheers,

Damjan

[1] http://llvm.org/bugs/show_bug.cgi?id=9777








More information about the cfe-dev mailing list