Index: uspace/lib/libc/Makefile.toolchain
===================================================================
--- uspace/lib/libc/Makefile.toolchain	(revision f563126931ea083d74828e89fd20f24e40d63b00)
+++ uspace/lib/libc/Makefile.toolchain	(revision 6ab8697dc506650b8712d1dc5e817cc473bf170a)
@@ -27,9 +27,23 @@
 #
 
-CFLAGS = -I$(LIBC_PREFIX)/include -O3 -imacros $(LIBC_PREFIX)/../../../config.h \
+GCC_CFLAGS = -I$(LIBC_PREFIX)/include -O3 -imacros $(LIBC_PREFIX)/../../../config.h \
 	-fexec-charset=UTF-8 -fwide-exec-charset=UTF-32$(ENDIANESS) \
-	-finput-charset=UTF-8 -fno-builtin -Wall -Wextra -Wno-unused-parameter \
-	-Wmissing-prototypes -Werror-implicit-function-declaration -nostdlib \
-	-nostdinc -pipe -g -D__$(ENDIANESS)__
+	-finput-charset=UTF-8 -ffreestanding -fno-builtin -nostdlib -nostdinc \
+	-Wall -Wextra -Wno-unused-parameter -Wmissing-prototypes \
+	-Werror-implicit-function-declaration -pipe -g -D__$(ENDIANESS)__
+
+ICC_CFLAGS = -I$(LIBC_PREFIX)/include -O3 -imacros $(LIBC_PREFIX)/../../../config.h \
+	-fexec-charset=UTF-8 -fwide-exec-charset=UTF-32$(ENDIANESS) \
+	-finput-charset=UTF-8 -ffreestanding -fno-builtin -nostdlib -nostdinc \
+	-Wall -Wextra -Wno-unused-parameter -Wmissing-prototypes \
+	-Werror-implicit-function-declaration -pipe -g -D__$(ENDIANESS)__
+
+CLANG_CFLAGS = -I$(LIBC_PREFIX)/include -O3 -imacros $(LIBC_PREFIX)/../../../config.h \
+	-fexec-charset=UTF-8 -fwide-exec-charset=UTF-32$(ENDIANESS) \
+	-finput-charset=UTF-8 -ffreestanding -fno-builtin -nostdlib -nostdinc \
+	-Wall -Wextra -Wno-unused-parameter -Wmissing-prototypes \
+	-Werror-implicit-function-declaration -pipe -g -arch $(CLANG_ARCH) \
+	-D__$(ENDIANESS)__
+
 LFLAGS = -M -N $(SOFTINT_PREFIX)/libsoftint.a
 AFLAGS =
@@ -72,4 +86,5 @@
 	OBJCOPY = $(TOOLCHAIN_DIR)/$(TARGET)-objcopy
 	OBJDUMP = $(TOOLCHAIN_DIR)/$(TARGET)-objdump
+	CFLAGS = $(GCC_CFLAGS)
 	DEPEND_DEFS = $(DEFS) $(CONFIG_DEFS)
 endif
@@ -83,4 +98,5 @@
 	OBJCOPY = $(BINUTILS_PREFIX)objcopy
 	OBJDUMP = $(BINUTILS_PREFIX)objdump
+	CFLAGS = $(GCC_CFLAGS)
 	DEPEND_DEFS = $(DEFS) $(CONFIG_DEFS)
 endif
@@ -94,4 +110,5 @@
 	OBJCOPY = objcopy
 	OBJDUMP = objdump
+	CFLAGS = $(ICC_CFLAGS)
 	DEPEND_DEFS = $(DEFS) $(CONFIG_DEFS)
 endif
@@ -105,4 +122,5 @@
 	OBJCOPY = $(BINUTILS_PREFIX)objcopy
 	OBJDUMP = $(BINUTILS_PREFIX)objdump
+	CFLAGS = $(CLANG_CFLAGS)
 	DEPEND_DEFS = $(DEFS) $(CONFIG_DEFS)
 endif
Index: uspace/lib/libc/arch/amd64/Makefile.inc
===================================================================
--- uspace/lib/libc/arch/amd64/Makefile.inc	(revision f563126931ea083d74828e89fd20f24e40d63b00)
+++ uspace/lib/libc/arch/amd64/Makefile.inc	(revision 6ab8697dc506650b8712d1dc5e817cc473bf170a)
@@ -31,4 +31,5 @@
 
 TARGET = amd64-linux-gnu
+CLANG_ARCH = x86_64
 TOOLCHAIN_DIR = $(CROSS_PREFIX)/amd64/bin
 
Index: uspace/lib/libc/arch/arm32/Makefile.inc
===================================================================
--- uspace/lib/libc/arch/arm32/Makefile.inc	(revision f563126931ea083d74828e89fd20f24e40d63b00)
+++ uspace/lib/libc/arch/arm32/Makefile.inc	(revision 6ab8697dc506650b8712d1dc5e817cc473bf170a)
@@ -39,5 +39,5 @@
 	arch/$(UARCH)/src/eabi.S
 
-CFLAGS += -ffixed-r9 -mtp=soft
+GCC_CFLAGS += -ffixed-r9 -mtp=soft
 LFLAGS += -N $(SOFTINT_PREFIX)/libsoftint.a
 
Index: uspace/lib/libc/arch/ia32/Makefile.inc
===================================================================
--- uspace/lib/libc/arch/ia32/Makefile.inc	(revision f563126931ea083d74828e89fd20f24e40d63b00)
+++ uspace/lib/libc/arch/ia32/Makefile.inc	(revision 6ab8697dc506650b8712d1dc5e817cc473bf170a)
@@ -31,4 +31,5 @@
 
 TARGET = i686-pc-linux-gnu
+CLANG_ARCH = i386
 TOOLCHAIN_DIR = $(CROSS_PREFIX)/ia32/bin
 
Index: uspace/lib/libc/arch/ia32/include/stackarg.h
===================================================================
--- uspace/lib/libc/arch/ia32/include/stackarg.h	(revision f563126931ea083d74828e89fd20f24e40d63b00)
+++ 	(revision )
@@ -1,66 +1,0 @@
-/*
- * Copyright (c) 2005 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libcia32
- * @{
- */
-/** @file
- */
-
-/*
- * Variable argument list manipulation macros
- * for architectures using stack to pass arguments.
- */
- 
-#ifndef LIBC_ia32_STACKARG_H_
-#define LIBC_ia32_STACKARG_H_
-
-#include <sys/types.h>
-
-/* dont allow to define it second time in stdarg.h */
-#define __VARARGS_DEFINED
-
-typedef struct va_list {
-	int pos;
-	uint8_t *last;
-} va_list;
-
-#define va_start(ap, lst) \
-	(ap).pos = sizeof(lst); 			\
-	(ap).last = (uint8_t *) &(lst)
-
-#define va_arg(ap, type) 		\
-	(*((type *)((ap).last + ((ap).pos  += sizeof(type) ) - sizeof(type))))
-
-#define va_end(ap)
-
-
-#endif
-
-/** @}
- */
Index: uspace/lib/libc/arch/ia64/Makefile.inc
===================================================================
--- uspace/lib/libc/arch/ia64/Makefile.inc	(revision f563126931ea083d74828e89fd20f24e40d63b00)
+++ uspace/lib/libc/arch/ia64/Makefile.inc	(revision 6ab8697dc506650b8712d1dc5e817cc473bf170a)
@@ -38,5 +38,5 @@
 	arch/$(UARCH)/src/ddi.c
 
-CFLAGS += -fno-unwind-tables
+GCC_CFLAGS += -fno-unwind-tables
 LFLAGS += -N $(SOFTINT_PREFIX)/libsoftint.a
 
Index: uspace/lib/libc/arch/mips32/Makefile.inc
===================================================================
--- uspace/lib/libc/arch/mips32/Makefile.inc	(revision f563126931ea083d74828e89fd20f24e40d63b00)
+++ uspace/lib/libc/arch/mips32/Makefile.inc	(revision 6ab8697dc506650b8712d1dc5e817cc473bf170a)
@@ -37,5 +37,5 @@
 	arch/$(UARCH)/src/tls.c
 
-CFLAGS += -mips3
+GCC_CFLAGS += -mips3
 
 ENDIANESS = LE
