Index: uspace/Makefile.common
===================================================================
--- uspace/Makefile.common	(revision c188c62aa2ffa4dc0f6451547f7cdb1966d6eb8d)
+++ uspace/Makefile.common	(revision 81b9d3ed6af6996e5039aa44755f6f7a9b396e2f)
@@ -160,6 +160,13 @@
 LIBNETTL_PREFIX = $(LIB_PREFIX)/nettl
 
-AFLAGS = --fatal-warnings
+AFLAGS =
 LFLAGS = --fatal-warnings
+
+# FIXME: This condition is a workaround for issues #692 and #693.
+ifneq ($(KARCH),ia64)
+ifneq ($(KARCH),mips32)
+	AFLAGS += --fatal-warnings
+endif
+endif
 
 ifeq ($(STATIC_NEEDED),y)
@@ -203,10 +210,4 @@
 endif
 
-ifeq ($(CONFIG_OPTIMIZE_FOR_SIZE),y)
-	OPTIMIZATION = s
-else
-	OPTIMIZATION = 3
-endif
-
 # PCUT-based unit tests
 ifneq ($(TEST_SOURCES),)
@@ -234,33 +235,26 @@
 	find . -name '*.lo' -follow -exec rm \{\} \;
 
-GCC_CFLAGS = $(INCLUDES_FLAGS) -O$(OPTIMIZATION) -imacros $(CONFIG_HEADER) \
-	-fexec-charset=UTF-8 -fwide-exec-charset=UTF-32$(ENDIANESS) \
-	-finput-charset=UTF-8 -ffreestanding -fno-builtin -ffunction-sections \
-	-nostdlib -nostdinc -Wall -Wextra -Wno-clobbered -Wno-unused-parameter \
-	-Wmissing-prototypes -std=gnu99 -Werror-implicit-function-declaration \
-	-Wwrite-strings -pipe -ggdb -D__$(ENDIANESS)__
-
-ICC_CFLAGS = $(INCLUDES_FLAGS) -O$(OPTIMIZATION) -imacros $(CONFIG_HEADER) \
-	-fexec-charset=UTF-8 -fwide-exec-charset=UTF-32$(ENDIANESS) \
-	-finput-charset=UTF-8 -ffreestanding -fno-builtin -nostdlib -nostdinc \
-	-Wall -Wextra -Wno-clobbered -Wno-unused-parameter -Wmissing-prototypes \
-	-Werror-implicit-function-declaration -Wwrite-strings \
-	-pipe -g -D__$(ENDIANESS)__
-
-# clang does not support following options but I am not sure whether
-# something won't break because of that:
-# -fexec-charset=UTF-8 -fwide-exec-charset=UTF-32$(ENDIANESS) -finput-charset=UTF-8
-CLANG_CFLAGS = $(INCLUDES_FLAGS) -O$(OPTIMIZATION) -imacros $(CONFIG_HEADER) \
-	-ffreestanding -fno-builtin -nostdlib -nostdinc \
-	-Wall -Wextra -Wno-unused-parameter -Wmissing-prototypes \
+COMMON_CFLAGS = $(INCLUDES_FLAGS) -O$(OPTIMIZATION) -imacros $(CONFIG_HEADER) \
+	-ffreestanding -fno-builtin -nostdlib -nostdinc -fexec-charset=UTF-8 \
+	-finput-charset=UTF-8 -D__$(ENDIANESS)__
+
+GCC_CFLAGS = -ffunction-sections -Wall -Wextra -Wno-clobbered \
+	-Wno-unused-parameter -Wmissing-prototypes -std=gnu99 \
+	-Werror-implicit-function-declaration \
+	-Wwrite-strings -pipe
+
+ICC_CFLAGS = -Wall -Wextra -Wno-clobbered -Wno-unused-parameter \
+	-Wmissing-prototypes -Werror-implicit-function-declaration \
+	-Wwrite-strings -pipe
+
+# -Wno-missing-prototypes is there because it warns about main().
+# This should be fixed elsewhere.
+CLANG_CFLAGS = -Wall -Wextra -Wno-unused-parameter -Wno-missing-field-initializers -Wno-typedef-redefinition \
+	-Wno-missing-prototypes -Wno-unused-command-line-argument \
 	-std=gnu99 -Werror-implicit-function-declaration -Wwrite-strings \
-	-integrated-as -pipe -g -target $(CLANG_TARGET) -D__$(ENDIANESS)__
-
-LIB_CFLAGS = $(CFLAGS) -fPIC
-LIB_LFLAGS = $(LFLAGS) -shared -soname $(LSONAME) --whole-archive
+	-pipe -fno-stack-protector -fno-PIC
 
 ifeq ($(CONFIG_DEBUG),y)
-	GCC_CFLAGS += -Werror
-	ICC_CFLAGS += -Werror
+	COMMON_CFLAGS += -Werror
 endif
 
@@ -273,5 +267,5 @@
 # Prepare for POSIX before including platform specific stuff
 ifeq ($(POSIX_COMPAT),y)
-	CFLAGS = -I$(LIBPOSIX_PREFIX)/include/posix -I$(LIBPOSIX_PREFIX)/include/
+	CFLAGS += -I$(LIBPOSIX_PREFIX)/include/posix -I$(LIBPOSIX_PREFIX)/include/
 	BASE_LIBS = $(LIBPOSIX_PREFIX)/libposixaslibc.a $(LIBPOSIX_PREFIX)/libc4posix.a $(LIBSOFTINT_PREFIX)/libsoftint.a
 endif
@@ -288,31 +282,37 @@
 
 ifeq ($(COMPILER),gcc_cross)
-	CFLAGS += $(GCC_CFLAGS)
+	CFLAGS += $(COMMON_CFLAGS) $(GCC_CFLAGS)
 	DEPEND_DEFS = $(DEFS) $(CONFIG_DEFS)
 endif
 
 ifeq ($(COMPILER),gcc_helenos)
-	CFLAGS += $(GCC_CFLAGS)
+	CFLAGS += $(COMMON_CFLAGS) $(GCC_CFLAGS)
 	DEPEND_DEFS = $(DEFS) $(CONFIG_DEFS)
 endif
 
 ifeq ($(COMPILER),gcc_native)
