Hi all,
As mentioned earlier, we've been working on getting LLVM to build on
Solaris on x86/x86-64. The changes required turned out to be fairly
minor, so it's perhaps a bit of a stretch to call it a "port".
There
were two main issues that we ran into here:
1. The Solaris x86 ABI by default defines the x86 registers CS,
DS, ES, etc in the system headers, which clashes with their use in
LLVM. It is possible to exclude these defines with -
D_POSIX_C_SOURCE=199506L -U_XOPEN_SOURCE, which will compile LLVM
successfully, but unfortunately llvm-gcc-4.2 will not build with these
flags.
Possible solutions:
a. Add #undefs for all register names to the relevant header
files
b. Rename all clashing variable names in LLVM (some 950-odd
lines)
c. Rename all clashing variable names in LLVM include files,
and compile LLVM only with the above flags
The patches below implement the last solution above, as it's the
smallest change - if there's a preference for a different approach I'm
happy to modify accordingly. The global rename is perhaps the better
solution long-term, but it would require changes to the current naming
scheme. (eg CallSite CS, FileStream FS)
2. The output from Solaris nm is just sufficiently different from
GNU nm to break GenLibDeps.pl - modified the latter to be slightly
more permissive. An alternative fix would be to ensure that a GNU nm
is located by configure, but this seems to be the simpler fix for now.
Outstanding issues:
1. make check fails to run on default *-*-solaris* installations,
primarily due to dependencies on GNU tools (grep, sh, etc).
2. llvm-gcc-4.2 fails to generate valid object code on Solaris
(but does generate perfectly normal LLVM output with --emit-llvm). It
also requires quite a complex configure line[0], but this looks to be
an upstream (GCC 4.2) issue.
Attached patches against svn trunk:
llvm-solaris-1.patch - Add macro definitions to CXX.Flags for
SunOS only
llvm-solaris-2.patch - Lowercase all instances of CS/DS/ES/FS in
llvm include files
llvm-solaris-3.patch - Modify GenLibDeps.pl to accept Solaris nm
output
llvm-gcc-4.2-solaris.patch - Lowercase all instances of CS/DS/ES/
FS in llvm-gcc-4.2 source
Built successfully on i386-pc-solaris2.10 (32- & 64-bit), i386-pc-
solaris2.11 (32- & 64-bit), sparc-sun-solaris2.10[1], and i686-apple-
darwin9.
Cheers,
Nathan
-------------- next part --------------
A non-text attachment was scrubbed...
Name: llvm-solaris-1.patch
Type: application/octet-stream
Size: 547 bytes
Desc: not available
URL:
<http://lists.llvm.org/pipermail/llvm-dev/attachments/20080530/4457449f/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: llvm-solaris-2.patch
Type: application/octet-stream
Size: 13605 bytes
Desc: not available
URL:
<http://lists.llvm.org/pipermail/llvm-dev/attachments/20080530/4457449f/attachment-0001.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: llvm-solaris-3.patch
Type: application/octet-stream
Size: 479 bytes
Desc: not available
URL:
<http://lists.llvm.org/pipermail/llvm-dev/attachments/20080530/4457449f/attachment-0002.obj>
-------------- next part --------------
-------------- next part --------------
A non-text attachment was scrubbed...
Name: llvm-gcc-4.2-solaris.patch
Type: application/octet-stream
Size: 949 bytes
Desc: not available
URL:
<http://lists.llvm.org/pipermail/llvm-dev/attachments/20080530/4457449f/attachment-0003.obj>
-------------- next part --------------
[0] e.g. ../llvm-gcc-4.2/configure --enable-llvm=${LLVMTARGET} --
disable-shared --with-gnu-as --with-as=/usr/sfw/bin/gas --without-gnu-
ld --with-ld=/usr/ccs/bin/ld --enable-languages=c,c++
[1] There seems to be an unrelated issue preventing llvm-gcc-4.2
compilation on SPARC, but LLVM itself builds without problems.
Looks good. I'll commit the patches for you. Thanks! Evan On May 29, 2008, at 10:17 PM, Nathan Keynes wrote:> Hi all, > > As mentioned earlier, we've been working on getting LLVM to build on > Solaris on x86/x86-64. The changes required turned out to be fairly > minor, so it's perhaps a bit of a stretch to call it a "port". There > were two main issues that we ran into here: > > 1. The Solaris x86 ABI by default defines the x86 registers CS, > DS, ES, etc in the system headers, which clashes with their use in > LLVM. It is possible to exclude these defines with - > D_POSIX_C_SOURCE=199506L -U_XOPEN_SOURCE, which will compile LLVM > successfully, but unfortunately llvm-gcc-4.2 will not build with > these flags. > > Possible solutions: > a. Add #undefs for all register names to the relevant header > files > b. Rename all clashing variable names in LLVM (some 950-odd > lines) > c. Rename all clashing variable names in LLVM include files, > and compile LLVM only with the above flags > > The patches below implement the last solution above, as it's the > smallest change - if there's a preference for a different approach > I'm happy to modify accordingly. The global rename is perhaps the > better solution long-term, but it would require changes to the > current naming scheme. (eg CallSite CS, FileStream FS) > > 2. The output from Solaris nm is just sufficiently different from > GNU nm to break GenLibDeps.pl - modified the latter to be slightly > more permissive. An alternative fix would be to ensure that a GNU nm > is located by configure, but this seems to be the simpler fix for now. > > Outstanding issues: > 1. make check fails to run on default *-*-solaris* installations, > primarily due to dependencies on GNU tools (grep, sh, etc). > 2. llvm-gcc-4.2 fails to generate valid object code on Solaris > (but does generate perfectly normal LLVM output with --emit-llvm). > It also requires quite a complex configure line[0], but this looks > to be an upstream (GCC 4.2) issue. > > Attached patches against svn trunk: > llvm-solaris-1.patch - Add macro definitions to CXX.Flags for > SunOS only > llvm-solaris-2.patch - Lowercase all instances of CS/DS/ES/FS in > llvm include files > llvm-solaris-3.patch - Modify GenLibDeps.pl to accept Solaris nm > output > llvm-gcc-4.2-solaris.patch - Lowercase all instances of CS/DS/ES/ > FS in llvm-gcc-4.2 source > > Built successfully on i386-pc-solaris2.10 (32- & 64-bit), i386-pc- > solaris2.11 (32- & 64-bit), sparc-sun-solaris2.10[1], and i686-apple- > darwin9. > > Cheers, > Nathan > > <llvm-solaris-1.patch><llvm-solaris-2.patch><llvm-solaris-3.patch> > <llvm-gcc-4.2-solaris.patch> > > > [0] e.g. ../llvm-gcc-4.2/configure --enable-llvm=${LLVMTARGET} -- > disable-shared --with-gnu-as --with-as=/usr/sfw/bin/gas --without- > gnu-ld --with-ld=/usr/ccs/bin/ld --enable-languages=c,c++ > [1] There seems to be an unrelated issue preventing llvm-gcc-4.2 > compilation on SPARC, but LLVM itself builds without problems. > > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev