Index: .gitignore
===================================================================
--- .gitignore	(revision fa86fff978f42fa20491d74ff2a6cc904ab53fd0)
+++ .gitignore	(revision 3012ae777ffbbbecfe02f17eb2a456c88726797c)
@@ -376,4 +376,5 @@
 uspace/lib/c/test-libc
 uspace/lib/label/test-liblabel
+uspace/lib/math/test-libmath
 uspace/lib/pcut/test-libpcut-*
 uspace/lib/posix/gcc.specs
Index: HelenOS.config
===================================================================
--- HelenOS.config	(revision fa86fff978f42fa20491d74ff2a6cc904ab53fd0)
+++ HelenOS.config	(revision 3012ae777ffbbbecfe02f17eb2a456c88726797c)
@@ -295,8 +295,6 @@
 
 % Compiler
-@ "gcc_cross" GNU C Compiler (cross-compiler)
+@ "gcc_cross" GNU C Compiler (HelenOS-specific cross-compiler)
 @ "clang" Clang
-@ "gcc_helenos" GNU C Compiler (experimental HelenOS-specific cross-compiler)
-@ "gcc_native" GNU C Compiler (native)
 ! COMPILER (choice)
 
@@ -313,5 +311,5 @@
 @ "ia32" Intel IA-32
 @ "mips32" MIPS 32-bit
-! [PLATFORM=abs32le&(COMPILER=gcc_cross|COMPILER=gcc_helenos)] CROSS_TARGET (choice)
+! [PLATFORM=abs32le&COMPILER=gcc_cross] CROSS_TARGET (choice)
 
 
@@ -425,5 +423,5 @@
 
 % Use link-time optimization
-! [COMPILER=gcc_cross|COMPILER=gcc_native] CONFIG_LTO (n/y)
+! [COMPILER=gcc_cross] CONFIG_LTO (n/y)
 
 % Kernel RCU algorithm
Index: contrib/tools/random_check.sh
===================================================================
--- contrib/tools/random_check.sh	(revision fa86fff978f42fa20491d74ff2a6cc904ab53fd0)
+++ contrib/tools/random_check.sh	(revision 3012ae777ffbbbecfe02f17eb2a456c88726797c)
@@ -50,6 +50,4 @@
 		;;
 	s)
-		echo "COMPILER=gcc_native" >>"$PRUNE_CONFIG_FILE"
-		echo "COMPILER=gcc_helenos" >>"$PRUNE_CONFIG_FILE"
 		;;
 	*|h)
Index: tools/autotool.py
===================================================================
--- tools/autotool.py	(revision fa86fff978f42fa20491d74ff2a6cc904ab53fd0)
+++ tools/autotool.py	(revision 3012ae777ffbbbecfe02f17eb2a456c88726797c)
@@ -178,6 +178,4 @@
 def get_target(config):
 	platform = None
-	gnu_target = None
-	helenos_target = None
 	target = None
 	cc_args = []
@@ -188,35 +186,28 @@
 
 		if (config['CROSS_TARGET'] == "arm32"):
-			gnu_target = "arm-linux-gnueabi"
-			helenos_target = "arm-helenos"
+			target = "arm-helenos"
 
 		if (config['CROSS_TARGET'] == "ia32"):
-			gnu_target = "i686-pc-linux-gnu"
-			helenos_target = "i686-helenos"
+			target = "i686-helenos"
 
 		if (config['CROSS_TARGET'] == "mips32"):
 			cc_args.append("-mabi=32")
-			gnu_target = "mipsel-linux-gnu"
-			helenos_target = "mipsel-helenos"
+			target = "mipsel-helenos"
 
 	if (config['PLATFORM'] == "amd64"):
 		platform = config['PLATFORM']
-		gnu_target = "amd64-unknown-elf"
-		helenos_target = "amd64-helenos"
+		target = "amd64-helenos"
 
 	if (config['PLATFORM'] == "arm32"):
 		platform = config['PLATFORM']
