Trying to use clang/head and XCC

Brooks Davis brooks at freebsd.org
Wed May 20 04:52:36 UTC 2015


On Tue, May 19, 2015 at 06:47:13PM -0700, Sean Bruno wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA512
> 
> On 05/19/15 13:21, Brooks Davis wrote:
> > On Tue, May 19, 2015 at 12:41:28PM -0700, Sean Bruno wrote: On
> > 05/19/15 09:53, Brooks Davis wrote:
> >>>> On Tue, May 19, 2015 at 09:23:42AM -0700, Sean Bruno wrote: 
> >>>> Following the External Tool Chain instructions on the wiki
> >>>> seem to not work: https://wiki.freebsd.org/ExternalToolchain
> >>>> 
> >>>> I've gotten about this far: 
> >>>> https://people.freebsd.org/~sbruno/clang_head_build_log.txt
> >>>> 
> >>>>> You need to delete 
> >>>>> /home/sbruno/bsd/clang/build/bin/../lib/clang/3.7.0/include/std*
> >>>>>  and possibly also limits.h (it's broken for libstand on
> >>>>> mips). If you use the ports/pkgs they do this.
> > 
> > This didn't seem to make any difference when xcompiling for AMD64,
> > but I did run into a buildfailure which might mean I don't know
> > what I'm doing:
> > 
> >> rm
> >> /home/sbruno/bsd/clang/build/bin/../lib/clang/3.7.0/include/limits.h
> >
> >>  should do get around this one.  I hit this one on mips a few
> >> weeks ago.
> > 
> >> It's a bug in upstream clang that the bundled limits.h doesn't 
> >> #include_next <limits.h> with -ffreestanding.  I've not had a
> >> chance to submit a review request to fix it.
> > 
> >> -- Brooks

> >>>> 
> >>>> Two items of note. -- The bootstrap bits *completely* ignore
> >>>> XCC and build with the host cc/c++
> >>>> 
> >>>>> That's expected.  In principle clang could be used as the
> >>>>> cross compiler since it's multi-target, but gcc could never
> >>>>> work unless the host and target are the same.
> >>>> 
> >>>> -- No documentation of what CFLAGS are required to build and
> >>>> ignore warnings.
> >>>> 
> >>>>> It will change with every clang/gcc release.  In practice
> >>>>> you will need to either fix the warnings wack-a-mole style
> >>>>> or set NO_WERROR in the environment.
> >>>> 
> >>>>> -- Brooks
> >>>> 
> >>>> 
> >>>> Anyone out there have success doing this?
> >>>> 
> >>>> sean
> 
> 
> 
> Getting much closer, I think this is fixable, but maybe we need to
> pass this upstream?
> ===> sys/boot/i386/boot2 (depend)
> ln -sf
> /home/sbruno/bsd/fbsd_head/sys/boot/i386/boot2/../../../i386/include
> machine
> /home/sbruno/bsd/clang/build/bin/clang -target
> x86_64-unknown-freebsd11.0
> - --sysroot=/var/tmp/home/sbruno/bsd/fbsd_head/tmp
> - -B/var/tmp/home/sbruno/bsd/fbsd_head/tmp/usr/bin -fomit-frame-pointer
>  -mrtd  -mregparm=3  -DUSE_XREAD  -DUFS1_AND_UFS2  -DFLAGS=0x80
> - -DSIOPRT=0x3f8  -DSIOFMT=0x3  -DSIOSPD=9600
> - -I/home/sbruno/bsd/fbsd_head/sys/boot/i386/boot2/../../common
> - -I/home/sbruno/bsd/fbsd_head/sys/boot/i386/boot2/../btx/lib -I.  -Wall
> - -Waggregate-return -Wbad-function-cast -Wcast-align
> - -Wmissing-declarations -Wmissing-prototypes -Wnested-externs
> - -Wpointer-arith -Wshadow -Wstrict-prototypes -Wwrite-strings  -Winline
> - -march=i386 -ffreestanding -mno-mmx -mno-3dnow -mno-sse -mno-sse2
> - -mno-sse3 -msoft-float -m32 -std=gnu99    -Oz -mstack-alignment=8
> - -mllvm -inline-threshold=3 -mllvm -simplifycfg-dup-ret -mllvm
> - -enable-gvn=false -Qunused-arguments -no-integrated-as  -m32 -c
> /home/sbruno/bsd/fbsd_head/sys/boot/i386/boot2/boot1.S -o boot1.o
> clang (LLVM option parsing): Unknown command line argument
> '-enable-gvn=false'.  Try: 'clang (LLVM option parsing) -help'
> clang (LLVM option parsing): Did you mean '-enable-pre=false'?
> *** Error code 1

IIRC -enable-gvn=false is a local option Dimitry added to our clang.  I don't
remember the suggested workaround off hand.

-- Brooks
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 473 bytes
Desc: not available
URL: <http://lists.freebsd.org/pipermail/freebsd-hackers/attachments/20150520/d8c413ea/attachment.sig>


More information about the freebsd-hackers mailing list