-	CFLAGS += $(GCC_CFLAGS)
+	CFLAGS += $(COMMON_CFLAGS) $(GCC_CFLAGS)
 	DEPEND_DEFS = $(DEFS) $(CONFIG_DEFS)
 endif
 
 ifeq ($(COMPILER),icc)
-	CFLAGS += $(ICC_CFLAGS)
+	CFLAGS += $(COMMON_CFLAGS) $(ICC_CFLAGS)
 	DEPEND_DEFS = $(DEFS) $(CONFIG_DEFS)
 endif
 
 ifeq ($(COMPILER),clang)
-	CFLAGS += $(CLANG_CFLAGS)
+	CFLAGS += $(COMMON_CFLAGS) $(CLANG_CFLAGS)
 	DEPEND_DEFS = $(DEFS) $(CONFIG_DEFS)
 endif
+
+LIB_CFLAGS = $(CFLAGS) -fPIC
+LIB_LFLAGS = $(LFLAGS) -shared -soname $(LSONAME) --whole-archive
 
 ifneq ($(MAKECMDGOALS),clean)
 -include $(DEPEND)
 endif
+
+AS_CFLAGS := $(addprefix -Xassembler ,$(AFLAGS))
+LD_CFLAGS := $(addprefix -Xlinker ,$(LFLAGS))
 
 OBJECTS := $(addsuffix .o,$(basename $(SOURCES)))
@@ -378,5 +378,5 @@
 
 %.o: %.S $(DEPEND)
-	$(GCC) $(DEFS) $(GCC_CFLAGS) $(EXTRA_CFLAGS) -D__ASM__ -c $< -o $@
+	$(CC) $(DEFS) $(CFLAGS) $(EXTRA_CFLAGS) $(AS_CFLAGS) -D__ASM__ -c $< -o $@
 ifeq ($(PRECHECK),y)
 	$(JOBFILE) $(JOB) $< $@ as asm/preproc $(DEFS) $(CFLAGS) $(EXTRA_CFLAGS) -D__ASM__
@@ -384,5 +384,5 @@
 
 %.o: %.s $(DEPEND)
-	$(AS) $(AFLAGS) -o $@ $<
+	$(CC) $(DEFS) $(CFLAGS) $(EXTRA_CFLAGS) $(AS_CFLAGS) -D__ASM__ -c $< -o $@
 ifeq ($(PRECHECK),y)
 	$(JOBFILE) $(JOB) $< $@ as asm
@@ -402,5 +402,5 @@
 
 %.lo: %.S $(DEPEND)
-	$(CC) $(DEFS) $(LIB_CFLAGS) $(EXTRA_CFLAGS) -D__ASM__ -c $< -o $@
+	$(CC) $(DEFS) $(LIB_CFLAGS) $(EXTRA_CFLAGS) $(AS_CFLAGS) -D__ASM__ -c $< -o $@
 ifeq ($(PRECHECK),y)
 	$(JOBFILE) $(JOB) $< $@ as asm/preproc $(DEFS) $(LIB_CFLAGS) $(EXTRA_CFLAGS) -D__ASM__
@@ -408,5 +408,5 @@
 
 %.lo: %.s $(DEPEND)
-	$(AS) $(AFLAGS) -o $@ $<
+	$(CC) $(DEFS) $(LIB_CFLAGS) $(EXTRA_CFLAGS) $(AS_CFLAGS) -D__ASM__ -c $< -o $@
 ifeq ($(PRECHECK),y)
 	$(JOBFILE) $(JOB) $< $@ as asm
Index: uspace/app/bdsh/cmds/builtin_cmds.c
===================================================================
--- uspace/app/bdsh/cmds/builtin_cmds.c	(revision c188c62aa2ffa4dc0f6451547f7cdb1966d6eb8d)
+++ uspace/app/bdsh/cmds/builtin_cmds.c	(revision 81b9d3ed6af6996e5039aa44755f6f7a9b396e2f)
@@ -79,8 +79,7 @@
 		return (char *)NULL;
 
-	for(i=0; builtin_aliases[i] != NULL; i++) {
+	for(i=0; builtin_aliases[i] != NULL; i+=2) {
 		if (!str_cmp(builtin_aliases[i], command))
-			return (char *)builtin_aliases[++i];
-		i++;
+			return (char *)builtin_aliases[i+1];
 	}
 
Index: uspace/app/bdsh/cmds/mod_cmds.c
===================================================================
--- uspace/app/bdsh/cmds/mod_cmds.c	(revision c188c62aa2ffa4dc0f6451547f7cdb1966d6eb8d)
+++ uspace/app/bdsh/cmds/mod_cmds.c	(revision 81b9d3ed6af6996e5039aa44755f6f7a9b396e2f)
@@ -96,8 +96,7 @@
 		return (char *)NULL;
 
-	for(i=0; mod_aliases[i] != NULL; i++) {
+	for(i=0; mod_aliases[i] != NULL; i+=2) {
 		if (!str_cmp(mod_aliases[i], command))
-			return (char *)mod_aliases[++i];
-		i++;
+			return (char *)mod_aliases[i+1];
 	}
 
Index: uspace/app/fontviewer/fontviewer.c
===================================================================
--- uspace/app/fontviewer/fontviewer.c	(revision c188c62aa2ffa4dc0f6451547f7cdb1966d6eb8d)
+++ uspace/app/fontviewer/fontviewer.c	(revision 81b9d3ed6af6996e5039aa44755f6f7a9b396e2f)
@@ -78,5 +78,5 @@
 				points += increment;
 		
-			if ((event->key == KC_DOWN)) {
+			if (event->key == KC_DOWN) {
 				if (points <= increment) {
 					points = 1;
Index: uspace/app/nic/nic.c
===================================================================
--- uspace/app/nic/nic.c	(revision c188c62aa2ffa4dc0f6451547f7cdb1966d6eb8d)
+++ uspace/app/nic/nic.c	(revision 81b9d3ed6af6996e5039aa44755f6f7a9b396e2f)
@@ -120,4 +120,5 @@
 	if (sess == NULL) {
 		printf("Error connecting to service.\n");
+		rc = EIO;
 		goto error;
 	}
@@ -209,5 +210,5 @@
 }
 
-static const char *nic_multicast_mode_str(nic_unicast_mode_t mode)
+static const char *nic_multicast_mode_str(nic_multicast_mode_t mode)
 {
 	switch (mode) {
@@ -220,5 +221,5 @@
 }
 
-static const char *nic_broadcast_mode_str(nic_unicast_mode_t mode)
+static const char *nic_broadcast_mode_str(nic_broadcast_mode_t mode)
 {
 	switch (mode) {
Index: uspace/app/sbi/src/builtin/bi_task.c
===================================================================
--- uspace/app/sbi/src/builtin/bi_task.c	(revision c188c62aa2ffa4dc0f6451547f7cdb1966d6eb8d)
+++ uspace/app/sbi/src/builtin/bi_task.c	(revision 81b9d3ed6af6996e5039aa44755f6f7a9b396e2f)
@@ -114,5 +114,5 @@
 	}
 
-	cmd[dim] = '\0';
+	cmd[dim] = NULL;
 
 	if (os_exec((char * const *)cmd) != EOK) {
Index: uspace/app/sbi/src/run_expr.c
===================================================================
--- uspace/app/sbi/src/run_expr.c	(revision c188c62aa2ffa4dc0f6451547f7cdb1966d6eb8d)
+++ uspace/app/sbi/src/run_expr.c	(revision 81b9d3ed6af6996e5039aa44755f6f7a9b396e2f)
@@ -2886,5 +2886,5 @@
 				/* Is it static/nonstatic? */
 				var_sn = stree_symbol_has_attr(
-				    var_to_symbol(var), sac_static);
+				    var_to_symbol(var), sac_static) ? sn_static : sn_nonstatic;
 				if (var_sn == sn) {
 					/* Compute field type. XXX Memoize. */
Index: uspace/app/tetris/tetris.c
===================================================================
--- uspace/app/tetris/tetris.c	(revision c188c62aa2ffa4dc0f6451547f7cdb1966d6eb8d)
+++ uspace/app/tetris/tetris.c	(revision 81b9d3ed6af6996e5039aa44755f6f7a9b396e2f)
@@ -443,4 +443,5 @@
 void usage(void)
 {
+	fprintf(stderr, "%s", copyright);
 	fprintf(stderr, "usage: tetris [-ps] [-k keys]\n");
 	exit(1);
Index: uspace/drv/audio/sb16/dsp.c
===================================================================
--- uspace/drv/audio/sb16/dsp.c	(revision c188c62aa2ffa4dc0f6451547f7cdb1966d6eb8d)
+++ uspace/drv/audio/sb16/dsp.c	(revision 81b9d3ed6af6996e5039aa44755f6f7a9b396e2f)
@@ -75,5 +75,5 @@
 		[DSP_NO_BUFFER] = "NO BUFFER",
 	};
-	if (state < ARRAY_SIZE(state_names))
+	if ((size_t)state < ARRAY_SIZE(state_names))
 		return state_names[state];
 	return "UNKNOWN";
@@ -144,7 +144,9 @@
 {
 	dsp_write(dsp, SET_SAMPLING_RATE_OUTPUT);
-	dsp_write(dsp, rate >> 8);
-	dsp_write(dsp, rate & 0xff);
-	ddf_log_verbose("Sampling rate: %hhx:%hhx.", rate >> 8, rate & 0xff);
+	uint8_t rate_lo = rate & 0xff;
+	uint8_t rate_hi = rate >> 8;
+	dsp_write(dsp, rate_hi);
+	dsp_write(dsp, rate_lo);
+	ddf_log_verbose("Sampling rate: %hhx:%hhx.", rate_hi, rate_lo);
 }
 
@@ -202,9 +204,4 @@
 	
 	return ret;
-}
-
-static inline size_t sample_count(pcm_sample_format_t format, size_t byte_count)
-{
-	return byte_count / pcm_sample_format_size(format);
 }
 
Index: uspace/drv/bus/isa/i8237.c
===================================================================
--- uspace/drv/bus/isa/i8237.c	(revision c188c62aa2ffa4dc0f6451547f7cdb1966d6eb8d)
+++ uspace/drv/bus/isa/i8237.c	(revision 81b9d3ed6af6996e5039aa44755f6f7a9b396e2f)
@@ -371,5 +371,5 @@
 	
 	/* 16 bit transfers are a bit special */
-	ddf_msg(LVL_DEBUG, "Unspoiled address %#" PRIx32 " (size %" PRIu16 ")",
+	ddf_msg(LVL_DEBUG, "Unspoiled address %#" PRIx32 " (size %" PRIu32 ")",
 	    pa, size);
 	if (is_dma16(channel)) {
@@ -388,5 +388,5 @@
 	
 	ddf_msg(LVL_DEBUG, "Setting channel %u to address %#" PRIx32 " "
-	    "(size %" PRIu16 "), mode %hhx.", channel, pa, size, mode);
+	    "(size %" PRIu32 "), mode %hhx.", channel, pa, size, mode);
 	
 	/* Mask DMA request */
Index: uspace/drv/bus/usb/ohci/hw_struct/transfer_descriptor.c
===================================================================
--- uspace/drv/bus/usb/ohci/hw_struct/transfer_descriptor.c	(revision c188c62aa2ffa4dc0f6451547f7cdb1966d6eb8d)
+++ uspace/drv/bus/usb/ohci/hw_struct/transfer_descriptor.c	(revision 81b9d3ed6af6996e5039aa44755f6f7a9b396e2f)
@@ -78,5 +78,5 @@
 
 	/* Allow less data on input. */
-	if (dir == USB_DIRECTION_IN) {
+	if (direction == USB_DIRECTION_IN) {
 		OHCI_MEM32_SET(instance->status, TD_STATUS_ROUND_FLAG);
 	}
Index: uspace/drv/bus/usb/ohci/ohci_rh.c
===================================================================
--- uspace/drv/bus/usb/ohci/ohci_rh.c	(revision c188c62aa2ffa4dc0f6451547f7cdb1966d6eb8d)
+++ uspace/drv/bus/usb/ohci/ohci_rh.c	(revision 81b9d3ed6af6996e5039aa44755f6f7a9b396e2f)
@@ -367,5 +367,5 @@
 	case USB_HUB_FEATURE_C_PORT_RESET:        /*20*/
 		usb_log_debug2("Clearing port C_CONNECTION, C_ENABLE, "
-		    "C_SUSPEND, C_OC or C_RESET on port %"PRIu16".\n", port);
+		    "C_SUSPEND, C_OC or C_RESET on port %u.\n", port);
 		/* Bit offsets correspond to the feature number */
 		OHCI_WR(hub->registers->rh_port_status[port],
@@ -416,5 +416,5 @@
 	case USB_HUB_FEATURE_PORT_RESET:   /*4*/
 		usb_log_debug2("Setting port POWER, ENABLE, SUSPEND or RESET "
-		    "on port %"PRIu16".\n", port);
+		    "on port %u.\n", port);
 		/* Bit offsets correspond to the feature number */
 		OHCI_WR(hub->registers->rh_port_status[port], 1 << feature);
Index: uspace/drv/fb/amdm37x_dispc/amdm37x_dispc.c
===================================================================
--- uspace/drv/fb/amdm37x_dispc/amdm37x_dispc.c	(revision c188c62aa2ffa4dc0f6451547f7cdb1966d6eb8d)
+++ uspace/drv/fb/amdm37x_dispc/amdm37x_dispc.c	(revision 81b9d3ed6af6996e5039aa44755f6f7a9b396e2f)
@@ -267,5 +267,5 @@
 	amdm37x_dispc_t *dispc = vis->dev_ctx;
 	const visual_t visual = mode.cell_visual.pixel_visual;
-	assert(visual < sizeof(pixel2visual_table) / sizeof(pixel2visual_table[0]));
+	assert((size_t)visual < sizeof(pixel2visual_table) / sizeof(pixel2visual_table[0]));
 	const unsigned bpp = pixel2visual_table[visual].bpp;
 	pixel2visual_t p2v = pixel2visual_table[visual].func;
Index: uspace/drv/fb/kfb/port.c
===================================================================
--- uspace/drv/fb/kfb/port.c	(revision c188c62aa2ffa4dc0f6451547f7cdb1966d6eb8d)
+++ uspace/drv/fb/kfb/port.c	(revision 81b9d3ed6af6996e5039aa44755f6f7a9b396e2f)
@@ -66,4 +66,5 @@
 
 typedef struct {
+	sysarg_t paddr;
 	sysarg_t width;
 	sysarg_t height;
@@ -85,71 +86,24 @@
 static vslmode_list_element_t pixel_mode;
 
-static pixel_t color_table[16] = {
-	[COLOR_BLACK]       = 0x000000,
-	[COLOR_BLUE]        = 0x0000f0,
-	[COLOR_GREEN]       = 0x00f000,
-	[COLOR_CYAN]        = 0x00f0f0,
-	[COLOR_RED]         = 0xf00000,
-	[COLOR_MAGENTA]     = 0xf000f0,
-	[COLOR_YELLOW]      = 0xf0f000,
-	[COLOR_WHITE]       = 0xf0f0f0,
-
-	[COLOR_BLACK + 8]   = 0x000000,
-	[COLOR_BLUE + 8]    = 0x0000ff,
-	[COLOR_GREEN + 8]   = 0x00ff00,
-	[COLOR_CYAN + 8]    = 0x00ffff,
-	[COLOR_RED + 8]     = 0xff0000,
-	[COLOR_MAGENTA + 8] = 0xff00ff,
-	[COLOR_YELLOW + 8]  = 0xffff00,
-	[COLOR_WHITE + 8]   = 0xffffff,
-};
-
-static inline void attrs_rgb(char_attrs_t attrs, pixel_t *bgcolor, pixel_t *fgcolor)
-{
-	switch (attrs.type) {
-	case CHAR_ATTR_STYLE:
-		switch (attrs.val.style) {
-		case STYLE_NORMAL:
-			*bgcolor = color_table[COLOR_WHITE];
-			*fgcolor = color_table[COLOR_BLACK];
-			break;
-		case STYLE_EMPHASIS:
-			*bgcolor = color_table[COLOR_WHITE];
-			*fgcolor = color_table[COLOR_RED];
-			break;
-		case STYLE_INVERTED:
-			*bgcolor = color_table[COLOR_BLACK];
-			*fgcolor = color_table[COLOR_WHITE];
-			break;
-		case STYLE_SELECTED:
-			*bgcolor = color_table[COLOR_RED];
-			*fgcolor = color_table[COLOR_WHITE];
-			break;
-		}
-		break;
-	case CHAR_ATTR_INDEX:
-		*bgcolor = color_table[(attrs.val.index.bgcolor & 7) |
-		    ((attrs.val.index.attr & CATTR_BRIGHT) ? 8 : 0)];
-		*fgcolor = color_table[(attrs.val.index.fgcolor & 7) |
-		    ((attrs.val.index.attr & CATTR_BRIGHT) ? 8 : 0)];
-		break;
-	case CHAR_ATTR_RGB:
-		*bgcolor = attrs.val.rgb.bgcolor;
-		*fgcolor = attrs.val.rgb.fgcolor;
-		break;
-	}
-}
-
 static int kfb_claim(visualizer_t *vs)
 {
-	return EOK;
+	return physmem_map(kfb.paddr + kfb.offset,
+	    ALIGN_UP(kfb.size, PAGE_SIZE) >> PAGE_WIDTH,
+	    AS_AREA_READ | AS_AREA_WRITE, (void *) &kfb.addr);
 }
 
 static int kfb_yield(visualizer_t *vs)
 {
+	int rc;
+
 	if (vs->mode_set) {
 		vs->ops.handle_damage = NULL;
 	}
 
+	rc = physmem_unmap(kfb.addr);
+	if (rc != EOK)
+		return rc;
+
+	kfb.addr = NULL;
 	return EOK;
 }
@@ -211,7 +165,14 @@
 {
 	visualizer_t *vsl;
+	int rc;
 
 	vsl = (visualizer_t *) ddf_fun_data_get((ddf_fun_t *)arg);
 	graph_visualizer_connection(vsl, iid, icall, NULL);
+
+	if (kfb.addr != NULL) {
+		rc = physmem_unmap(kfb.addr);
+		if (rc == EOK)
+			kfb.addr = NULL;
+	}
 }
 
@@ -266,4 +227,5 @@
 	kfb.width = width;
 	kfb.height = height;
+	kfb.paddr = paddr;
 	kfb.offset = offset;
 	kfb.scanline = scanline;
@@ -343,10 +305,4 @@
 	kfb.size = scanline * height;
 	kfb.addr = AS_AREA_ANY;
-	
-	rc = physmem_map(paddr + offset,
-	    ALIGN_UP(kfb.size, PAGE_SIZE) >> PAGE_WIDTH,
-	    AS_AREA_READ | AS_AREA_WRITE, (void *) &kfb.addr);
-	if (rc != EOK)
-		return rc;
 	
 	ddf_fun_t *fun_vs = ddf_fun_create(dev, fun_exposed, "vsl0");
Index: uspace/drv/nic/e1k/e1k.c
===================================================================
--- uspace/drv/nic/e1k/e1k.c	(revision c188c62aa2ffa4dc0f6451547f7cdb1966d6eb8d)
+++ uspace/drv/nic/e1k/e1k.c	(revision 81b9d3ed6af6996e5039aa44755f6f7a9b396e2f)
@@ -365,13 +365,16 @@
 	if (ctrl & CTRL_SLU) {
 		ctrl &= ~(CTRL_SLU);
+		E1000_REG_WRITE(e1000, E1000_CTRL, ctrl);
 		fibril_mutex_unlock(&e1000->ctrl_lock);
+		
 		thread_usleep(10);
+		
 		fibril_mutex_lock(&e1000->ctrl_lock);
+		ctrl = E1000_REG_READ(e1000, E1000_CTRL);
 		ctrl |= CTRL_SLU;
+		E1000_REG_WRITE(e1000, E1000_CTRL, ctrl);
 	}
 	
 	fibril_mutex_unlock(&e1000->ctrl_lock);
-	
-	e1000_link_restart(e1000);
 }
 
Index: uspace/drv/nic/rtl8139/driver.c
===================================================================
--- uspace/drv/nic/rtl8139/driver.c	(revision c188c62aa2ffa4dc0f6451547f7cdb1966d6eb8d)
+++ uspace/drv/nic/rtl8139/driver.c	(revision 81b9d3ed6af6996e5039aa44755f6f7a9b396e2f)
@@ -125,17 +125,9 @@
 
 
-/** Disable interrupts on controller
+/** Set interrupts on controller
  *
  *  @param rtl8139  The card private structure
  */
-inline static void rtl8139_hw_int_disable(rtl8139_t *rtl8139)
-{
-	pio_write_16(rtl8139->io_port + IMR, 0x0);
-}
-/** Enable interrupts on controller
- *
- *  @param rtl8139  The card private structure
- */
-inline static void rtl8139_hw_int_enable(rtl8139_t *rtl8139)
+inline static void rtl8139_hw_int_set(rtl8139_t *rtl8139)
 {
 	pio_write_16(rtl8139->io_port + IMR, rtl8139->int_mask);
@@ -274,18 +266,4 @@
 }
 
-/**  Provide OR in the 32bit register (set selected bits to 1)
- *
- *   @param rtl8139     The rtl8139 structure
- *   @param reg_offset  Register offset in the device IO space
- *   @param bits_add    The value to or
- */
-inline static void rtl8139_hw_reg_add_32(rtl8139_t * rtl8139, size_t reg_offset,
-    uint32_t bits_add)
-{
-	uint32_t value = pio_read_32(rtl8139->io_port + reg_offset);
-	value |= bits_add;
-	pio_write_32(rtl8139->io_port + reg_offset, value);
-}
-
 /**  Unset selected bits in 8bit register
  *
@@ -301,19 +279,4 @@
 	pio_write_8(rtl8139->io_port + reg_offset, value);
 }
-
-/**  Unset selected bits in 32bit register
- *
- *   @param rtl8139     The rtl8139 structure
- *   @param reg_offset  Register offset in the device IO space
- *   @param bits_add    The mask of bits to remove
- */
-inline static void rtl8139_hw_reg_rem_32(rtl8139_t * rtl8139, size_t reg_offset,
-    uint32_t bits_add)
-{
-	uint32_t value = pio_read_32(rtl8139->io_port + reg_offset);
-	value &= ~bits_add;
-	pio_write_32(rtl8139->io_port + reg_offset, value);
-}
-
 
 static int rtl8139_set_addr(ddf_fun_t *fun, const nic_address_t *);
@@ -871,5 +834,5 @@
 
 	/* Turn the interrupts on again */
-	rtl8139_hw_int_enable(rtl8139);
+	rtl8139_hw_int_set(rtl8139);
 };
 
@@ -955,5 +918,5 @@
 
 	rtl8139->int_mask = RTL_DEFAULT_INTERRUPTS;
-	rtl8139_hw_int_enable(rtl8139);
+	rtl8139_hw_int_set(rtl8139);
 
 	int rc = irc_enable_interrupt(rtl8139->irq);
@@ -2120,5 +2083,5 @@
 		/* Disable timer interrupts while working with timer-related data */
 		rtl8139->int_mask = 0;
-		rtl8139_hw_int_enable(rtl8139);
+		rtl8139_hw_int_set(rtl8139);
 
 		rtl8139->poll_timer = new_timer;
@@ -2143,5 +2106,5 @@
 	}
 
-	rtl8139_hw_int_enable(rtl8139);
+	rtl8139_hw_int_set(rtl8139);
 
 	fibril_mutex_unlock(&rtl8139->rx_lock);
Index: uspace/lib/c/Makefile
===================================================================
--- uspace/lib/c/Makefile	(revision c188c62aa2ffa4dc0f6451547f7cdb1966d6eb8d)
+++ uspace/lib/c/Makefile	(revision 81b9d3ed6af6996e5039aa44755f6f7a9b396e2f)
@@ -194,5 +194,5 @@
 %.h: %.ag
 	$(AUTOGEN) probe $< >$<.probe.c
-	$(CC) $(DEFS) $(CFLAGS) -S -o $<.probe.s $<.probe.c
+	$(CC_AUTOGEN) $(DEFS) $(CFLAGS) -S -o $<.probe.s $<.probe.c
 	$(AUTOGEN) generate $< <$<.probe.s >$@   
 
Index: uspace/lib/c/arch/amd64/Makefile.common
===================================================================
--- uspace/lib/c/arch/amd64/Makefile.common	(revision c188c62aa2ffa4dc0f6451547f7cdb1966d6eb8d)
+++ uspace/lib/c/arch/amd64/Makefile.common	(revision 81b9d3ed6af6996e5039aa44755f6f7a9b396e2f)
@@ -27,6 +27,5 @@
 #
 
-GCC_CFLAGS += -mno-tls-direct-seg-refs -fno-omit-frame-pointer
-CLANG_CFLAGS += -fno-omit-frame-pointer
+COMMON_CFLAGS += -mno-tls-direct-seg-refs -fno-omit-frame-pointer
 LFLAGS += --gc-sections
 
Index: uspace/lib/c/arch/amd64/include/libarch/elf_linux.h
===================================================================
--- uspace/lib/c/arch/amd64/include/libarch/elf_linux.h	(revision c188c62aa2ffa4dc0f6451547f7cdb1966d6eb8d)
+++ uspace/lib/c/arch/amd64/include/libarch/elf_linux.h	(revision 81b9d3ed6af6996e5039aa44755f6f7a9b396e2f)
@@ -34,5 +34,5 @@
 
 #ifndef LIBC_amd64_ELF_LINUX_H_
-#define LBIC_amd64_ELF_LINUX_H_
+#define LIBC_amd64_ELF_LINUX_H_
 
 #include <libarch/istate.h>
Index: uspace/lib/c/arch/arm32/Makefile.common
===================================================================
--- uspace/lib/c/arch/arm32/Makefile.common	(revision c188c62aa2ffa4dc0f6451547f7cdb1966d6eb8d)
+++ uspace/lib/c/arch/arm32/Makefile.common	(revision 81b9d3ed6af6996e5039aa44755f6f7a9b396e2f)
@@ -28,5 +28,5 @@
 #
 
-GCC_CFLAGS += -ffixed-r9 -mtp=soft -fno-omit-frame-pointer -mapcs-frame \
+COMMON_CFLAGS += -ffixed-r9 -mtp=soft -fno-omit-frame-pointer -mapcs-frame \
 	-march=$(subst _,-,$(PROCESSOR_ARCH))
 
@@ -34,5 +34,5 @@
 
 ifeq ($(CONFIG_FPU),y)
-	GCC_CFLAGS += -mfloat-abi=hard
+	COMMON_CFLAGS += -mfloat-abi=hard
 else
 	BASE_LIBS += $(LIBSOFTFLOAT_PREFIX)/libsoftfloat.a
Index: uspace/lib/c/arch/ia32/Makefile.common
===================================================================
--- uspace/lib/c/arch/ia32/Makefile.common	(revision c188c62aa2ffa4dc0f6451547f7cdb1966d6eb8d)
+++ uspace/lib/c/arch/ia32/Makefile.common	(revision 81b9d3ed6af6996e5039aa44755f6f7a9b396e2f)
@@ -28,11 +28,10 @@
 
 ifeq ($(PROCESSOR),i486)
-	GCC_CFLAGS += -march=i486 
+	COMMON_CFLAGS += -march=i486
 else
-	GCC_CFLAGS += -march=pentium
+	COMMON_CFLAGS += -march=pentium
 endif
 
-GCC_CFLAGS += -mno-tls-direct-seg-refs -fno-omit-frame-pointer
-CLANG_CFLAGS += -fno-omit-frame-pointer
+COMMON_CFLAGS += -mno-tls-direct-seg-refs -fno-omit-frame-pointer
 LFLAGS += --gc-sections
 
Index: uspace/lib/c/arch/ia64/Makefile.common
===================================================================
--- uspace/lib/c/arch/ia64/Makefile.common	(revision c188c62aa2ffa4dc0f6451547f7cdb1966d6eb8d)
+++ uspace/lib/c/arch/ia64/Makefile.common	(revision 81b9d3ed6af6996e5039aa44755f6f7a9b396e2f)
@@ -27,5 +27,5 @@
 #
 
-GCC_CFLAGS += -fno-unwind-tables
+COMMON_CFLAGS += -fno-unwind-tables
 
 ENDIANESS = LE
Index: uspace/lib/c/arch/mips32/Makefile.common
===================================================================
--- uspace/lib/c/arch/mips32/Makefile.common	(revision c188c62aa2ffa4dc0f6451547f7cdb1966d6eb8d)
+++ uspace/lib/c/arch/mips32/Makefile.common	(revision 81b9d3ed6af6996e5039aa44755f6f7a9b396e2f)
@@ -27,5 +27,5 @@
 #
 
-GCC_CFLAGS += -msoft-float -mabi=32
+COMMON_CFLAGS += -msoft-float -mabi=32
 BASE_LIBS += $(LIBSOFTFLOAT_PREFIX)/libsoftfloat.a
 AS_PROLOG = .module softfloat;.abicalls;
@@ -38,9 +38,9 @@
 
 ifeq ($(MACHINE),msim)
-	GCC_CFLAGS += -march=r4000 
+	COMMON_CFLAGS += -march=r4000
 endif
 
 ifeq ($(MACHINE),lmalta)
-	GCC_CFLAGS += -march=4kc
+	COMMON_CFLAGS += -march=4kc
 endif
 
Index: uspace/lib/c/arch/mips32eb/Makefile.common
===================================================================
--- uspace/lib/c/arch/mips32eb/Makefile.common	(revision c188c62aa2ffa4dc0f6451547f7cdb1966d6eb8d)
+++ uspace/lib/c/arch/mips32eb/Makefile.common	(revision 81b9d3ed6af6996e5039aa44755f6f7a9b396e2f)
@@ -27,5 +27,5 @@
 #
 
-GCC_CFLAGS += -msoft-float -mabi=32
+COMMON_CFLAGS += -msoft-float -mabi=32
 BASE_LIBS += $(LIBSOFTFLOAT_PREFIX)/libsoftfloat.a
 AS_PROLOG = .module softfloat;.abicalls;
@@ -38,5 +38,5 @@
 
 ifeq ($(MACHINE),bmalta)
-	GCC_CFLAGS += -march=4kc
+	COMMON_CFLAGS += -march=4kc
 endif
 
Index: uspace/lib/c/arch/ppc32/Makefile.common
===================================================================
--- uspace/lib/c/arch/ppc32/Makefile.common	(revision c188c62aa2ffa4dc0f6451547f7cdb1966d6eb8d)
+++ uspace/lib/c/arch/ppc32/Makefile.common	(revision 81b9d3ed6af6996e5039aa44755f6f7a9b396e2f)
@@ -33,5 +33,5 @@
 endif
 
-GCC_CFLAGS += -mcpu=powerpc -m$(FLOATS)-float -m32
+COMMON_CFLAGS += -mcpu=powerpc -m$(FLOATS)-float -m32
 BASE_LIBS += $(LIBSOFTFLOAT_PREFIX)/libsoftfloat.a
 AFLAGS += -a32
Index: uspace/lib/c/arch/sparc64/Makefile.common
===================================================================
--- uspace/lib/c/arch/sparc64/Makefile.common	(revision c188c62aa2ffa4dc0f6451547f7cdb1966d6eb8d)
+++ uspace/lib/c/arch/sparc64/Makefile.common	(revision 81b9d3ed6af6996e5039aa44755f6f7a9b396e2f)
@@ -28,10 +28,10 @@
 
 ifeq ($(PROCESSOR),sun4v)
-GCC_CFLAGS += -mcpu=niagara -mno-vis
+COMMON_CFLAGS += -mcpu=niagara -mno-vis
 else
-GCC_CFLAGS += -mcpu=ultrasparc
+COMMON_CFLAGS += -mcpu=ultrasparc
 endif
 
-GCC_CFLAGS += -m64 -mcmodel=medlow
+COMMON_CFLAGS += -m64 -mcmodel=medlow
 
 LFLAGS += -no-check-sections --gc-sections
Index: uspace/lib/c/generic/cap.c
===================================================================
--- uspace/lib/c/generic/cap.c	(revision c188c62aa2ffa4dc0f6451547f7cdb1966d6eb8d)
+++ uspace/lib/c/generic/cap.c	(revision 81b9d3ed6af6996e5039aa44755f6f7a9b396e2f)
@@ -185,6 +185,5 @@
 	sunit = NULL;
 
-	if (cap->cunit < 0 || cap->cunit >= CU_LIMIT)
-		assert(false);
+	assert(cap->cunit < CU_LIMIT);
 
 	rc = ipow10_u64(cap->dp, &div);
Index: uspace/lib/c/include/types/label.h
===================================================================
--- uspace/lib/c/include/types/label.h	(revision c188c62aa2ffa4dc0f6451547f7cdb1966d6eb8d)
+++ uspace/lib/c/include/types/label.h	(revision 81b9d3ed6af6996e5039aa44755f6f7a9b396e2f)
@@ -124,4 +124,6 @@
 } label_pcnt_t;
 
+#define LPC_LIMIT (lpc_minix + 1)
+
 #endif
 
Index: uspace/lib/c/test/odict.c
===================================================================
--- uspace/lib/c/test/odict.c	(revision c188c62aa2ffa4dc0f6451547f7cdb1966d6eb8d)
+++ uspace/lib/c/test/odict.c	(revision 81b9d3ed6af6996e5039aa44755f6f7a9b396e2f)
@@ -272,5 +272,4 @@
 
 		v = seq_next(v);
-		++i;
 	}
 }
Index: uspace/lib/fdisk/src/fdisk.c
===================================================================
--- uspace/lib/fdisk/src/fdisk.c	(revision c188c62aa2ffa4dc0f6451547f7cdb1966d6eb8d)
+++ uspace/lib/fdisk/src/fdisk.c	(revision 81b9d3ed6af6996e5039aa44755f6f7a9b396e2f)
@@ -1015,5 +1015,5 @@
 	max_blocks = fdisk_ba_align_up(dev, max_blocks);
 
-	pcnt = -1;
+	pcnt = LPC_LIMIT;
 
 	switch (pspec->fstype) {
@@ -1034,5 +1034,5 @@
 	}
 
-	if (pcnt < 0)
+	if (pcnt == LPC_LIMIT)
 		return EINVAL;
 
Index: uspace/lib/hound/src/client.c
===================================================================
--- uspace/lib/hound/src/client.c	(revision c188c62aa2ffa4dc0f6451547f7cdb1966d6eb8d)
+++ uspace/lib/hound/src/client.c	(revision 81b9d3ed6af6996e5039aa44755f6f7a9b396e2f)
@@ -48,5 +48,5 @@
 
 /** Stream structure */
-typedef struct hound_stream {
+struct hound_stream {
 	/** link in context's list */
 	link_t link;
@@ -59,5 +59,5 @@
 	/** Stream flags */
 	int flags;
-} hound_stream_t;
+};
 
 /**
@@ -72,5 +72,5 @@
 
 /** Hound client context structure */
-typedef struct hound_context {
+struct hound_context {
 	/** Audio session */
 	hound_sess_t *session;
@@ -89,5 +89,5 @@
 	/** Assigned context id */
 	hound_context_id_t id;
-} hound_context_t;
+};
 
 /**
Index: uspace/lib/nettl/src/amap.c
===================================================================
--- uspace/lib/nettl/src/amap.c	(revision c188c62aa2ffa4dc0f6451547f7cdb1966d6eb8d)
+++ uspace/lib/nettl/src/amap.c	(revision 81b9d3ed6af6996e5039aa44755f6f7a9b396e2f)
@@ -58,4 +58,20 @@
 #include <stdint.h>
 #include <stdlib.h>
+
+/** Convert association map flags to port range flags.
+ *
+ * @param flags Association map flags
+ * @return Port range flags
+ */
+static portrng_flags_t aflags_to_pflags(amap_flags_t flags)
+{
+	portrng_flags_t pflags;
+
+	pflags = 0;
+	if ((flags & af_allow_system) != 0)
+		pflags |= pf_allow_system;
+
+	return pflags;
+}
 
 /** Create association map.
@@ -378,5 +394,5 @@
 	mepp = *epp;
 
-	rc = portrng_alloc(repla->portrng, epp->local.port, arg, flags,
+	rc = portrng_alloc(repla->portrng, epp->local.port, arg, aflags_to_pflags(flags),
 	    &mepp.local.port);
 	if (rc != EOK) {
@@ -422,5 +438,5 @@
 	mepp = *epp;
 
-	rc = portrng_alloc(laddr->portrng, epp->local.port, arg, flags,
+	rc = portrng_alloc(laddr->portrng, epp->local.port, arg, aflags_to_pflags(flags),
 	    &mepp.local.port);
 	if (rc != EOK) {
@@ -466,5 +482,5 @@
 	mepp = *epp;
 
-	rc = portrng_alloc(llink->portrng, epp->local.port, arg, flags,
+	rc = portrng_alloc(llink->portrng, epp->local.port, arg, aflags_to_pflags(flags),
 	    &mepp.local.port);
 	if (rc != EOK) {
@@ -498,5 +514,5 @@
 	mepp = *epp;
 
-	rc = portrng_alloc(map->unspec, epp->local.port, arg, flags,
+	rc = portrng_alloc(map->unspec, epp->local.port, arg, aflags_to_pflags(flags),
 	    &mepp.local.port);
 	if (rc != EOK) {
Index: uspace/lib/usb/src/usb.c
===================================================================
--- uspace/lib/usb/src/usb.c	(revision c188c62aa2ffa4dc0f6451547f7cdb1966d6eb8d)
+++ uspace/lib/usb/src/usb.c	(revision 81b9d3ed6af6996e5039aa44755f6f7a9b396e2f)
@@ -73,5 +73,5 @@
 const char *usb_str_transfer_type(usb_transfer_type_t t)
 {
-	if (t >= ARRAY_SIZE(str_transfer_type)) {
+	if ((size_t)t >= ARRAY_SIZE(str_transfer_type)) {
 		return "invalid";
 	}
@@ -86,5 +86,5 @@
 const char *usb_str_transfer_type_short(usb_transfer_type_t t)
 {
-	if (t >= ARRAY_SIZE(str_transfer_type_short)) {
+	if ((size_t)t >= ARRAY_SIZE(str_transfer_type_short)) {
 		return "invl";
 	}
Index: uspace/lib/usbdev/src/devdrv.c
===================================================================
--- uspace/lib/usbdev/src/devdrv.c	(revision c188c62aa2ffa4dc0f6451547f7cdb1966d6eb8d)
+++ uspace/lib/usbdev/src/devdrv.c	(revision 81b9d3ed6af6996e5039aa44755f6f7a9b396e2f)
@@ -53,5 +53,5 @@
 
 /** USB device structure. */
-typedef struct usb_device {
+struct usb_device {
 	/** Connection to device on USB bus */
 	usb_dev_session_t *bus_session;
@@ -95,5 +95,5 @@
 	 */
 	void *driver_data;
-} usb_device_t;
+};
 
 /** Count number of pipes the driver expects.
Index: uspace/srv/fs/cdfs/cdfs_ops.c
===================================================================
--- uspace/srv/fs/cdfs/cdfs_ops.c	(revision c188c62aa2ffa4dc0f6451547f7cdb1966d6eb8d)
+++ uspace/srv/fs/cdfs/cdfs_ops.c	(revision 81b9d3ed6af6996e5039aa44755f6f7a9b396e2f)
@@ -117,4 +117,5 @@
 } cdfs_dir_flag_t;
 
+/** Directory record */
 typedef struct {
 	uint8_t length;
@@ -134,4 +135,22 @@
 } __attribute__((packed)) cdfs_dir_t;
 
+/** Directory record for the root directory */
+typedef struct {
+	uint8_t length;
+	uint8_t ea_length;
+	
+	uint32_t_lb lba;
+	uint32_t_lb size;
+	
+	cdfs_timestamp_t timestamp;
+	uint8_t flags;
+	uint8_t unit_size;
+	uint8_t gap_size;
+	uint16_t_lb sequence_nr;
+	
+	uint8_t name_length;
+	uint8_t name[1];
+} __attribute__((packed)) cdfs_root_dir_t;
+
 typedef struct {
 	uint8_t flags; /* reserved in primary */
@@ -155,5 +174,5 @@
 	uint32_t opt_path_table_msb;
 	
-	cdfs_dir_t root_dir;
+	cdfs_root_dir_t root_dir;
 	uint8_t pad0;
 	
Index: uspace/srv/fs/exfat/exfat_ops.c
===================================================================
--- uspace/srv/fs/exfat/exfat_ops.c	(revision c188c62aa2ffa4dc0f6451547f7cdb1966d6eb8d)
+++ uspace/srv/fs/exfat/exfat_ops.c	(revision 81b9d3ed6af6996e5039aa44755f6f7a9b396e2f)
@@ -595,4 +595,7 @@
 int exfat_node_put(fs_node_t *fn)
 {
+	if (fn == NULL)
+		return EOK;
+
 	exfat_node_t *nodep = EXFAT_NODE(fn);
 	bool destroy = false;
@@ -932,5 +935,5 @@
 int exfat_free_block_count(service_id_t service_id, uint64_t *count)
 {
-	fs_node_t *node;
+	fs_node_t *node = NULL;
 	exfat_node_t *bmap_node;
 	exfat_bs_t *bs;
@@ -945,5 +948,4 @@
 
 	bs = block_bb_get(service_id);
-	node = NULL;
 	rc = exfat_bitmap_get(&node, service_id);
 	if (rc != EOK)
