Index: .gitignore
===================================================================
--- .gitignore	(revision 5c03bd305cb06f94360a0aa18b2c1a9ab52a88ef)
+++ .gitignore	(revision a5c468e1202a50cf26350e4a4d16303bc7323265)
@@ -13,7 +13,9 @@
 /Makefile.common
 /Makefile.config
+/PKG
 /common.h
 /config.h
 /cscope.out
+/downloads
 /hdisk.img
 /image.boot
@@ -27,5 +29,7 @@
 boot/arch/sparc64/_link.ld
 boot/components.h
+boot/components.o.new
 boot/components.s
+boot/components.tar
 boot/components.zip
 boot/components_desc.c
@@ -35,4 +39,5 @@
 boot/image.raw
 boot/initrd.img
+boot/initrd.img.gz
 common.h.new
 deps.mk
@@ -51,5 +56,8 @@
 kernel/generic/src/debug/real_map.bin
 kernel/kernel.bin
+kernel/kernel.bin.gz
 kernel/kernel.dump
+kernel/kernel.elf
+kernel/kernel.elf.gz
 kernel/kernel.raw
 tag
@@ -71,4 +79,5 @@
 tools/sparc64-linux-gnu
 tools/sycek/
+tools/xcw/demo/viewer
 uspace/app/barber/barber
 uspace/app/barber/images.c
@@ -100,4 +109,5 @@
 uspace/app/inet/inet
 uspace/app/init/init
+uspace/app/init/init.gz
 uspace/app/kill/kill
 uspace/app/killall/killall
@@ -133,4 +143,5 @@
 uspace/app/tester/tester
 uspace/app/testread/testread
+uspace/app/testrunner/testrunner
 uspace/app/testwrit/testwrit
 uspace/app/tetris/tetris
@@ -152,4 +163,5 @@
 uspace/app/vterm/vterm
 uspace/app/vuhid/vuh
+uspace/app/vuhid/vuhid
 uspace/app/wavplay/wavplay
 uspace/app/websrv/websrv
@@ -338,4 +350,5 @@
 uspace/drv/test/test3/test3
 uspace/drv/time/cmos-rtc/cmos-rtc
+uspace/export
 uspace/lib/c/arch/abs32le/_link-dlexe.ld
 uspace/lib/c/arch/abs32le/_link-loader.ld
@@ -378,4 +391,6 @@
 uspace/lib/math/test-libmath
 uspace/lib/pcut/test-libpcut-*
+uspace/lib/posix/gcc.specs
+uspace/lib/posix/link.ld
 uspace/lib/posix/test-libposix
 uspace/lib/sif/test-libsif
@@ -384,4 +399,5 @@
 uspace/srv/bd/file_bd/file_bd
 uspace/srv/bd/rd/rd
+uspace/srv/bd/rd/rd.gz
 uspace/srv/bd/sata_bd/sata_bd
 uspace/srv/bd/vbd/vbd
@@ -391,5 +407,7 @@
 uspace/srv/fs/exfat/exfat
 uspace/srv/fs/ext4fs/ext4fs
+uspace/srv/fs/ext4fs/ext4fs.gz
 uspace/srv/fs/fat/fat
+uspace/srv/fs/fat/fat.gz
 uspace/srv/fs/locfs/locfs
 uspace/srv/fs/mfs/mfs
@@ -408,9 +426,13 @@
 uspace/srv/hw/bus/cuda_adb/cuda_adb
 uspace/srv/hw/char/s3c24xx_uart/s3c24ser
+uspace/srv/hw/char/s3c24xx_uart/s3c24xx_uart
 uspace/srv/hw/irc/obio/obio
 uspace/srv/klog/klog
 uspace/srv/loader/loader
+uspace/srv/loader/loader.gz
 uspace/srv/locsrv/locsrv
+uspace/srv/locsrv/locsrv.gz
 uspace/srv/logger/logger
