On 09/14/2012 01:30 PM, Daniel-Constantin Mierla wrote:
Hello,
nice, is everything compiling (at least the standard modules and most commonly used)?
Hello,
core, modules-all and some other modules we use seem to work fine. If there are problems on architectures (tested linux x86-64) there will be ways of fixing it. Tested (after another libkcore commit) with registrar, tm, sl, and others and K starts ok.
The fist useful thing is to run the static analysis frontend of clang
scan-build make cfg scan-build make
Then run scan-view as outputed bye the previous command to view the defects.
Haven't had time to test performance of the binary and compare it with the gcc build at same optimization level, but will give it a go in the future.
Marius
Thanks, Daniel
On 9/14/12 12:23 PM, Marius Zbihlei wrote:
Module: sip-router Branch: master Commit: 452c543de61d413351a5ac0816adc137d150824b URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=452c543d...
Author: Marius Zbihlei marius.zbihlei@1and1.ro Committer: Marius Zbihlei marius.zbihlei@1and1.ro Date: Fri Sep 14 13:17:24 2012 +0300
core: Added support for the clang compiler
Support for clang, a C compiler from the LLVM suite has been added. Install clang and run 'make cfg CC=clang && make' for building. GCC Inline assembly is supported. TODO: clean warning caused by clang (-Wunused-variable, etc)
Makefile.defs | 41 ++++++++++++++++++++++++++++++++++++++++- 1 files changed, 40 insertions(+), 1 deletions(-)
diff --git a/Makefile.defs b/Makefile.defs index b9718fd..9bf78b5 100644 --- a/Makefile.defs +++ b/Makefile.defs @@ -321,6 +321,14 @@ ifneq (, $(findstring Intel(R) C++ Compiler, $(CC_LONGVER))) MKDEP=$(CC) -MM endif
+ifneq (, $(findstring clang, $(CC_LONGVER)))
- #clang should be gcc compatible
- CC_NAME=clang
- CC_FULLVER:=$(shell echo "$(CC_LONGVER)" | head -n 1 | sed -e 's/.*version ([0-9].[0-9]).*/\1/g' )
- CC_SHORTVER:=$(shell echo "$(CC_FULLVER)" | cut -d. -f1,2 )
- CC_VER=$(CC) $(CC_FULLVER)
- MKDEP=$(CC) -MM
+endif
ifeq (,$(CC_NAME)) #not found @@ -866,7 +874,7 @@ ifeq ($(mode), release) #if i386 ifeq ($(ARCH), i386) # if gcc -ifeq ($(CC_NAME), gcc) +ifeq ($(CC_NAME), gcc) C_DEFS+=-DCC_GCC_LIKE_ASM #common stuff CFLAGS=-g -O9 -funroll-loops -Wcast-align $(PROFILE) @@ -923,6 +931,15 @@ endif # CC_SHORTVER, 4.x endif # CC_SHORTVER, 4.5+ or 4.2+
else # CC_NAME, gcc +ifeq ($(CC_NAME), clang) +$(call set_if_empty,CPU,athlon64)
C_DEFS+=-DCC_GCC_LIKE_ASM
CFLAGS+=-m32
\
\
-mtune=$(CPU)
LDFLAGS+=-m32
+else # CC_NAME, clang ifeq ($(CC_NAME), icc) C_DEFS+=-DCC_GCC_LIKE_ASM CFLAGS=-g -O3 -ipo -ipo_obj -unroll $(PROFILE) \ @@ -935,6 +952,7 @@ else #other compilers $(error Unsupported compiler ($(CC):$(CC_NAME)), try gcc) endif #CC_NAME, icc +endif #CC_NAME, clang endif #CC_NAME, gcc endif #ARCH, i386
@@ -1009,6 +1027,13 @@ endif # CC_SHORTVER, 4.2+ endif # CC_SHORTVER, 4.5+
else # CC_NAME, gcc +ifeq ($(CC_NAME), clang) +$(call set_if_empty,CPU,opteron)
C_DEFS+=-DCC_GCC_LIKE_ASM
CFLAGS+=-m64 \
LDFLAGS+=-m64
+else # CC_NAME, clang ifeq ($(CC_NAME), icc) C_DEFS+=-DCC_GCC_LIKE_ASM CFLAGS=-g -O3 -ipo -ipo_obj -unroll $(PROFILE) \ @@ -1021,6 +1046,7 @@ else #other compilers $(error Unsupported compiler ($(CC):$(CC_NAME)), try gcc) endif #CC_NAME, icc +endif #CC_NAME, clang endif #CC_NAME, gcc endif #ARCH, x86_64
@@ -1597,6 +1623,14 @@ endif # the executable file, because it's always loaded at a fixed address # -andrei
+ifeq ($(CC_NAME), clang)
- LDFLAGS+=-Wl,-O2 -Wl,-E $(PROFILE)
MOD_LDFLAGS:=-shared $(LDFLAGS)
LIB_LDFLAGS:=-shared $(LDFLAGS)
LIB_SONAME=-Wl,-soname,
LD_RPATH=-Wl,-rpath,
+endif
- LDFLAGS+= $(LD_EXTRA_OPTS) MOD_LDFLAGS+= $(LD_EXTRA_OPTS) LIB_LDFLAGS+= $(LD_EXTRA_OPTS)
@@ -1674,6 +1708,11 @@ ifeq ($(CC_NAME), suncc) MOD_CFLAGS=-xcode=pic32 $(CFLAGS) LIB_CFLAGS=-xcode=pic32 $(CFLAGS) endif +ifeq ($(CC_NAME), clang) +MOD_CFLAGS=-fPIC -DPIC $(CFLAGS) +LIB_CFLAGS=-fPIC -DPIC $(CFLAGS) +endif
- UTILS_CFLAGS=$(CFLAGS) # LDFLAGS uses for compiling the utils UTILS_LDFLAGS=$(LDFLAGS)
sr-dev mailing list sr-dev@lists.sip-router.org http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev