Re: Clang now builds world and kernel, on i386 and amd64

From: Olivier Smedts <olivier_at_gid0.org>
Date: Tue, 28 Sep 2010 15:41:54 +0200
2010/9/27 Olivier Smedts <olivier_at_gid0.org>:
> 2010/9/23 Bartosz Stec <admin_at_kkip.pl>:
>>  On 2010-09-23 08:51, Roman Divacky wrote:
>>>
>>> if you want to post any build-time numbers for clang please
>>>
>>>           -D__STDC_LIMIT_MACROS -D__STDC_CONSTANT_MACROS #-DNDEBUG
>>>
>>> uncomment the -DNDEBUG on this line in lib/clang/clang.build.mk
>>> and rebuild it otherwise you are using Release+Asserts build of
>>> clang which is some 30% slower than the normal one...
>>> _______________________________________________
>>> freebsd-current_at_freebsd.org mailing list
>>> http://lists.freebsd.org/mailman/listinfo/freebsd-current
>>> To unsubscribe, send any mail to "freebsd-current-unsubscribe_at_freebsd.org"
>>
>> When i try to rebuild world again (machine has world and kernel builded with
>> clang) I cought following problem at the very beginning:
>>
>> --------------------------------------------------------------
>>>>> World build started on Thu Sep 23 12:46:55 CEST 2010
>> --------------------------------------------------------------
>>
>> --------------------------------------------------------------
>>>>> Rebuilding the temporary build tree
>> --------------------------------------------------------------
>> rm -rf /usr/obj/usr/src/tmp
>> mkdir -p /usr/obj/usr/src/tmp/lib
>> mkdir -p /usr/obj/usr/src/tmp/usr
>> mkdir -p /usr/obj/usr/src/tmp/legacy/usr
>> mtree -deU -f /usr/src/etc/mtree/BSD.usr.dist  -p
>> /usr/obj/usr/src/tmp/legacy/usr >/dev/null
>> mtree -deU -f /usr/src/etc/mtree/BSD.usr.dist  -p /usr/obj/usr/src/tmp/usr
>>>/dev/null
>> mtree -deU -f /usr/src/etc/mtree/BSD.include.dist  -p
>> /usr/obj/usr/src/tmp/usr/include >/dev/null
>> ln -sf /usr/src/sys /usr/obj/usr/src/tmp
>>
>> --------------------------------------------------------------
>>>>> stage 1.1: legacy release compatibility shims
>> --------------------------------------------------------------
>> cd /usr/src; MAKEOBJDIRPREFIX=/usr/obj/usr/src/tmp  INSTALL="sh
>> /usr/src/tools/install.sh"
>>  PATH=/usr/obj/usr/src/tmp/legacy/usr/sbin:/usr/obj/usr/src/tmp/legacy/usr/bin:/usr/obj/usr/src/tmp/legacy/usr/games:/sbin:/bin:/usr/sbin:/usr/bin
>>  WORLDTMP=/usr/obj/usr/src/tmp  VERSION="FreeBSD 9.0-CURRENT i386 900021"
>>  MAKEFLAGS="-m /usr/src/tools/build/mk  -m /usr/src/share/mk" make -f
>> Makefile.inc1  DESTDIR=  BOOTSTRAPPING=900021  SSP_CFLAGS=  -DWITHOUT_HTML
>> -DWITHOUT_INFO -DNO_LINT -DWITHOUT_MAN  -DNO_PIC -DWITHOUT_PROFILE
>> -DNO_SHARED  -DNO_CPU_CFLAGS -DNO_WARNS -DNO_CTF legacy
>> ===> tools/build (obj,includes,depend,all,install)
>> /usr/obj/usr/src/tmp/usr/src/tools/build created for /usr/src/tools/build
>> cd /usr/src/tools/build; make buildincludes; make installincludes
>> rm -f .depend
>> CC='clang' mkdep -f .depend -a    -I/usr/obj/usr/src/tmp/legacy/usr/include
>> /usr/src/tools/build/dummy.c
>> clang -O2 -pipe -std=gnu99   -I/usr/obj/usr/src/tmp/legacy/usr/include -c
>> /usr/src/tools/build/dummy.c
>> building static egacy library
>> ranlib libegacy.a
>> sh /usr/src/tools/install.sh -C -o root -g wheel -m 444   libegacy.a
>> /usr/obj/usr/src/tmp/legacy/usr/lib
>>
>> --------------------------------------------------------------
>>>>> stage 1.2: bootstrap tools
>> --------------------------------------------------------------
>> cd /usr/src; MAKEOBJDIRPREFIX=/usr/obj/usr/src/tmp  INSTALL="sh
>> /usr/src/tools/install.sh"
>>  PATH=/usr/obj/usr/src/tmp/legacy/usr/sbin:/usr/obj/usr/src/tmp/legacy/usr/bin:/usr/obj/usr/src/tmp/legacy/usr/games:/sbin:/bin:/usr/sbin:/usr/bin
>>  WORLDTMP=/usr/obj/usr/src/tmp  VERSION="FreeBSD 9.0-CURRENT i386 900021"
>>  MAKEFLAGS="-m /usr/src/tools/build/mk  -m /usr/src/share/mk" make -f
>> Makefile.inc1  DESTDIR=  BOOTSTRAPPING=900021  SSP_CFLAGS=  -DWITHOUT_HTML
>> -DWITHOUT_INFO -DNO_LINT -DWITHOUT_MAN  -DNO_PIC -DWITHOUT_PROFILE
>> -DNO_SHARED  -DNO_CPU_CFLAGS -DNO_WARNS -DNO_CTF bootstrap-tools
>> ===> lib/clang/libllvmsupport (obj,depend,all,install)
>> /usr/obj/usr/src/tmp/usr/src/lib/clang/libllvmsupport created for
>> /usr/src/lib/clang/libllvmsupport
>> rm -f .depend
>> CC='clang' mkdep -f .depend -a
>>  -I/usr/src/lib/clang/libllvmsupport/../../../contrib/llvm/include
>> -I/usr/src/lib/clang/libllvmsupport/../../../contrib/llvm/tools/clang/include
>> -I/usr/src/lib/clang/libllvmsupport/../../../contrib/llvm/lib/Support -I.
>> -I/usr/src/lib/clang/libllvmsupport/../../../contrib/llvm/../../lib/clang/include
>> -DLLVM_ON_UNIX -DLLVM_ON_FREEBSD -D__STDC_LIMIT_MACROS
>> -D__STDC_CONSTANT_MACROS -DNDEBUG
>> -DLLVM_HOSTTRIPLE=\"i386-undermydesk-freebsd9.0\"
>> -I/usr/obj/usr/src/tmp/legacy/usr/include
>> /usr/src/lib/clang/libllvmsupport/../../../contrib/llvm/lib/Support/regcomp.c
>> /usr/src/lib/clang/libllvmsupport/../../../contrib/llvm/lib/Support/regerror.c
>> /usr/src/lib/clang/libllvmsupport/../../../contrib/llvm/lib/Support/regexec.c
>> /usr/src/lib/clang/libllvmsupport/../../../contrib/llvm/lib/Support/regfree.c
>> /usr/src/lib/clang/libllvmsupport/../../../contrib/llvm/lib/Support/regstrlcpy.c
>> CC='clang' mkdep -f .depend -a
>>  -I/usr/src/lib/clang/libllvmsupport/../../../contrib/llvm/include
>> -I/usr/src/lib/clang/libllvmsupport/../../../contrib/llvm/tools/clang/include
>> -I/usr/src/lib/clang/libllvmsupport/../../../contrib/llvm/lib/Support -I.
>> -I/usr/src/lib/clang/libllvmsupport/../../../contrib/llvm/../../lib/clang/include
>> -DLLVM_ON_UNIX -DLLVM_ON_FREEBSD -D__STDC_LIMIT_MACROS
>> -D__STDC_CONSTANT_MACROS -DNDEBUG
>> -DLLVM_HOSTTRIPLE=\"i386-undermydesk-freebsd9.0\"
>> -I/usr/obj/usr/src/tmp/legacy/usr/include
>>  /usr/src/lib/clang/libllvmsupport/../../../contrib/llvm/lib/Support/APFloat.cpp
>> /usr/src/lib/clang/libllvmsupport/../../../contrib/llvm/lib/Support/APInt.cpp
>> /usr/src/lib/clang/libllvmsupport/../../../contrib/llvm/lib/Support/APSInt.cpp
>> /usr/src/lib/clang/libllvmsupport/../../../contrib/llvm/lib/Support/Allocator.cpp
>> /usr/src/lib/clang/libllvmsupport/../../../contrib/llvm/lib/Support/CommandLine.cpp
>> /usr/src/lib/clang/libllvmsupport/../../../contrib/llvm/lib/Support/ConstantRange.cpp
>> /usr/src/lib/clang/libllvmsupport/../../../contrib/llvm/lib/Support/CrashRecoveryContext.cpp
>> /usr/src/lib/clang/libllvmsupport/../../../contrib/llvm/lib/Support/DAGDeltaAlgorithm.cpp
>> /usr/src/lib/clang/libllvmsupport/../../../contrib/llvm/lib/Support/Debug.cpp
>> /usr/src/lib/clang/libllvmsupport/../../../contrib/llvm/lib/Support/DeltaAlgorithm.cpp
>> /usr/src/lib/clang/libllvmsupport/../../../contrib/llvm/lib/Support/Dwarf.cpp
>> /usr/src/lib/clang/libllvmsupport/../../../contrib/llvm/lib/Support/ErrorHandling.cpp
>> /usr/src/lib/clang/libllvmsupport/../../../contrib/llvm/lib/Support/FoldingSet.cpp
>> /usr/src/lib/clang/libllvmsupport/../../../contrib/llvm/lib/Support/FormattedStream.cpp
>> /usr/src/lib/clang/libllvmsupport/../../../contrib/llvm/lib/Support/GraphWriter.cpp
>> /usr/src/lib/clang/libllvmsupport/../../../contrib/llvm/lib/Support/ManagedStatic.cpp
>> /usr/src/lib/clang/libllvmsupport/../../../contrib/llvm/lib/Support/MemoryBuffer.cpp
>> /usr/src/lib/clang/libllvmsupport/../../../contrib/llvm/lib/Support/PluginLoader.cpp
>> /usr/src/lib/clang/libllvmsupport/../../../contrib/llvm/lib/Support/PrettyStackTrace.cpp
>> /usr/src/lib/clang/libllvmsupport/../../../contrib/llvm/lib/Support/Regex.cpp
>> /usr/src/lib/clang/libllvmsupport/../../../contrib/llvm/lib/Support/SmallPtrSet.cpp
>> /usr/src/lib/clang/libllvmsupport/../../../contrib/llvm/lib/Support/SmallVector.cpp
>> /usr/src/lib/clang/libllvmsupport/../../../contrib/llvm/lib/Support/SourceMgr.cpp
>> /usr/src/lib/clang/libllvmsupport/../../../contrib/llvm/lib/Support/Statistic.cpp
>> /usr/src/lib/clang/libllvmsupport/../../../contrib/llvm/lib/Support/StringExtras.cpp
>> /usr/src/lib/clang/libllvmsupport/../../../contrib/llvm/lib/Support/StringMap.cpp
>> /usr/src/lib/clang/libllvmsupport/../../../contrib/llvm/lib/Support/StringPool.cpp
>> /usr/src/lib/clang/libllvmsupport/../../../contrib/llvm/lib/Support/StringRef.cpp
>> /usr/src/lib/clang/libllvmsupport/../../../contrib/llvm/lib/Support/TargetRegistry.cpp
>> /usr/src/lib/clang/libllvmsupport/../../../contrib/llvm/lib/Support/Timer.cpp
>> /usr/src/lib/clang/libllvmsupport/../../../contrib/llvm/lib/Support/Triple.cpp
>> /usr/src/lib/clang/libllvmsupport/../../../contrib/llvm/lib/Support/Twine.cpp
>> /usr/src/lib/clang/libllvmsupport/../../../contrib/llvm/lib/Support/circular_raw_ostream.cpp
>> /usr/src/lib/clang/libllvmsupport/../../../contrib/llvm/lib/Support/raw_os_ostream.cpp
>> /usr/src/lib/clang/libllvmsupport/../../../contrib/llvm/lib/Support/raw_ostream.cpp
>> clang++ -O2 -pipe
>> -I/usr/src/lib/clang/libllvmsupport/../../../contrib/llvm/include
>> -I/usr/src/lib/clang/libllvmsupport/../../../contrib/llvm/tools/clang/include
>> -I/usr/src/lib/clang/libllvmsupport/../../../contrib/llvm/lib/Support -I.
>> -I/usr/src/lib/clang/libllvmsupport/../../../contrib/llvm/../../lib/clang/include
>> -DLLVM_ON_UNIX -DLLVM_ON_FREEBSD -D__STDC_LIMIT_MACROS
>> -D__STDC_CONSTANT_MACROS -DNDEBUG
>> -DLLVM_HOSTTRIPLE=\"i386-undermydesk-freebsd9.0\" -fno-exceptions
>> -I/usr/obj/usr/src/tmp/legacy/usr/include -c
>> /usr/src/lib/clang/libllvmsupport/../../../contrib/llvm/lib/Support/APFloat.cpp
>> Assertion failed: (false && "Ran out of registers during register
>> allocation!"), function assignRegOrStackSlotAtInterval, file
>> /usr/src/lib/clang/libllvmcodegen/../../../contrib/llvm/lib/CodeGen/RegAllocLinearScan.cpp,
>> line 1196.
>> Stack dump:
>> 0.      Program arguments: /usr/bin/clang++ -cc1 -triple
>> i386-undermydesk-freebsd9.0 -S -disable-free -main-file-name APFloat.cpp
>> -mrelocation-model static -mdisable-fp-elim -mconstructor-aliases
>> -target-cpu i486 -resource-dir /usr/lib/clang/2.8 -D LLVM_ON_UNIX -D
>> LLVM_ON_FREEBSD -D __STDC_LIMIT_MACROS -D __STDC_CONSTANT_MACROS -D NDEBUG
>> -D LLVM_HOSTTRIPLE="i386-undermydesk-freebsd9.0" -I
>> /usr/src/lib/clang/libllvmsupport/../../../contrib/llvm/include -I
>> /usr/src/lib/clang/libllvmsupport/../../../contrib/llvm/tools/clang/include
>> -I /usr/src/lib/clang/libllvmsupport/../../../contrib/llvm/lib/Support -I .
>> -I
>> /usr/src/lib/clang/libllvmsupport/../../../contrib/llvm/../../lib/clang/include
>> -I /usr/obj/usr/src/tmp/legacy/usr/include -O2 -ferror-limit 19
>> -fmessage-length 205 -fgnu-runtime -fdiagnostics-show-option
>> -fcolor-diagnostics -o /tmp/cc-lvFfGd.s -x c++
>> /usr/src/lib/clang/libllvmsupport/../../../contrib/llvm/lib/Support/APFloat.cpp
>> 1. <eof> parser at end of file
>> 2.      Code generation
>> 3.      Running pass 'Linear Scan Register Allocator' on function
>> '_at__ZN4llvm7APFloat28convertFromHexadecimalStringENS_9StringRefENS0_12roundingModeE'
>> clang++: error: clang frontend command failed due to signal 6 (use -v to see
>> invocation)
>> *** Error code 250
>
> Same error here with yesterday's -CURRENT, but not at the same time
> (the running system was compiled using gcc) :
>
> # uname -a
> FreeBSD z.gid0.org 9.0-CURRENT FreeBSD 9.0-CURRENT #0: Fri Sep 24
> 22:07:43 CEST 2010     root_at_z.gid0.org:/usr/obj/usr/src/sys/XPC  i386
> # clang -v
> FreeBSD clang version 2.8 (branches/release_28 114020) 20100917
> Target: i386-undermydesk-freebsd9.0
> Thread model: posix
> # grep -vE '^#|^$' /etc/make.conf
> KERNCONF=XPC
> CPUTYPE=athlon-xp
> CFLAGS=-O2 -pipe -march=native -fomit-frame-pointer
> NO_CPU_CFLAGS=yes
> COPTFLAGS=-O2 -pipe -march=native -fomit-frame-pointer
> NO_CPU_COPTFLAGS=yes
> WITHOUT_PROFILE=yes
> SUP_UPDATE=yes
> SUPFILE=/usr/share/examples/cvsup/standard-supfile
> SUPHOST=cvsup3.fr.freebsd.org
> .if !defined(CC) || ${CC} == "cc"
> CC=clang
> .endif
> .if !defined(CXX) || ${CXX} == "c++"
> CXX=clang++
> .endif
> NO_WERROR=
> WERROR=
> # make buildworld
> [...]
> ===> gnu/lib/libgcc (obj,depend,all,install)
> make -f /usr/src/gnu/lib/libgcc/../../usr.bin/cc/cc_tools/Makefile
> MFILE=/usr/src/gnu/lib/libgcc/../../usr.bin/cc/cc_tools/Makefile
> GCCDIR=/usr/src/gnu/lib/libgcc/../../../contrib/gcc tm.h
> TARGET_CPU_DEFAULT=""  HEADERS="options.h i386/i386.h i386/unix.h
> i386/att.h dbxelf.h elfos-undef.h elfos.h freebsd-native.h
> freebsd-spec.h freebsd.h i386/freebsd.h defaults.h"  DEFINES=""
> /bin/sh /usr/src/gnu/lib/libgcc/../../../contrib/gcc/mkconfig.sh tm.h
> echo '#define EXTRA_MODES_FILE "i386/i386-modes.def"' >> tm.h
> make -f /usr/src/gnu/lib/libgcc/../../usr.bin/cc/cc_tools/Makefile
> MFILE=/usr/src/gnu/lib/libgcc/../../usr.bin/cc/cc_tools/Makefile
> GCCDIR=/usr/src/gnu/lib/libgcc/../../../contrib/gcc tconfig.h
> TARGET_CPU_DEFAULT=""  HEADERS="auto-host.h ansidecl.h"
> DEFINES="USED_FOR_TARGET"  /bin/sh
> /usr/src/gnu/lib/libgcc/../../../contrib/gcc/mkconfig.sh tconfig.h
> make -f /usr/src/gnu/lib/libgcc/../../usr.bin/cc/cc_tools/Makefile
> MFILE=/usr/src/gnu/lib/libgcc/../../usr.bin/cc/cc_tools/Makefile
> GCCDIR=/usr/src/gnu/lib/libgcc/../../../contrib/gcc options.h
> LC_ALL=C awk -f
> /usr/src/gnu/lib/libgcc/../../../contrib/gcc/opt-gather.awk
> /usr/src/gnu/lib/libgcc/../../../contrib/gcc/c.opt
> /usr/src/gnu/lib/libgcc/../../../contrib/gcc/common.opt
> /usr/src/gnu/lib/libgcc/../../../contrib/gcc/config/i386/i386.opt >
> optionlist
> LC_ALL=C awk -f
> /usr/src/gnu/lib/libgcc/../../../contrib/gcc/opt-functions.awk  -f
> /usr/src/gnu/lib/libgcc/../../../contrib/gcc/opth-gen.awk  <
> optionlist > options.h
> make -f /usr/src/gnu/lib/libgcc/../../usr.bin/cc/cc_tools/Makefile
> MFILE=/usr/src/gnu/lib/libgcc/../../usr.bin/cc/cc_tools/Makefile
> GCCDIR=/usr/src/gnu/lib/libgcc/../../../contrib/gcc unwind.h
> ln -sf /usr/src/gnu/lib/libgcc/../../../contrib/gcc/unwind-generic.h unwind.h
> make -f /usr/src/gnu/lib/libgcc/../../usr.bin/cc/cc_tools/Makefile
> MFILE=/usr/src/gnu/lib/libgcc/../../usr.bin/cc/cc_tools/Makefile
> GCCDIR=/usr/src/gnu/lib/libgcc/../../../contrib/gcc gthr-default.h
> ln -sf /usr/src/gnu/lib/libgcc/../../../contrib/gcc/gthr-posix.h gthr-default.h
> clang -c -O2 -pipe -march=native -fomit-frame-pointer -DIN_GCC
> -DIN_LIBGCC2 -D__GCC_FLOAT_NOT_NEEDED  -DHAVE_GTHR_DEFAULT
> -I/usr/src/gnu/lib/libgcc/../../../contrib/gcclibs/include
> -I/usr/src/gnu/lib/libgcc/../../../contrib/gcc/config
> -I/usr/src/gnu/lib/libgcc/../../../contrib/gcc -I.
> -I/usr/src/gnu/lib/libgcc/../../usr.bin/cc/cc_tools -std=gnu99
> -fvisibility=hidden -DHIDE_EXPORTS -fPIC -fexceptions -D__GLIBC__=3
> -DElfW=__ElfN -o unwind-dw2.o
> /usr/src/gnu/lib/libgcc/../../../contrib/gcc/unwind-dw2.c
> Assertion failed: (!spillIs.empty() && "No spill intervals?"),
> function assignRegOrStackSlotAtInterval, file
> /usr/src/lib/clang/libllvmcodegen/../../../contrib/llvm/lib/CodeGen/RegAllocLinearScan.cpp,
> line 1287.
> Stack dump:
> 0.      Program arguments: /usr/obj/usr/src/tmp/usr/bin/clang -cc1
> -triple i386-undermydesk-freebsd9.0 -S -disable-free -main-file-name
> unwind-dw2.c -pic-level 2 -mconstructor-aliases -target-cpu athlon-mp
> -resource-dir /usr/obj/usr/src/tmp/usr/lib/clang/2.8 -D IN_GCC -D
> IN_LIBGCC2 -D __GCC_FLOAT_NOT_NEEDED -D HAVE_GTHR_DEFAULT -D
> HIDE_EXPORTS -D __GLIBC__=3 -D ElfW=__ElfN -I
> /usr/src/gnu/lib/libgcc/../../../contrib/gcclibs/include -I
> /usr/src/gnu/lib/libgcc/../../../contrib/gcc/config -I
> /usr/src/gnu/lib/libgcc/../../../contrib/gcc -I . -I
> /usr/src/gnu/lib/libgcc/../../usr.bin/cc/cc_tools -O2 -std=gnu99
> -ferror-limit 19 -fmessage-length 118 -fvisibility hidden -fexceptions
> -fgnu-runtime -fdiagnostics-show-option -fcolor-diagnostics -o
> /tmp/cc-UeLPOI.s -x c
> /usr/src/gnu/lib/libgcc/../../../contrib/gcc/unwind-dw2.c
> 1.      <eof> parser at end of file
> 2.      Code generation
> 3.      Running pass 'Linear Scan Register Allocator' on function
> '_at__Unwind_GetGR'
> clang: error: clang frontend command failed due to signal 6 (use -v to
> see invocation)
> *** Error code 250
>
> Stop in /usr/src/gnu/lib/libgcc.
> *** Error code 1

I solved this problem at my level by adding "CFLAGS+=-mno-sse" to
src/lib/clang/clang.lib.mk
Now I can "make buildworld buildkernel" with "-march=native" (on an
Athlon XP). Without that, the clang compiled with SSE failed to
compile libgcc. Note : this does not add "-mno-sse" to all CFLAGS but
only to the CFLAGS used to compile clang/llvm libs.
Maybe I could find one or more specific libs which require "-mno-sse"
in this case, but there are 50 in src/lib/clang/, and this computer is
really slow to buildworld. Any clues on this ?

>
> Stop in /usr/src.
> *** Error code 1
>
> Stop in /usr/src.
> *** Error code 1
>
> Stop in /usr/src.
> *** Error code 1
>
> Stop in /usr/src.
>
>
> --
> Olivier Smedts                                                 _
>                                         ASCII ribbon campaign ( )
> e-mail: olivier_at_gid0.org        - against HTML email & vCards  X
> www: http://www.gid0.org    - against proprietary attachments / \
>
>   "Il y a seulement 10 sortes de gens dans le monde :
>   ceux qui comprennent le binaire,
>   et ceux qui ne le comprennent pas."
>



-- 
Olivier Smedts                                                 _
                                        ASCII ribbon campaign ( )
e-mail: olivier_at_gid0.org        - against HTML email & vCards  X
www: http://www.gid0.org    - against proprietary attachments / \

  "Il y a seulement 10 sortes de gens dans le monde :
  ceux qui comprennent le binaire,
  et ceux qui ne le comprennent pas."
Received on Tue Sep 28 2010 - 11:41:55 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:40:07 UTC