+uspace/srv/logger/logger.gz
 uspace/srv/net/dhcp/dhcp
 uspace/srv/net/dnsrsrv/dnsrsrv
@@ -424,24 +446,9 @@
 uspace/srv/net/udp/udp
 uspace/srv/ns/ns
+uspace/srv/ns/ns.gz
 uspace/srv/taskmon/taskmon
 uspace/srv/test/chardev-test/chardev-test
 uspace/srv/vfs/vfs
+uspace/srv/vfs/vfs.gz
 uspace/srv/volsrv/test-volsrv
 uspace/srv/volsrv/volsrv
-kernel/kernel.elf
-uspace/app/testrunner/testrunner
-uspace/app/vuhid/vuhid
-uspace/srv/hw/char/s3c24xx_uart/s3c24xx_uart
-boot/components.o.new
-boot/components.tar
-boot/initrd.img.gz
-kernel/kernel.elf.gz
-uspace/app/init/init.gz
-uspace/srv/bd/rd/rd.gz
-uspace/srv/fs/ext4fs/ext4fs.gz
-uspace/srv/loader/loader.gz
-uspace/srv/locsrv/locsrv.gz
-uspace/srv/logger/logger.gz
-uspace/srv/ns/ns.gz
-uspace/srv/vfs/vfs.gz
-kernel/kernel.bin.gz
Index: Makefile
===================================================================
--- Makefile	(revision 5c03bd305cb06f94360a0aa18b2c1a9ab52a88ef)
+++ Makefile	(revision a5c468e1202a50cf26350e4a4d16303bc7323265)
@@ -50,5 +50,5 @@
 .PHONY: all precheck cscope cscope_parts autotool config_auto config_default config distclean clean check releasefile release common boot kernel uspace export-posix space
 
-all: kernel uspace
+all: kernel uspace export-cross test-xcw
 	$(MAKE) -r -C boot PRECHECK=$(PRECHECK)
 
@@ -61,4 +61,7 @@
 	$(MAKE) -r -C uspace PRECHECK=$(PRECHECK)
 
+test-xcw: uspace export-cross
+	export PATH=$$PATH:/data/helenos/master/tools/xcw/bin && $(MAKE) -r -C tools/xcw/demo
+
 export-posix: common
 ifndef EXPORT_DIR
@@ -67,4 +70,7 @@
 	$(MAKE) -r -C uspace export EXPORT_DIR=$(abspath $(EXPORT_DIR))
 endif
+
+export-cross: common
+	$(MAKE) -r -C uspace export EXPORT_DIR=$(abspath uspace/export)
 
 precheck: clean
@@ -155,4 +161,5 @@
 	$(MAKE) -r -C boot clean
 	$(MAKE) -r -C doxygen clean
+	$(MAKE) -r -C tools/xcw/demo clean
 
 $(ERRNO_HEADER): $(ERRNO_INPUT)
Index: tools/xcw/bin/helenos-bld-config
===================================================================
--- tools/xcw/bin/helenos-bld-config	(revision 5c03bd305cb06f94360a0aa18b2c1a9ab52a88ef)
+++ tools/xcw/bin/helenos-bld-config	(revision a5c468e1202a50cf26350e4a4d16303bc7323265)
@@ -1,5 +1,5 @@
 #!/bin/bash
 #
-# Copyright (c) 2015 Jiri Svoboda
+# Copyright (c) 2018 Jiri Svoboda
 # All rights reserved.
 #
@@ -35,4 +35,5 @@
 MAKEFILE_COMMON="$SRC_ROOT"/Makefile.common
 MAKEFILE_CONFIG="$SRC_ROOT"/Makefile.config
+CONFIG_MK="$SRC_ROOT"/uspace/export/config.mk
 
 # Extract simple 'name = value' variable definition from Makefile
@@ -42,5 +43,6 @@
 	file_name="$2"
 
