[LLVMdev] How to add a new target/toolchain to Clang ?

Tom Stellard tom at stellard.net
Fri Jul 10 07:37:48 PDT 2015


On Fri, Jul 10, 2015 at 04:16:33PM +0200, Frédéric Heitzmann wrote:
> Thanks Tom for your help, it as indeed very easy to make the link with the
> linker (not sick joke).
> Unfortunately, clang generates object files for target x86_64, even though
> I try --target --triple, --arch, ...
> What is the trick to tell him which target to use ?
> 

The option to use is -target:

clang -target yourcpu-- in.c

You also need to teach clang to map the triple to your
TargetInfo implementation. See AllocateTarget()  in lib/Basic/Targets.cpp

-Tom

> --
> Fred
> ps: not looked yet at inline assembly
> 
> 
> 2015-07-09 18:40 GMT+02:00 Tom Stellard <tom at stellard.net>:
> 
> > On Thu, Jul 09, 2015 at 03:57:53PM +0200, Frédéric Heitzmann wrote:
> > > Hi all,
> > >
> > > I have been developping a out-of-tree backend.
> > > I would like to integrate it with clang.
> > > Note that my backend is rather simple, generates elf32, and I do not need
> > > about linux, libary paths, ...
> > >
> > > Can someone give me a pointer to a readme, an article, or maybe a good
> > > (i.e. simple) example ?
> > >
> > > Note :on a second step, I would like to support inline assembly in C
> > code..
> > >
> >
> > Here is a simple example for adding a new toolchain:
> > http://reviews.llvm.org/D10700
> >
> > See R600TargetInfo in lib/Basic/Targets.cpp for an example of a
> > simple Target that supports inline assembly.
> >
> > -Tom
> >
> > > --
> > > Frederic Heitzmann
> >
> > > _______________________________________________
> > > LLVM Developers mailing list
> > > LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> > > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
> >
> >




More information about the llvm-dev mailing list