[cfe-dev] clang builds on Sparc/Linux!

Chris Lattner clattner at apple.com
Tue Jul 24 08:58:22 PDT 2007


On Jul 24, 2007, at 2:10 AM, Kelly Wilson wrote:
> I am not sure if this is the correct list for this, but I think so,
> because llvm-gcc didn't build error-free on Sparc/Linux last time I
> tried....but clang does!

Cool! :)

> I am running an Enterprise 250 with Dual UltraSparc II's and 2 Gb ram
> running Aurora Sparc Linux 2.0 (2.6.13 kernel for Aurora is based on
> Fedora Core 3). GCC version 3.4.2.
>
> I built llvm-2.0 (not the svn version but the download version) by  
> just
> typing "./configure;make". I then downloaded clang from the svn
> repository (revision 40382) and changed to it's directory
> under .../llvm/tools/clang. I did a "make" without incident for clang,
> as well. Woohoo.

Nice.  You probably got a bit lucky :).  Usually clang SVN head will  
only work with LLVM SVN head.

> I tried a few examples and everything seemed to work fine, as far as
> llvm, some simple clang functionality and the JIT examples go. Then I
> ran this contrived example through clang and llvm:
>
> int x;
> int func1 (int g) {
>    return g;
> }
> int main()
> {
>    printf("Hello World %d times\n", func1(5));
> }
>
>
> with this command:
>
> clang ./ex1.c -emit-llvm | llvm-as | opt -std-compile-opts | llc
> -march=sparc > ex1.S
>
> This worked fine and the code gen looked fine, except for two things:

Ok

> The two problems with this output. "save -96, %o6, %o6" should read
> "save %o6, -96, %o6" at both function entry points, and the ".bss"
> section identifier needs to be removed. THEN GCC CAN ASSEMBLE/LINK  
> THIS
> AND IT RUNS!!!!! Cool, now you have a new OS/arch pair to run LLVM on,
> though I may be the only one running this pair ;)

Very nice!  I'm not sure how the arguments to save got transposed, it  
must be a regression somewhere along the way.  We don't have too many  
people testing sparc :)

> P.S. Maybe I should cross-post this to llvm-dev so that the Sparc
> backend writers can see it? I also have a couple very small diff's to
> fix these two problems in the Sparc backend...should I post them to
> llvm-dev?

Yes please.  I'm actually the author/maintainer of the sparc backend,  
but llvm-dev is the right place to take care of these bugs.  Thanks!

-Chris



More information about the cfe-dev mailing list