-	sed -n "s/^$field_name = \\(.*\\)$/\\1/p" "$file_name"
+	sed -n "s/^$field_name \\{0,1\\}= \\{0,1\\}\\(.*\\)$/\\1/p" "$file_name" | \
+	    sed "s/^\"//" | sed "s/\"$//"
 }
 
@@ -54,4 +56,6 @@
 	echo "__${ENDIAN}__"
 	;;
+*.--cflags) extract_field "HELENOS_CFLAGS" "$CONFIG_MK";;
+*.--ldflags) extract_field "HELENOS_LDFLAGS" "$CONFIG_MK";;
 (*)
 	echo "Unknown option $1" >&2
Index: tools/xcw/bin/helenos-cc
===================================================================
--- tools/xcw/bin/helenos-cc	(revision 5c03bd305cb06f94360a0aa18b2c1a9ab52a88ef)
+++ tools/xcw/bin/helenos-cc	(revision a5c468e1202a50cf26350e4a4d16303bc7323265)
@@ -1,5 +1,5 @@
 #!/bin/bash
 #
-# Copyright (c) 2015 Jiri Svoboda
+# Copyright (c) 2018 Jiri Svoboda
 # All rights reserved.
 #
@@ -36,4 +36,5 @@
 UARCH="$("$XCW"/helenos-bld-config --uarch)"
 CC="$("$XCW"/helenos-bld-config --cc)"
+CFLAGS="$("$XCW"/helenos-bld-config --cflags)"
 ENDIAN="$("$XCW"/helenos-bld-config --endian)"
 
@@ -41,5 +42,5 @@
 "$CC" \
     -O3 -fexec-charset=UTF-8 -fwide-exec-charset=UTF-32LE -finput-charset=UTF-8 \
-    -nostdlib \
+    $CFLAGS \
     -Wall -Wextra -Wno-clobbered -Wno-unused-parameter -Wmissing-prototypes \
     -std=gnu99 -Werror-implicit-function-declaration -Wwrite-strings -ggdb \
Index: tools/xcw/bin/helenos-ld
===================================================================
--- tools/xcw/bin/helenos-ld	(revision 5c03bd305cb06f94360a0aa18b2c1a9ab52a88ef)
+++ tools/xcw/bin/helenos-ld	(revision a5c468e1202a50cf26350e4a4d16303bc7323265)
@@ -1,5 +1,5 @@
 #!/bin/bash
 #
-# Copyright (c) 2015 Jiri Svoboda
+# Copyright (c) 2018 Jiri Svoboda
 # All rights reserved.
 #
@@ -35,10 +35,14 @@
 SRC_ROOT="$XCW/../../.."
 UARCH="$("$XCW"/helenos-bld-config --uarch)"
+CFLAGS="$("$XCW"/helenos-bld-config --cflags)"
+LDFLAGS="$("$XCW"/helenos-bld-config --ldflags)"
 CC="$("$XCW"/helenos-bld-config --cc)"
 
 echo helenos-ld "$@"
 "$CC" \
+    $CFLAGS \
     "$@" \
     "$SRC_ROOT"/uspace/lib/c/crt0.o \
     "$SRC_ROOT"/uspace/lib/c/crt1.o \
-    "$SRC_ROOT"/uspace/lib/c/libc.a
+    "$SRC_ROOT"/uspace/lib/c/libc.a \
+    -lgcc
Index: uspace/Makefile
===================================================================
--- uspace/Makefile	(revision 5c03bd305cb06f94360a0aa18b2c1a9ab52a88ef)
+++ uspace/Makefile	(revision a5c468e1202a50cf26350e4a4d16303bc7323265)
@@ -278,4 +278,5 @@
 	find lib app drv srv -name '*.lo' -follow -exec rm \{\} \;
 	find lib app drv srv -name '*.d' -follow -exec rm \{\} \;
+	rm -fr export
 
 $(CLEANS):
