llvm-gcc (pre-release and svn sources) fails to compile on Solaris10/SPARC

I am new to LLVM, and I'm trying to compile llvm and llvm-gcc from
subversion on a Solaris10/SPARC machine. I have already tried building
llvm-2.4 on this machine, but it failed.

I then tried the subversion sources (rev. # 65253 fro llvm and
rev#65263 for llvm-gcc) and llvm at least builds correctly ( I however
have not tried testing it!). I can execute binaries located in
llvm-objects/Release (I built a Release version as instructed by
llvm-gcc README).

Since then I am trying to build llvm-gcc and it fails all the time. I
tried building llvm-gcc from svn and 2.5 pre-release. I also tried
building llvm-2.5 pre-release and that succeeds but llvm-gcc-4.2-2.5
pre-release fails again. I have listed below my machine config and the
errors reported by make in each case.

I am not sure if I should file a bug, hence I'm posting this here.
Looking forward to possible solutions.

thanks,
-Kshitij

I don't have access to a Solaris10 machine, can you propose a patch that fixes it for you?

-Chris

I am new to LLVM, and I'm trying to compile llvm and llvm-gcc from
subversion on a Solaris10/SPARC machine. I have already tried building
llvm-2.4 on this machine, but it failed.

That's correct. There was a bug fixed after 2.4 release.

Since then I am trying to build llvm-gcc and it fails all the time. I
tried building llvm-gcc from svn and 2.5 pre-release. I also tried
building llvm-2.5 pre-release and that succeeds but llvm-gcc-4.2-2.5
pre-release fails again. I have listed below my machine config and the
errors reported by make in each case.

afair solaris always had a special gcc build procedure. I can confirm, however, that sometime between 2.4 and 2.5 I built cross llvm-gcc for sparc-elf (with newlib) and at least it was bult successfully. In any case, result of codegen is not fully ABI-compliant.

../../llvm-gcc-4.2/gcc/llvm-convert.cpp:4387: error:
'getIntrinsicForGCCBuiltin' is not a member of 'llvm::Intrinsic'

That's something strange. Are you sure you didn't mixed sources from release and some older / newer version? What is gcc version on your box?

I am new to LLVM, and I'm trying to compile llvm and llvm-gcc from
subversion on a Solaris10/SPARC machine. I have already tried building
llvm-2.4 on this machine, but it failed.

I then tried the subversion sources (rev. # 65253 fro llvm and
rev#65263 for llvm-gcc) and llvm at least builds correctly ( I however
have not tried testing it!).

You can install dejagnu, and run 'make check' in the llvm objdir.
All tests except one pass for me on Solaris10/x86 (LLVMHello.so is not
copied to the correct location for some reason, so that test fails),
it would be interesting to see what happens on Sparc.

I can execute binaries located in
llvm-objects/Release (I built a Release version as instructed by
llvm-gcc README).

Since then I am trying to build llvm-gcc and it fails all the time. I
tried building llvm-gcc from svn and 2.5 pre-release. I also tried
building llvm-2.5 pre-release and that succeeds but llvm-gcc-4.2-2.5
pre-release fails again. I have listed below my machine config and the
errors reported by make in each case.

I am not sure if I should file a bug, hence I'm posting this here.
Looking forward to possible solutions.

thanks,
-Kshitij

************************************
Machine configuration and top-level configure switches I use
************************************
[sudan@grad1: space2]$ gcc -v
Using built-in specs. Target: sparc-sun-solaris2.10 Configured with:
../gcc-4.3.2/configure --prefix=/usr/local/gcc-4.3.2
--with-gmp=/usr/local --with-mpfr=/usr/local Thread model: posix gcc
version 4.3.2 (GCC)

Wow, where did you get a 4.3.x compiler for Solaris? Latest I've seen
packaged are 3.4.x and 4.0.x.

[sudan@grad1: space2]$ psrinfo -v
Status of virtual processor 0 as of: 02/23/2009 15:48:54
  on-line since 12/08/2008 10:47:54.
  The sparcv9 processor operates at 750 MHz,
        and has a sparcv9 floating point processor.
Status of virtual processor 1 as of: 02/23/2009 15:48:54
  on-line since 12/08/2008 10:47:56.
  The sparcv9 processor operates at 750 MHz,
        and has a sparcv9 floating point processor.

[sudan@grad1: space2]$ uname -a
SunOS grad1.emcb.utah.edu 5.10 Generic_118833-33 sun4u sparc
SUNW,Sun-Blade-1000 Solaris

configure switches for llvm-gcc
-------------------------------------------------
../llvm-gcc-4.2/configure
--prefix=/local/space2/llvm_toolchain/llvm-gcc4.2-2.5-install
--enable-languages=c,c++,fortran --disable-checking
--enable-llvm=/local/space2n/llvm-2.5-objects --disable-bootstrap
--disable-multilib
  