-		gnu_target = "arm-linux-gnueabi"
-		helenos_target = "arm-helenos"
+		target = "arm-helenos"
 
 	if (config['PLATFORM'] == "ia32"):
 		platform = config['PLATFORM']
-		gnu_target = "i686-pc-linux-gnu"
-		helenos_target = "i686-helenos"
+		target = "i686-helenos"
 
 	if (config['PLATFORM'] == "ia64"):
 		platform = config['PLATFORM']
-		gnu_target = "ia64-pc-linux-gnu"
-		helenos_target = "ia64-helenos"
+		target = "ia64-helenos"
 
 	if (config['PLATFORM'] == "mips32"):
@@ -226,11 +217,9 @@
 		if ((config['MACHINE'] == "msim") or (config['MACHINE'] == "lmalta")):
 			platform = config['PLATFORM']
-			gnu_target = "mipsel-linux-gnu"
-			helenos_target = "mipsel-helenos"
+			target = "mipsel-helenos"
 
 		if ((config['MACHINE'] == "bmalta")):
 			platform = "mips32eb"
-			gnu_target = "mips-linux-gnu"
-			helenos_target = "mips-helenos"
+			target = "mips-helenos"
 
 	if (config['PLATFORM'] == "mips64"):
@@ -240,26 +229,17 @@
 		if (config['MACHINE'] == "msim"):
 			platform = config['PLATFORM']
-			gnu_target = "mips64el-linux-gnu"
-			helenos_target = "mips64el-helenos"
+			target = "mips64el-helenos"
 
 	if (config['PLATFORM'] == "ppc32"):
 		platform = config['PLATFORM']
-		gnu_target = "ppc-linux-gnu"
-		helenos_target = "ppc-helenos"
+		target = "ppc-helenos"
 
 	if (config['PLATFORM'] == "riscv64"):
 		platform = config['PLATFORM']
-		gnu_target = "riscv64-unknown-linux-gnu"
-		helenos_target = "riscv64-helenos"
+		target = "riscv64-helenos"
 
 	if (config['PLATFORM'] == "sparc64"):
 		platform = config['PLATFORM']
-		gnu_target = "sparc64-linux-gnu"
-		helenos_target = "sparc64-helenos"
-
-	if (config['COMPILER'] == "gcc_helenos"):
-		target = helenos_target
-	else:
-		target = gnu_target
+		target = "sparc64-helenos"
 
 	return (platform, cc_args, target)
@@ -279,4 +259,13 @@
 
 	sys.stderr.write("ok\n")
+
+def check_path_gcc(target):
+	"Check whether GCC for a given target is present in $PATH."
+
+	try:
+		subprocess.Popen([ "%s-gcc" % target, "--version" ], stdout = subprocess.PIPE, stderr = subprocess.PIPE).wait()
+		return True
+	except:
+		return False
 
 def check_app_alternatives(alts, args, name, details):
@@ -561,16 +550,4 @@
 		cross_prefix = "/usr/local/cross"
 
-	# HelenOS cross-compiler prefix
-	if ('CROSS_HELENOS_PREFIX' in os.environ):
-		cross_helenos_prefix = os.environ['CROSS_HELENOS_PREFIX']
-	else:
-		cross_helenos_prefix = "/usr/local/cross-helenos"
-
-	# Prefix binutils tools on Solaris
-	if (os.uname()[0] == "SunOS"):
-		binutils_prefix = "g"
-	else:
-		binutils_prefix = ""
-
 	owd = sandbox_enter()
 
@@ -593,18 +570,8 @@
 				     "Please contact the developers of HelenOS."])
 
