Call for help: clang/llvm for sparc64

Craig Butler craig001 at lerwick.hopto.org
Tue Jan 21 17:05:42 UTC 2014



----- Original Message -----
> From: "Craig Butler" <craig001 at lerwick.hopto.org>
> To: "Roman Divacky" <rdivacky at freebsd.org>
> Cc: sparc64 at freebsd.org
> Sent: Sunday, 19 January, 2014 11:51:14 PM
> Subject: Re: Call for help: clang/llvm for sparc64
> 
> 
> On Fri, 2014-01-17 at 23:13 +0100, Roman Divacky wrote:
> > fwiw, we have a small testcase and I filed a bug in upstream llvm
> > 
> > http://llvm.org/bugs/show_bug.cgi?id=18521
> > 
> > A big thank you, to jmg@ for providing the testcase and analyzing
> > the bug.
> > 
> > Roman
> > 
> > On Fri, Jan 17, 2014 at 06:49:24PM +0000, Craig Butler wrote:
> > > On Fri, 2014-01-17 at 19:37 +0100, Roman Divacky wrote:
> > > > We got further. It looks like the problem is TLS related. It's
> > > > crashing
> > > > in __getCurrentRuneLocale().
> > > > 
> > > > And to correct myself - you need to do --enable-target=sparc
> > > > (not sparc64)
> > > > and you need to compile with gcc48.
> > > > 
> > > > Anyway, start using llvm on sparc64, it's getting usable :) So
> > > > more usage
> > > > is better.
> > > > 
> > > > On Fri, Jan 17, 2014 at 01:12:42PM +0000, Craig Butler wrote:
> > > > > Hi Roman and list.
> > > > > 
> > > > > I've got some spare time and sparc64 kit in the rack.  I can
> > > > > help out and walk through anything you need.
> > > > > 
> > > > > Kind Regards
> > > > > 
> > > > > Craig Butler
> > > > > 
> > > > > Roman Divacky <rdivacky at freebsd.org> wrote:
> > > > > 
> > > > > >Hi!
> > > > > >
> > > > > >LLVM is getting a sparc64 backend. It can even selfhost on
> > > > > >linux. But it cant
> > > > > >on FreeBSD. I am wondering what causes that difference.
> > > > > >
> > > > > >A small test case where the difference can be seen is
> > > > > >compiling tcsh from
> > > > > >base. The gethost utility used during the build just
> > > > > >coredumps. I suspect
> > > > > >fixing that might get us on par with linux.
> > > > > >
> > > > > >So I am looking for someone who is willing to compile
> > > > > >llvm/clang and
> > > > > >analyze whats wrong with gethost in tcsh compilation.
> > > > > >
> > > > > >This is how to do it (you need trunk llvm/clang):
> > > > > >
> > > > > >svn co http://llvm.org/svn/llvm-project/llvm/trunk llvm
> > > > > >cd llvm/
> > > > > >svn co http://llvm.org/svn/llvm-project/cfe/trunk clang
> > > > > >cd ../
> > > > > >CFLAGS=-fno-strict-aliasing CXXFLAGS=-fno-strict-aliasing
> > > > > >./configure --enable-optimized --enable-targets=sparc64
> > > > > >make
> > > > > >make install
> > > > > >
> > > > > >will give you a clang binary that you can use for tcsh
> > > > > >compilation:
> > > > > >
> > > > > >cd /usr/src/bin/csh
> > > > > >CC=clang make
> > > > > >
> > > > > >I am more than willing to help with llvm/clang side of this
> > > > > >but I dont know
> > > > > >anything about sparc64 so I need help. But please contact me
> > > > > >if you want to
> > > > > >help!
> > > > > >
> > > > > >Thanks, Roman
> > > 
> > > Thanks Roman..  I'll compile gcc48 on my tinderbox and try again.
> > > 
> > > Report back soon
> > > 
> > > Regards
> > > 
> > > Craig Butler
> 
> Hello Folks
> 
> For anyone else trying to build llvm/clang I have gcc48 pkgng
> available (should save a day of compiling)
> 
> I have also found that clang checkout needs to happen in llvm/tools
> for the llvm build to pick it up.
> 
> I needed to use gmake and gmake install because BSD make was
> complaining about "Error expanding embedded variable"
> 
> Hopefully a llvm and clang build soon (still compiling!!)
> 
> Kind Regards
> 
> Craig Butler
> 
> _______________________________________________
> freebsd-sparc64 at freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-sparc64
> To unsubscribe, send any mail to
> "freebsd-sparc64-unsubscribe at freebsd.org"
> 

Finally got llvm and clang compiled and installed (compiled tarball available if anyone wants it !)

My compile of csh doesn't segfault it errors out moaning about a load of previous definitions... not sure what is going on 

