[LLVMdev] Sparc back end problem

Bruno Cardoso Lopes bruno.cardoso at gmail.com
Tue Nov 16 08:52:02 PST 2010


Hi,

On Mon, Nov 15, 2010 at 6:46 PM, Timothy M Jones <tjones1 at inf.ed.ac.uk> wrote:
> Hi everyone,
>
> I'm trying to make a cross-compiler based on llvm to target sparc (solaris)
> from x86_64 (linux).  I couldn't compile llvm-gcc on my system so have to
> use the precompiled binaries from the website, but already have a gcc
> cross-compiler so can use this.  So far, my compilation steps are these:
>
> 1) Preprocess the (C) sources using gcc cross-compiler
> 2) Use llvm-gcc to transform to llvm IR
> 3) Run llc to emit sparc assembly
> 4) Assemble and link using gcc cross-compiler
>
> This works for a simple 'Hello World' program, but I'm getting problems when
> trying more complicated things.  One thing in particular is with a simple
> printf that I want to write that prints out the size of an integer.  I've
> attached an example program source, preprocessed source, llvm code and
> assembly.  Instead of printing 'Value is 4' I get 'Value is 0'!  I don't
> know sparc assembly at all, but a quick scan over the code shows that the
> value '4' is definitely used in an instruction near the printf call.  Anyone
> know why this isn't working or point out where I'm going wrong?  I'm using
> llvm 2.8.

Try to generate sparc llvm IR using clang and see what happens, you can
use -ccc-host-triple and -ccc-clang-archs command line options.

>
> Cheers
> Tim
>
>
> --
> Timothy M. Jones
> http://homepages.inf.ed.ac.uk/tjones1
> The University of Edinburgh is a charitable body, registered in
> Scotland, with registration number SC005336.
>
>
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
>
>



-- 
Bruno Cardoso Lopes
http://www.brunocardoso.cc




More information about the llvm-dev mailing list