clang
	
	
	
    	
Compiling DragonFly BSD using llvm/clang 
Overview
This page tracks the progress on an effort to compile DragonFly with llvm/clang instead of gcc.
 
 
How?
 
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 revision | Status | Remarks | 
 
| GENERIC | 66925 | Doesn't compile | Filed 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 revision | Status | Problem area | Remarks | 
| world | 67025 | Doesn't compile | all | Filed llvm/clang bug #3853 | 
| world | 69545 | Partially compiles | lib/libc | Issue 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 Description | Affects | Status | 
| 3805 | ccc ignores -x assembler-with-cpp | build of locore.s | Fixed | 
| 3812 | assembler doesn't properly process clobber,input and output register lists | atomic_intr_cond_try in atomic.h | Closed | 
| 3822 | failed assertion with -O2 | build of GENERIC with -O2 | Fixed | 
| 3853 | __thread keyword not supported | build of all userland base tools | Fixed | 
| 4007 | clang doesn't know  -Werror-foo is the same as -Werror=foo | barrage of warnings during make depend | Fixed | 
| 4020 | clang doesn't allow zero-sized arrays | build of lib/libc | Closed (won't fix) | 
| 4022 | incorrect handling of __inline | build of LINT | Closed | 
 
 
 atomic_intr_cond_try
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.