I tried building on Solaris10/x86, and I had to use something like
--with-as=/usr/sfw/bin/gas --with-gnu-as --with-ld=/usr/ccs/bin/ld
--without-gnu-ld.

However it failed with an undefined reference to 'copysignl'.

Best regards,
--Edwin

Since then I am trying to build llvm-gcc and it fails all the time. I
tried building llvm-gcc from svn and 2.5 pre-release. I also tried
building llvm-2.5 pre-release and that succeeds but llvm-gcc-4.2-2.5
pre-release fails again. I have listed below my machine config and the
errors reported by make in each case.

afair solaris always had a special gcc build procedure. I can confirm,
however, that sometime between 2.4 and 2.5 I built cross llvm-gcc for
sparc-elf (with newlib) and at least it was bult successfully. In any
case, result of codegen is not fully ABI-compliant.

hmm ... that's disheartening to hear. I intend to use the code
generated by LLVM to run on a full system simulator, so now I don't
know how that will pan-out. I don't want to loose out on LLVM's
strengths in static analysis just because I'm tied to a particular
ISA! Let's see how it goes ....

../../llvm-gcc-4.2/gcc/llvm-convert.cpp:4387: error:
'getIntrinsicForGCCBuiltin' is not a member of 'llvm::Intrinsic'

That's something strange. Are you sure you didn't mixed sources from
release and some older / newer version? What is gcc version on your box?

I compiled gcc from sources and here's the config>>

Using built-in specs. Target: sparc-sun-solaris2.10 Configured with:
../gcc-4.3.2/configure --prefix=/usr/local/gcc-4.3.2
--with-gmp=/usr/local --with-mpfr=/usr/local Thread model: posix gcc
version 4.3.2 (GCC)

and I'm pretty sure I did not mix any sources.

also, are there any instructions you have about cross compiling
llvm-gcc? I plan to use an x86_64-linux box as host and a
sparc-solaris10 box as target (I can get all the platform specific
headers and libs fro my host target easily). also, since I want to
compile llvm-gcc front-end, would I need to compile binutils etc. for
my target? where there any specific issues that you faced? how did you
test your front-end?

My other option is to compile llvm and llvm-gcc on a sparc-linux box
(I currently have a sparc64-linux box, but LLVM doesn't support that
target). Have you heard of any success story for llvm-gcc on
sparc-linux? I am a bit hesitant on that coz the llvm docs page does
not mention if this config has been tested.

-Kshitij

I then tried the subversion sources (rev. # 65253 fro llvm and
rev#65263 for llvm-gcc) and llvm at least builds correctly ( I however
have not tried testing it!).

You can install dejagnu, and run 'make check' in the llvm objdir.
All tests except one pass for me on Solaris10/x86 (LLVMHello.so is not
copied to the correct location for some reason, so that test fails),
it would be interesting to see what happens on Sparc.

I am totally inexperienced with testing using dejagnu, but here's the
output summary that's dumped on my screen >>
                === Summary ===

# of expected passes 1774
# of unexpected failures 69
# of unexpected successes 2
# of expected failures 13

I see a lot of "FAIL:" messages, and they are somehow always related
to -march=x86 flag for llc. Following is an example of these kind of

FAIL: /local/space2/llvm_toolchain/llvm/test/Transforms/TailDup/if-tail-dup.ll
Failed with exit(1) at line 1
while running: llvm-as <
/local/space2/llvm_toolchain/llvm/test/Transforms/TailDup/if-tail-\
dup.ll | opt -tailduplicate | llc -march=x86 -o if-tail-dup.ll.tmp -f
llc: for the -march option: : Cannot find option named 'x86'!

I'm not really sure what's going on! It'd be great if soemone can
provide some insight into this for me.

Using built-in specs. Target: sparc-sun-solaris2.10 Configured with:
../gcc-4.3.2/configure --prefix=/usr/local/gcc-4.3.2
--with-gmp=/usr/local --with-mpfr=/usr/local Thread model: posix gcc
version 4.3.2 (GCC)

Wow, where did you get a 4.3.x compiler for Solaris? Latest I've seen
packaged are 3.4.x and 4.0.x.

I compiled gcc-4.3 from sources.

-Kshitij

I see a lot of "FAIL:" messages, and they are somehow always related
to -march=x86 flag for llc. Following is an example of these kind of
>>

dejagnu tests all backends. It seems, that you enabled only some (sparc only?)

I see a lot of "FAIL:" messages, and they are somehow always related
to -march=x86 flag for llc. Following is an example of these kind of
>>

dejagnu tests all backends. It seems, that you enabled only some
(sparc only?)

Yes, I compiled llvm with --enable-targets=host-only

I just now re-compiled for all targets, and following are the results
of make check>>

    === Summary ===

# of expected passes 3104
# of unexpected failures 110
# of unexpected successes 2
# of expected failures 19

-Kshitij