# cd /usr/src/bin/csh/
# CC=clang make
Warning: Object directory not changed from original /usr/src/bin/csh
grep '[FV]_' /usr/src/bin/csh/../../contrib/tcsh/ed.defns.c | grep '^#define' >> ed.defns.h
grep 'ERR_' /usr/src/bin/csh/../../contrib/tcsh/sh.err.c | grep '^#define' >> sh.err.h
clang -E -O2 -pipe -I. -I/usr/src/bin/csh -I/usr/src/bin/csh/../../contrib/tcsh -D_PATH_TCSHELL='"/bin/csh"' -std=gnu99 -Qunused-arguments -fstack-protector -Wsystem-headers -Werror -Wno-pointer-sign -Wno-empty-body -Wno-string-plus-int -Wno-tautological-compare -Wno-unused-value -Wno-parentheses-equality -Wno-unused-function -Wno-conversion -Wno-switch -Wno-switch-enum -Wno-knr-promoted-parameter -Wno-parentheses /usr/src/bin/csh/../../contrib/tcsh/tc.const.c /usr/src/bin/csh/../../contrib/tcsh/sh.char.h config.h /usr/src/bin/csh/../../contrib/tcsh/config_f.h /usr/src/bin/csh/../../contrib/tcsh/sh.types.h sh.err.h -D_h_tc_const |  grep 'Char STR' |  sed -e 's/Char \([a-zA-Z0-9_]*\)\(.*\)/extern Char \1[];/' |  sort >> tc.const.h
In file included from /usr/src/bin/csh/../../contrib/tcsh/tc.const.c:33:
In file included from /usr/src/bin/csh/../../contrib/tcsh/sh.h:376:
/usr/local/bin/../lib/clang/3.5/include/stdarg.h:47:9: error: '__GNUC_VA_LIST'
      macro redefined [-Werror]
#define __GNUC_VA_LIST 1
        ^
/usr/include/machine/_types.h:106:9: note: previous definition is here
#define __GNUC_VA_LIST
        ^
1 error generated.
cp /usr/src/bin/csh/iconv_stub.h iconv.h
clang -O2 -pipe  -I. -I/usr/src/bin/csh -I/usr/src/bin/csh/../../contrib/tcsh -D_PATH_TCSHELL='"/bin/csh"' -DHAVE_ICONV -std=gnu99 -Qunused-arguments -fstack-protector -Wsystem-headers -Werror -Wno-pointer-sign -Wno-empty-body -Wno-string-plus-int -Wno-tautological-compare -Wno-unused-value -Wno-parentheses-equality -Wno-unused-function -Wno-conversion -Wno-switch -Wno-switch-enum -Wno-knr-promoted-parameter -Wno-parentheses -c /usr/src/bin/csh/../../contrib/tcsh/sh.c
In file included from /usr/src/bin/csh/../../contrib/tcsh/sh.c:34:
In file included from /usr/src/bin/csh/../../contrib/tcsh/sh.h:50:
/usr/include/inttypes.h:37:19: error: redefinition of typedef 'wchar_t' is a C11
      feature [-Werror,-Wtypedef-redefinition]
typedef __wchar_t       wchar_t;
                        ^
/usr/local/bin/../lib/clang/3.5/include/stddef.h:65:24: note: previous
      definition is here
typedef __WCHAR_TYPE__ wchar_t;
                       ^
In file included from /usr/src/bin/csh/../../contrib/tcsh/sh.c:34:
In file included from /usr/src/bin/csh/../../contrib/tcsh/sh.h:97:
/usr/include/wchar.h:75:18: error: redefinition of typedef 'size_t' is a C11
      feature [-Werror,-Wtypedef-redefinition]
typedef __size_t        size_t;
                        ^
/usr/local/bin/../lib/clang/3.5/include/stddef.h:42:23: note: previous
      definition is here
typedef __SIZE_TYPE__ size_t;
                      ^
In file included from /usr/src/bin/csh/../../contrib/tcsh/sh.c:34:
In file included from /usr/src/bin/csh/../../contrib/tcsh/sh.h:376:
/usr/local/bin/../lib/clang/3.5/include/stdarg.h:47:9: error: '__GNUC_VA_LIST'
      macro redefined [-Werror]
#define __GNUC_VA_LIST 1
        ^
/usr/include/machine/_types.h:106:9: note: previous definition is here
#define __GNUC_VA_LIST
        ^
In file included from /usr/src/bin/csh/../../contrib/tcsh/sh.c:34:
In file included from /usr/src/bin/csh/../../contrib/tcsh/sh.h:376:
/usr/local/bin/../lib/clang/3.5/include/stdarg.h:48:27: error: redefinition of
      typedef '__gnuc_va_list' is a C11 feature [-Werror,-Wtypedef-redefinition]
typedef __builtin_va_list __gnuc_va_list;
                          ^
/usr/include/machine/_types.h:107:20: note: previous definition is here
typedef __va_list               __gnuc_va_list; /* compatibility w/GNU headers*/
                                ^
4 errors generated.
*** [sh.o] Error code 1

Stop in /usr/src/bin/csh.



More information about the freebsd-sparc64 mailing list