-		path = "%s/%s/bin" % (cross_prefix, target)
-
-		# Compatibility with earlier toolchain paths.
-		if not os.path.exists(path):
-			if (config['COMPILER'] == "gcc_helenos"):
-				check_path = "%s/%s/%s" % (cross_helenos_prefix, platform, target)
-				if not os.path.exists(check_path):
-					print_error(TOOLCHAIN_FAIL)
-				path = "%s/%s/bin" % (cross_helenos_prefix, platform)
-			else:
-				check_path = "%s/%s/%s" % (cross_prefix, platform, target)
-				if not os.path.exists(check_path):
-					print_error(TOOLCHAIN_FAIL)
-				path = "%s/%s/bin" % (cross_prefix, platform)
+		path = None
+
+		if not check_path_gcc(target):
+			path = "%s/bin" % cross_prefix
 
 		common['TARGET'] = target
@@ -612,5 +579,5 @@
 
 		# Compiler
-		if (config['COMPILER'] == "gcc_cross" or config['COMPILER'] == "gcc_helenos"):
+		if (config['COMPILER'] == "gcc_cross"):
 			check_gcc(path, prefix, common, PACKAGE_CROSS)
 			check_binutils(path, prefix, common, PACKAGE_CROSS)
@@ -622,12 +589,4 @@
 			check_common(common, "GXX")
 			common['CXX'] = common['GXX']
-
-		if (config['COMPILER'] == "gcc_native"):
-			check_gcc(None, "", common, PACKAGE_GCC)
-			check_binutils(None, binutils_prefix, common, PACKAGE_BINUTILS)
-
-			check_common(common, "GCC")
-			common['CC'] = common['GCC']
-			common['CC_AUTOGEN'] = common['CC']
 
 		if (config['COMPILER'] == "clang"):
Index: tools/toolchain.sh
===================================================================
--- tools/toolchain.sh	(revision fa86fff978f42fa20491d74ff2a6cc904ab53fd0)
+++ tools/toolchain.sh	(revision 3012ae777ffbbbecfe02f17eb2a456c88726797c)
@@ -45,5 +45,5 @@
 
 REAL_INSTALL=true
-USE_HELENOS_TARGET=false
+USE_HELENOS_TARGET=true
 
 check_error() {
@@ -60,5 +60,5 @@
 	echo
 	echo "Syntax:"
-	echo " $0 [--no-install] [--helenos-target] <platform>"
+	echo " $0 [--no-install] [--non-helenos-target] <platform>"
 	echo
 	echo "Possible target platforms are:"
@@ -89,8 +89,7 @@
 	echo "not want to run the script under the super user."
 	echo
-	echo "The --helenos-target will build HelenOS-specific toolchain"
-	echo "(i.e. it will use *-helenos triplet instead of *-linux-*)."
-	echo "Using the HelenOS-specific toolchain is still an experimental"
-	echo "feature that is not fully supported."
+	echo "The --non-helenos-target will build non-HelenOS-specific toolchain"
+	echo "(i.e. it will use *-linux-* triplet instead of *-helenos)."
+	echo "Using this toolchain for building HelenOS is not supported."
 	echo
 
@@ -238,17 +237,7 @@
 	HELENOS_TARGET="${GNU_ARCH}-helenos"
 
-	# TODO: Clean up this mess.
 	case "$1" in
-		"amd64")
-			LINUX_TARGET="${GNU_ARCH}-unknown-elf"
-			;;
-		"ia32" | "ia64")
-			LINUX_TARGET="${GNU_ARCH}-pc-linux-gnu"
-			;;
 		"arm32")
 			LINUX_TARGET="${GNU_ARCH}-linux-gnueabi"
-			;;
-		"riscv64")
-			LINUX_TARGET="${GNU_ARCH}-unknown-linux-gnu"
 			;;
 		*)
@@ -283,5 +272,5 @@
 	fi
 
-	PREFIX="${CROSS_PREFIX}/${TARGET}"
+	PREFIX="${CROSS_PREFIX}"
 
 	echo ">>> Removing previous content"
@@ -408,7 +397,6 @@
 	if $REAL_INSTALL ; then
 		echo ">>> Moving to the destination directory."
