Index: uspace/app/binutils/toolchain.sh
===================================================================
--- uspace/app/binutils/toolchain.sh	(revision d1851328bc4c00f03e08f9773e4d83b5be74dc44)
+++ uspace/app/binutils/toolchain.sh	(revision 723560f937392cec54ac04cc5f4d1de03fd7e5d4)
@@ -64,17 +64,17 @@
 		echo 'LINK="`echo -n "$AS_LINK""$LD_LINK"`"'
 		echo 'if [ -n "$LINK" ]; then'
-		echo '	LD_ARGS="`echo \"$*\" | \'
-		echo '		sed '\'s/-O[^ ]*//g\'' | \'
-		echo '		sed '\'s/-W[^ ]*//g\'' | \'
-		echo '		sed '\'s/-g//g\'' | \'
-		echo '		sed '\'s/-l[^ ]*//g\'' | \'
+		echo '	LD_ARGS="`echo \" $*\" | \'
+		echo '		sed '\'s/ -O[^ ]*//g\'' | \'
+		echo '		sed '\'s/ -W[^ ]*//g\'' | \'
+		echo '		sed '\'s/ -g//g\'' | \'
+		echo '		sed '\'s/ -l[^ ]*//g\'' | \'
 		echo '		sed '\'s/ [ ]*/ /g\''`"'
 		echo '	ld $LD_ARGS'
 		echo 'else'
-		CFLAGS="`echo "$3" | \
-			sed 's/-O[^ ]*//g' | \
-			sed 's/-W[^ ]*//g' | \
-			sed 's/-pipe//g' | \
-			sed 's/-g//g' | \
+		CFLAGS="`echo " $3" | \
+			sed 's/ -O[^ ]*//g' | \
+			sed 's/ -W[^ ]*//g' | \
+			sed 's/ -pipe//g' | \
+			sed 's/ -g//g' | \
 			sed 's/ [ ]*/ /g'`"
 		echo '	CONFTEST="`echo \"$*\" | grep '\' conftest \''`"'
@@ -87,12 +87,15 @@
 					# -Wc++-compat
 					#		Required just for gold linker.
-		echo '		GCC_ARGS="`echo \"$*\" | \'
-		echo '			sed '\'s/-Wc++-compat//g\'' | \'
+		echo '		GCC_ARGS="`echo \" $*\" | \'
+		echo '			sed '\'s/ -Wc++-compat//g\'' | \'
 		echo '			sed '\'s/ [ ]*/ /g\''`"'
 					# Add flags:
 					# -Wno-type-limits
 					#		HelenOS pid_t is unsigned
-					# 		while on most systems it is signed.
-		echo '		GCC_ARGS="$GCC_ARGS -Wno-type-limits"'
+					#		while on most systems it is signed.
+					# -Wno-shadow
+					#		Silents the warning caused by 
+					#		harmless bug in ld/ldlang.h and ld/ldlex.c.
+		echo '		GCC_ARGS="$GCC_ARGS -Wno-type-limits -Wno-shadow"'
 		echo '		echo' \'"$2"\' '"$GCC_ARGS"' \'"$CFLAGS"\'
 		echo "		$2" '$GCC_ARGS' "$CFLAGS"