Index: uspace/lib/libc/arch/mips32/include/stackarg.h
===================================================================
--- uspace/lib/libc/arch/mips32/include/stackarg.h	(revision f563126931ea083d74828e89fd20f24e40d63b00)
+++ 	(revision )
@@ -1,62 +1,0 @@
-/*
- * Copyright (c) 2006 Josef Cejka
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libcmips32	
- * @{
- */
-/** @file
- * @ingroup libcmips32eb	
- */
-
-#ifndef LIBC_mips32_STACKARG_H_
-#define LIBC_mips32_STACKARG_H_
-
-/* dont allow to define it second time in stdarg.h */
-#define __VARARGS_DEFINED
-
-#include <sys/types.h>
-
-/**
- * va_arg macro for MIPS32 - problem is that 64 bit values must be aligned on an 8-byte boundary (32bit values not)
- * To satisfy this, paddings must be sometimes inserted. 
- */
-
-typedef uint8_t* va_list;
-
-#define va_start(ap, lst) \
-	((ap) = (va_list)&(lst) + sizeof(lst))
-
-#define va_arg(ap, type)	\
-	(((type *)((ap) = (va_list)( (sizeof(type) <= 4) ? ((uint32_t)((ap) + 2*4 - 1) & (~3)) : ((uint32_t)((ap) + 2*8 -1) & (~7)) )))[-1])
-
-#define va_end(ap)
-
-#endif
-
-/** @}
- */
Index: uspace/lib/libc/arch/mips32eb/Makefile.inc
===================================================================
--- uspace/lib/libc/arch/mips32eb/Makefile.inc	(revision f563126931ea083d74828e89fd20f24e40d63b00)
+++ uspace/lib/libc/arch/mips32eb/Makefile.inc	(revision 6ab8697dc506650b8712d1dc5e817cc473bf170a)
@@ -34,8 +34,8 @@
 
 ARCH_SOURCES += arch/$(UARCH)/src/syscall.c \
-		arch/$(UARCH)/src/fibril.S \
-		arch/$(UARCH)/src/tls.c
+	arch/$(UARCH)/src/fibril.S \
+	arch/$(UARCH)/src/tls.c
 
-CFLAGS += -mips3
+GCC_CFLAGS += -mips3
 LFLAGS += -N
 
Index: uspace/lib/libc/arch/mips32eb/include/stackarg.h
===================================================================
--- uspace/lib/libc/arch/mips32eb/include/stackarg.h	(revision f563126931ea083d74828e89fd20f24e40d63b00)
+++ 	(revision )
@@ -1,1 +1,0 @@
-../../mips32/include/stackarg.h
Index: uspace/lib/libc/arch/ppc32/Makefile.inc
===================================================================
--- uspace/lib/libc/arch/ppc32/Makefile.inc	(revision f563126931ea083d74828e89fd20f24e40d63b00)
+++ uspace/lib/libc/arch/ppc32/Makefile.inc	(revision 6ab8697dc506650b8712d1dc5e817cc473bf170a)
@@ -37,5 +37,5 @@
 	arch/$(UARCH)/src/tls.c
 
-CFLAGS += -mcpu=powerpc -msoft-float -m32
+GCC_CFLAGS += -mcpu=powerpc -msoft-float -m32
 AFLAGS += -a32
 LFLAGS += -N
Index: uspace/lib/libc/arch/sparc64/Makefile.inc
===================================================================
--- uspace/lib/libc/arch/sparc64/Makefile.inc	(revision f563126931ea083d74828e89fd20f24e40d63b00)
+++ uspace/lib/libc/arch/sparc64/Makefile.inc	(revision 6ab8697dc506650b8712d1dc5e817cc473bf170a)
@@ -36,5 +36,5 @@
 	arch/$(UARCH)/src/tls.c
 
-CFLAGS += -mcpu=ultrasparc -m64
+GCC_CFLAGS += -mcpu=ultrasparc -m64
 LFLAGS += -no-check-sections -N
 
Index: uspace/lib/libc/include/stdarg.h
===================================================================
--- uspace/lib/libc/include/stdarg.h	(revision f563126931ea083d74828e89fd20f24e40d63b00)
+++ uspace/lib/libc/include/stdarg.h	(revision 6ab8697dc506650b8712d1dc5e817cc473bf170a)
@@ -37,16 +37,10 @@
 
 #include <sys/types.h>
-#include <libarch/stackarg.h>
-
-#ifndef __VARARGS_DEFINED
-# define __VARARGS_DEFINED
 
 typedef __builtin_va_list va_list;
 
-# define va_start(ap, last) 		__builtin_va_start(ap, last)
-# define va_arg(ap, type) 		__builtin_va_arg(ap, type)
-# define va_end(ap)			__builtin_va_end(ap)
-
-# endif
+#define va_start(ap, last)  __builtin_va_start(ap, last)
+#define va_arg(ap, type)    __builtin_va_arg(ap, type)
+#define va_end(ap)          __builtin_va_end(ap)
 
 #endif