-		cleanup_dir "${PREFIX}"
-		echo mv "${INSTALL_DIR}/${PREFIX}" "${PREFIX}"
-		mv "${INSTALL_DIR}/${PREFIX}" "${PREFIX}"
+		echo cp -r -t "${PREFIX}" "${INSTALL_DIR}/${PREFIX}/"*
+		cp -r -t "${PREFIX}" "${INSTALL_DIR}/${PREFIX}/"*
 	fi
 
@@ -429,6 +417,6 @@
 			shift
 			;;
-		--helenos-target)
-			USE_HELENOS_TARGET=true
+		--non-helenos-target)
+			USE_HELENOS_TARGET=false
 			shift
 			;;
Index: tools/travis.sh
===================================================================
--- tools/travis.sh	(revision fa86fff978f42fa20491d74ff2a6cc904ab53fd0)
+++ tools/travis.sh	(revision 3012ae777ffbbbecfe02f17eb2a456c88726797c)
@@ -46,19 +46,19 @@
 h_get_arch_config_space() {
     cat <<'EOF_CONFIG_SPACE'
-amd64:amd64-unknown-elf:image.iso
-arm32/beagleboardxm:arm-linux-gnueabi:uImage.bin
-arm32/beaglebone:arm-linux-gnueabi:uImage.bin
-arm32/gta02:arm-linux-gnueabi:uImage.bin
-arm32/integratorcp:arm-linux-gnueabi:image.boot
-arm32/raspberrypi:arm-linux-gnueabi:uImage.bin
-ia32:i686-pc-linux-gnu:image.iso
-ia64/i460GX:ia64-pc-linux-gnu:image.boot
-ia64/ski:ia64-pc-linux-gnu:image.boot
-mips32/malta-be:mips-linux-gnu:image.boot
-mips32/malta-le:mipsel-linux-gnu:image.boot
-mips32/msim:mipsel-linux-gnu:image.boot
-ppc32:ppc-linux-gnu:image.iso
-sparc64/niagara:sparc64-linux-gnu:image.iso
-sparc64/ultra:sparc64-linux-gnu:image.iso
+amd64:amd64-helenos:image.iso
+arm32/beagleboardxm:arm-helenos:uImage.bin
+arm32/beaglebone:arm-helenos:uImage.bin
+arm32/gta02:arm-helenos:uImage.bin
+arm32/integratorcp:arm-helenos:image.boot
+arm32/raspberrypi:arm-helenos:uImage.bin
+ia32:i686-helenos:image.iso
+ia64/i460GX:ia64-helenos:image.boot
+ia64/ski:ia64-helenos:image.boot
+mips32/malta-be:mips-helenos:image.boot
+mips32/malta-le:mipsel-helenos:image.boot
+mips32/msim:mipsel-helenos:image.boot
+ppc32:ppc-helenos:image.iso
+sparc64/niagara:sparc64-helenos:image.iso
+sparc64/ultra:sparc64-helenos:image.iso
 EOF_CONFIG_SPACE
 }
Index: uspace/lib/posix/Makefile
===================================================================
--- uspace/lib/posix/Makefile	(revision fa86fff978f42fa20491d74ff2a6cc904ab53fd0)
+++ uspace/lib/posix/Makefile	(revision 3012ae777ffbbbecfe02f17eb2a456c88726797c)
@@ -120,5 +120,5 @@
 	echo '# Generated file, do not modify.' >> $@.new
 	echo '# Do not forget to set HELENOS_EXPORT_ROOT.' >> $@.new
-	echo 'HELENOS_CROSS_PATH="$(shell dirname "$(CC)")"' >> $@.new
+	echo 'HELENOS_CROSS_PATH="$(shell dirname `which "$(CC)"`)"' >> $@.new
 	echo 'HELENOS_ARCH="$(firstword $(subst -, ,$(TARGET)))"' >> $@.new
 	echo 'HELENOS_TARGET="$(TARGET)"' >> $@.new
