[LLVMdev] Sparc back end problem
Timothy M Jones
tjones1 at inf.ed.ac.uk
Mon Nov 15 12:46:08 PST 2010
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.
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.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: test-printf.bc
Type: application/octet-stream
Size: 680 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20101115/4168bc8b/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: test-printf.c
Type: application/octet-stream
Size: 112 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20101115/4168bc8b/attachment-0001.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: test-printf.i
Type: application/octet-stream
Size: 10057 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20101115/4168bc8b/attachment-0002.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: test-printf.s
Type: application/octet-stream
Size: 657 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20101115/4168bc8b/attachment-0003.obj>
More information about the llvm-dev
mailing list