DragonFly BSD


Compiling DragonFly BSD using llvm/clang


This page tracks the progress on an effort to compile DragonFly with llvm/clang instead of gcc.


First, you'll need to build clang as described here (it builds out of the box on DragonFly).
cd /usr/src
env WORLD_CCVER=clang make -DNO_GCC44 buildworld
env WORLD_CCVER=clang make buildkernel KERNCONF=...

Status (Kernel/pc32)

Type llvm/clang revisionStatus Remarks
GENERIC 66925 Doesn't compileFiled llvm/clang bug #3805
GENERIC 67025 Doesn't link (ncr, nsp, tmc) This commit should fix it
GENERIC 67025 Compiles, doesn't boot(see Current Log) - Filed llvm/clang bug #3812.
GENERIC 67025 Boots, seems to work ok network adapters removed from system
GENERIC 67025 Boots, survives stress test (buildworld)

Status (Userland/pc32)

Type llvm/clang revisionStatus Problem areaRemarks
world 67025 Doesn't compile all Filed llvm/clang bug #3853
world 69545 Partially compiles lib/libcIssue with zero-size arrays (see note below), filed llvm/clang bug #4020 Edit: This commit solves this issue

Related llvm/clang bug reports

Bug #Bug DescriptionAffects Status
3805ccc ignores -x assembler-with-cppbuild of locore.sFixed
3812assembler doesn't properly process clobber,input and output register listsatomic_intr_cond_try in atomic.hClosed
3822failed assertion with -O2build of GENERIC with -O2Fixed
3853__thread keyword not supportedbuild of all userland base toolsFixed
4007 clang doesn't know -Werror-foo is the same as -Werror=foobarrage of warnings during make dependFixed
4020clang doesn't allow zero-sized arraysbuild of lib/libcClosed (won't fix)
4022incorrect handling of __inlinebuild of LINTClosed


The long standing atomic_intr_cond_try issue has been solved in commit caae4d604234d17dff3080f60624a583965c2cf4.

llvm/clang oddities

zero-size arrays

llvm/clang doesn't support zero sized arrays and automatically generates arrays with a size 1 when a zero-size array is specified.

__i386__ vs i386

NOTE: This issue has been fixed in this commit.