[cfe-dev] Targeting ARM with Clang

Philippe Hausler phausler at gmail.com
Mon Jul 19 14:37:42 PDT 2010

On Jul 18, 2010, at 3:42 PM, Daniel Dunbar wrote:

> Right, this is the most accurate answer.
> The main answer to a lot of the questions posed in this thread is "no
> one has done it yet". There is no real reason we can't support -arch
> on non-Darwin, I just haven't done the driver work for it. As with
> many things, it is on my TODO list, but it hasn't made it to the top.
> As for supporting targeting ARM, my official position on this is:
> (a) Yes, you can kind of do it with -ccc-host-triple.
> (b) This isn't a supported usage model. If it works for you, great,
> but I don't think we should tell users to try it.
> (c) We should do the universal driver work to create a real cross
> compilation model that actually works.

Well I appreciate all of your feedback on this; given an ideal scenario I would whole-heartedly agree that a universal driver concept would need to be fleshed out. I have taken a bit to attempt some initial passes at implementing the previously mentioned Universal Driver post with some success.

Ideally what would be needed for a target configuration file to specify? 
Where should these specifications be housed? I would assume maybe relative to the clang driver ../etc/clang/ ?
What format should they use? I assume some sort of text, but should it be config file, xml etc?

So far for my scenario I would like to implement control over from a target configuration file for:

The triple which would adapt the arch/platform/os and maybe be later hooked to any other needed linkage in the compilation phases (this seems like it would be a near 100% requirement for a well formed configuration)

Locations of the assembler and the linker for the target (potentially either relative to clang or absolute on the system)
^ what other actions would be sane here?

Specifications for a assembly pre-processor (in my case usable for double checking the assembly output and replacing a few incompatible calls)

Specifications for a linker post-processor (usable to perform build tasks like archival, or ant builds for JNI projects, bundle creation etc)

Default clang, assembler, and linker flags that are inferred by the target configuration (but these should be override-able by any arguments explicitly sent to clang)

Maybe some sort of option that defines if the assembler/linker are expected to be piped or not (not sure if this is needed/desirable/good-place-for-it)

Maybe some sort of option that specifies if the assembler or linker is used at all for platforms similar to the TCEToolChain

A flags for default for blocks, integrated assembler, non-fragile-abi, objc legacy dispatch, mixed dispatch, stack protection levels, unwind tables, relocation models, pic models, objc-gc, dwarf, and SjLj exceptions (these would all allow a fully text based implementation of a ToolChain)

Most likely I have missed a fair amount of things that would need to be done here.

I would like to make this as potentially useful to people beyond myself, so any feedback is welcomed.

Philippe Hausler

More information about the cfe-dev mailing list