Index: boot/Makefile.build
===================================================================
--- boot/Makefile.build	(revision 5261062cfc91ad127782b1d8407ef8fd90afdaae)
+++ boot/Makefile.build	(revision 009c485952250dbca2420fd8ee4fa68ffaf7b9ac)
@@ -37,5 +37,5 @@
 
 AFLAGS = --fatal-warnings
-LFLAGS = --fatal-warnings --warn-common
+LDFLAGS = -Wl,--fatal-warnings,--warn-common
 
 COMMON_CFLAGS = $(INCLUDES) -O$(OPTIMIZATION) -imacros $(CONFIG_HEADER) \
@@ -82,5 +82,5 @@
 
 $(RAW): $(OBJECTS) $(LINK)
-	$(LD) -n $(LFLAGS) -T $(LINK) -M -Map $(MAP) -o $@ $(OBJECTS)
+	$(CC) $(CFLAGS) -Wl,-n $(LDFLAGS) -T $(LINK) -Wl,-M,-Map,$(MAP) -o $@ $(OBJECTS)
 
 $(LINK): | depend
Index: boot/arch/mips32/src/Makefile.build
===================================================================
--- boot/arch/mips32/src/Makefile.build	(revision 5261062cfc91ad127782b1d8407ef8fd90afdaae)
+++ boot/arch/mips32/src/Makefile.build	(revision 009c485952250dbca2420fd8ee4fa68ffaf7b9ac)
@@ -62,5 +62,5 @@
 
 $(RAW): $(OBJECTS) $(COMPONENT_OBJECTS) $(LINK)
-	$(LD) -no-check-sections -N -T $(LINK) $(COMPONENT_OBJECTS) $(OBJECTS) -o $@
+	$(CC) $(CFLAGS) -Wl,-no-check-sections,-N -T $(LINK) $(COMPONENT_OBJECTS) $(OBJECTS) -o $@
 
 %.o: %.S $(DEPEND)
Index: kernel/Makefile
===================================================================
--- kernel/Makefile	(revision 5261062cfc91ad127782b1d8407ef8fd90afdaae)
+++ kernel/Makefile	(revision 009c485952250dbca2420fd8ee4fa68ffaf7b9ac)
@@ -116,19 +116,11 @@
 endif
 
-#
-# Mind the mutual ordering with the inclusion of the arch Makefile.inc.
-# AFLAGS and LFLAGS must be initialized before the inclusion.
-#
-AFLAGS = --fatal-warnings
-LFLAGS = -n -T $(LINK) -M --fatal-warnings --warn-common
+AFLAGS += --fatal-warnings
+LDFLAGS += -Wl,-n -T $(LINK) -Wl,-M,--fatal-warnings,--warn-common
 
 ifeq ($(CONFIG_STRIP_BINARIES),y)
-	LFLAGS += --strip-all
-endif
-
-#
-# Mind the mutual ordering with the initialization of AFLAGS and LFLAGS.
-# The arch Makefile.inc must be included after the initialization.
-#
+	LDFLAGS += -s
+endif
+
 -include arch/$(KARCH)/Makefile.inc
 -include genarch/Makefile.inc
@@ -358,5 +350,4 @@
 
 AS_CFLAGS := $(addprefix -Xassembler ,$(AFLAGS))
-LD_CFLAGS := $(addprefix -Xlinker ,$(LFLAGS))
 
 -include $(GENERIC_DEPENDS)
@@ -385,9 +376,5 @@
 
 $(RAW): $(LINK) $(ARCH_OBJECTS) $(GENARCH_OBJECTS) $(GENERIC_OBJECTS) $(SYMTAB_OBJECTS)
-ifeq ($(CONFIG_LTO),y)
-	$(CC) $(DEFS) $(CFLAGS) $(LD_CFLAGS) -Xlinker -Map -Xlinker $(MAP) -o $@ $(ARCH_OBJECTS) $(GENARCH_OBJECTS) $(GENERIC_OBJECTS) $(EXTRA_OBJECTS) $(SYMTAB_OBJECTS)
-else
-	$(LD) $(LFLAGS) -Map $(MAP) -o $@ $(ARCH_OBJECTS) $(GENARCH_OBJECTS) $(GENERIC_OBJECTS) $(EXTRA_OBJECTS) $(SYMTAB_OBJECTS)
-endif
+	$(CC) $(DEFS) $(CFLAGS) $(LDFLAGS) -Wl,-Map,$(MAP) -o $@ $(ARCH_OBJECTS) $(GENARCH_OBJECTS) $(GENERIC_OBJECTS) $(EXTRA_OBJECTS) $(SYMTAB_OBJECTS)
 
 $(LINK): $(LINK).in
@@ -411,9 +398,5 @@
 $(REAL_MAP).bin: $(LINK) $(ARCH_OBJECTS) $(GENARCH_OBJECTS) $(GENERIC_OBJECTS)
 	echo "$(AS_PROLOG)""$(SYMTAB_SECTION)" | $(CC) $(CFLAGS) $(AS_CFLAGS) -x assembler -c -o $(EMPTY_MAP) -
-ifeq ($(CONFIG_LTO),y)
-	$(CC) $(DEFS) $(CFLAGS) $(LD_CFLAGS) -Xlinker -Map -Xlinker $(MAP_PREV) -o $@ $(ARCH_OBJECTS) $(GENARCH_OBJECTS) $(GENERIC_OBJECTS) $(EXTRA_OBJECTS) $(EMPTY_MAP)
-else
-	$(LD) $(LFLAGS) -Map $(MAP_PREV) -o $@ $(ARCH_OBJECTS) $(GENARCH_OBJECTS) $(GENERIC_OBJECTS) $(EXTRA_OBJECTS) $(EMPTY_MAP)
-endif
+	$(CC) $(DEFS) $(CFLAGS) $(LDFLAGS) -Wl,-Map,$(MAP_PREV) -o $@ $(ARCH_OBJECTS) $(GENARCH_OBJECTS) $(GENERIC_OBJECTS) $(EXTRA_OBJECTS) $(EMPTY_MAP)
 	$(OBJDUMP) -t $(ARCH_OBJECTS) $(GENARCH_OBJECTS) $(GENERIC_OBJECTS) > $(DUMP)
 	$(GENMAP) $(MAP_PREV) $(DUMP) $@
@@ -423,9 +406,5 @@
 
 	echo "$(AS_PROLOG)""$(SYMTAB_SECTION)"" .incbin \"$@\"" | $(CC) $(CFLAGS) $(AS_CFLAGS) -x assembler -c -o $(SIZEOK_MAP) -
-ifeq ($(CONFIG_LTO),y)
-	$(CC) $(DEFS) $(CFLAGS) $(LD_CFLAGS) -Xlinker -Map -Xlinker $(MAP_PREV) -o $@ $(ARCH_OBJECTS) $(GENARCH_OBJECTS) $(GENERIC_OBJECTS) $(EXTRA_OBJECTS) $(SIZEOK_MAP)
-else
-	$(LD) $(LFLAGS) -Map $(MAP_PREV) -o $@ $(ARCH_OBJECTS) $(GENARCH_OBJECTS) $(GENERIC_OBJECTS) $(EXTRA_OBJECTS) $(SIZEOK_MAP)
-endif
+	$(CC) $(DEFS) $(CFLAGS) $(LDFLAGS) -Wl,-Map,$(MAP_PREV) -o $@ $(ARCH_OBJECTS) $(GENARCH_OBJECTS) $(GENERIC_OBJECTS) $(EXTRA_OBJECTS) $(SIZEOK_MAP)
 	$(OBJDUMP) -t $(ARCH_OBJECTS) $(GENARCH_OBJECTS) $(GENERIC_OBJECTS) > $(DUMP)
 	$(GENMAP) $(MAP_PREV) $(DUMP) $@
Index: kernel/arch/ia64/Makefile.inc
===================================================================
--- kernel/arch/ia64/Makefile.inc	(revision 5261062cfc91ad127782b1d8407ef8fd90afdaae)
+++ kernel/arch/ia64/Makefile.inc	(revision 009c485952250dbca2420fd8ee4fa68ffaf7b9ac)
@@ -33,5 +33,5 @@
 
 AFLAGS += -mconstant-gp
-LFLAGS += -EL
+LDFLAGS += -Wl,-EL
 
 BITS = 64
Index: kernel/arch/ppc32/Makefile.inc
===================================================================
--- kernel/arch/ppc32/Makefile.inc	(revision 5261062cfc91ad127782b1d8407ef8fd90afdaae)
+++ kernel/arch/ppc32/Makefile.inc	(revision 009c485952250dbca2420fd8ee4fa68ffaf7b9ac)
@@ -33,5 +33,5 @@
 COMMON_CFLAGS += -mcpu=powerpc -msoft-float -m32
 AFLAGS += -a32
-LFLAGS += -no-check-sections
+LDFLAGS += -Wl,-no-check-sections
 
 BITS = 32
Index: kernel/arch/sparc64/Makefile.inc
===================================================================
--- kernel/arch/sparc64/Makefile.inc	(revision 5261062cfc91ad127782b1d8407ef8fd90afdaae)
+++ kernel/arch/sparc64/Makefile.inc	(revision 009c485952250dbca2420fd8ee4fa68ffaf7b9ac)
@@ -33,5 +33,5 @@
 COMMON_CFLAGS += -m64 -mcpu=ultrasparc -mcmodel=medlow -mno-fpu
 
-LFLAGS += -no-check-sections
+LDFLAGS += -Wl,-no-check-sections
 
 BITS = 64
Index: tools/xcw/bin/helenos-bld-config
===================================================================
--- tools/xcw/bin/helenos-bld-config	(revision 5261062cfc91ad127782b1d8407ef8fd90afdaae)
+++ tools/xcw/bin/helenos-bld-config	(revision 009c485952250dbca2420fd8ee4fa68ffaf7b9ac)
@@ -47,5 +47,4 @@
 case ".$1" in
 (.--cc) extract_field "CC" "$MAKEFILE_COMMON";;
-(.--ld) extract_field "LD" "$MAKEFILE_COMMON";;
 (.--uarch) extract_field "UARCH" "$MAKEFILE_CONFIG";;
 (.--endian)
Index: ols/xcw/bin/helenos-ld
===================================================================
--- tools/xcw/bin/helenos-ld	(revision 5261062cfc91ad127782b1d8407ef8fd90afdaae)
+++ 	(revision )
@@ -1,43 +1,0 @@
-#!/bin/bash
-#
-# Copyright (c) 2015 Jiri Svoboda
-# 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.
-#
-# Link editor (ld) wrapper
-# HelenOS Cross Compiler Wrapper (XCW)
-# Facilitate cross-compiling external software to HelenOS
-#
-
-XCW="$(dirname "$0")"
-SRC_ROOT="$XCW/../../.."
-UARCH="$("$XCW"/helenos-bld-config --uarch)"
-LD="$("$XCW"/helenos-bld-config --ld)"
-
-echo helenos-ld "$@"
-"$LD" \
-    -n -T "$SRC_ROOT"/uspace/lib/c/arch/"$UARCH"/_link.ld \
-    "$@" \
-    "$SRC_ROOT"/uspace/lib/c/libc.a
Index: tools/xcw/demo/Makefile
===================================================================
--- tools/xcw/demo/Makefile	(revision 5261062cfc91ad127782b1d8407ef8fd90afdaae)
+++ tools/xcw/demo/Makefile	(revision 009c485952250dbca2420fd8ee4fa68ffaf7b9ac)
@@ -43,5 +43,4 @@
 
 CC = helenos-cc
-LD = helenos-ld
 CFLAGS = -std=gnu99 -Wall `helenos-pkg-config --cflags libgui libdraw libmath`
 LIBS = `helenos-pkg-config --libs libgui libdraw libmath`
@@ -56,5 +55,5 @@
 
 $(output): $(objects)
-	$(LD) -o $@ $^ $(LIBS)
+	$(CC) -o $@ $^ $(LIBS)
 
 %.o: %.c
Index: uspace/Makefile.common
===================================================================
--- uspace/Makefile.common	(revision 5261062cfc91ad127782b1d8407ef8fd90afdaae)
+++ uspace/Makefile.common	(revision 009c485952250dbca2420fd8ee4fa68ffaf7b9ac)
@@ -115,5 +115,5 @@
 
 AFLAGS = --fatal-warnings
-LFLAGS = --fatal-warnings --warn-common
+LDFLAGS = -Wl,--fatal-warnings,--warn-common
 
 ifeq ($(STATIC_NEEDED),y)
@@ -141,7 +141,7 @@
 
 ifeq ($(LINK_DYNAMIC),y)
-	LFLAGS += -Bdynamic
 	LINKER_SCRIPT ?= $(LIBC_PREFIX)/arch/$(UARCH)/_link-dlexe.ld
 else
+	LDFLAGS += -static
 	LINKER_SCRIPT ?= $(LIBC_PREFIX)/arch/$(UARCH)/_link.ld
 endif
@@ -245,12 +245,11 @@
 
 ifeq ($(CONFIG_STRIP_BINARIES),y)
-	LFLAGS += --strip-all
+	LDFLAGS += -s
 endif
 
 LIB_CFLAGS = $(CFLAGS) -fPIC
-LIB_LFLAGS = $(LFLAGS) -shared -soname $(LSONAME)
+LIB_LDFLAGS = $(LDFLAGS) -shared -Wl,-soname,$(LSONAME)
 
 AS_CFLAGS := $(addprefix -Xassembler ,$(AFLAGS))
-LD_CFLAGS := $(addprefix -Xlinker ,$(LFLAGS))
 
 OBJECTS := $(addsuffix .o,$(basename $(SOURCES)))
@@ -303,10 +302,10 @@
 ifneq ($(BINARY),)
 $(BINARY): $(LINKER_SCRIPT) $(OBJECTS) $(LIBTAGS) $(BASE_LIBS)
-	$(LD) $(LFLAGS) $(EXTRA_LFLAGS) -T $(LINKER_SCRIPT) -Map $@.map -o $@ $(OBJECTS) $(LIBARGS) $(BASE_LIBS)
+	$(CC) $(CFLAGS) $(LDFLAGS) $(EXTRA_LDFLAGS) -T $(LINKER_SCRIPT) -Wl,-Map,$@.map -o $@ $(OBJECTS) $(LIBARGS) $(BASE_LIBS)
 endif
 
 ifneq ($(TEST_BINARY),)
 $(TEST_BINARY): $(LINKER_SCRIPT) $(TEST_OBJECTS) $(TEST_BINARY_LIBS) $(LIBTAGS) $(BASE_LIBS)
-	$(LD) $(LFLAGS) $(EXTRA_LFLAGS) -T $(LINKER_SCRIPT) -Map $@.map -o $@ $(TEST_OBJECTS) $(TEST_BINARY_LIBS) $(LIBARGS) $(BASE_LIBS)
+	$(CC) $(CFLAGS) $(LDFLAGS) $(EXTRA_LDFLAGS) -T $(LINKER_SCRIPT) -Wl,-Map,$@.map -o $@ $(TEST_OBJECTS) $(TEST_BINARY_LIBS) $(LIBARGS) $(BASE_LIBS)
 endif
 
@@ -325,5 +324,5 @@
 
 $(SLIBRARY): $(LIB_LINKER_SCRIPT) $(LIBRARY).la
-	$(LD) $(LIB_LFLAGS) $(EXTRA_LFLAGS) -T $(LIB_LINKER_SCRIPT) -Map $@.map -o $@ --whole-archive $(LIBRARY).la --no-whole-archive
+	$(CC) $(CFLAGS) $(LIB_LDFLAGS) $(EXTRA_LDFLAGS) -T $(LIB_LINKER_SCRIPT) -Wl,-Map,$@.map -o $@ -Wl,--whole-archive $(LIBRARY).la -Wl,--no-whole-archive
 
 $(LSONAME):
Index: uspace/lib/c/arch/amd64/Makefile.common
===================================================================
--- uspace/lib/c/arch/amd64/Makefile.common	(revision 5261062cfc91ad127782b1d8407ef8fd90afdaae)
+++ uspace/lib/c/arch/amd64/Makefile.common	(revision 009c485952250dbca2420fd8ee4fa68ffaf7b9ac)
@@ -36,5 +36,5 @@
 endif
 
-LFLAGS += --gc-sections
+LDFLAGS += -Wl,--gc-sections
 
 ENDIANESS = LE
Index: uspace/lib/c/arch/arm32/Makefile.common
===================================================================
--- uspace/lib/c/arch/arm32/Makefile.common	(revision 5261062cfc91ad127782b1d8407ef8fd90afdaae)
+++ uspace/lib/c/arch/arm32/Makefile.common	(revision 009c485952250dbca2420fd8ee4fa68ffaf7b9ac)
@@ -31,5 +31,5 @@
 	-march=$(subst _,-,$(PROCESSOR_ARCH))
 
-LFLAGS += --gc-sections
+LDFLAGS += -Wl,--gc-sections
 
 ifeq ($(CONFIG_FPU),y)
Index: uspace/lib/c/arch/ia32/Makefile.common
===================================================================
--- uspace/lib/c/arch/ia32/Makefile.common	(revision 5261062cfc91ad127782b1d8407ef8fd90afdaae)
+++ uspace/lib/c/arch/ia32/Makefile.common	(revision 009c485952250dbca2420fd8ee4fa68ffaf7b9ac)
@@ -34,5 +34,5 @@
 
 COMMON_CFLAGS += -mno-tls-direct-seg-refs -fno-omit-frame-pointer
-LFLAGS += --gc-sections
+LDFLAGS += -Wl,--gc-sections
 
 ENDIANESS = LE
Index: uspace/lib/c/arch/mips32/Makefile.common
===================================================================
--- uspace/lib/c/arch/mips32/Makefile.common	(revision 5261062cfc91ad127782b1d8407ef8fd90afdaae)
+++ uspace/lib/c/arch/mips32/Makefile.common	(revision 009c485952250dbca2420fd8ee4fa68ffaf7b9ac)
@@ -29,5 +29,5 @@
 COMMON_CFLAGS += -msoft-float -mabi=32
 AS_PROLOG = .module softfloat;.abicalls;
-LFLAGS += --gc-sections
+LDFLAGS += -Wl,--gc-sections
 
 ENDIANESS = LE
Index: uspace/lib/c/arch/mips32eb/Makefile.common
===================================================================
--- uspace/lib/c/arch/mips32eb/Makefile.common	(revision 5261062cfc91ad127782b1d8407ef8fd90afdaae)
+++ uspace/lib/c/arch/mips32eb/Makefile.common	(revision 009c485952250dbca2420fd8ee4fa68ffaf7b9ac)
@@ -29,5 +29,5 @@
 COMMON_CFLAGS += -msoft-float -mabi=32
 AS_PROLOG = .module softfloat;.abicalls;
-LFLAGS += --gc-sections
+LDFLAGS += -Wl,--gc-sections
 
 ENDIANESS = BE
Index: uspace/lib/c/arch/ppc32/Makefile.common
===================================================================
--- uspace/lib/c/arch/ppc32/Makefile.common	(revision 5261062cfc91ad127782b1d8407ef8fd90afdaae)
+++ uspace/lib/c/arch/ppc32/Makefile.common	(revision 009c485952250dbca2420fd8ee4fa68ffaf7b9ac)
@@ -35,5 +35,5 @@
 COMMON_CFLAGS += -mcpu=powerpc -m$(FLOATS)-float -m32
 AFLAGS += -a32
-LFLAGS += --gc-sections
+LDFLAGS += -Wl,--gc-sections
 
 ENDIANESS = BE
Index: uspace/lib/c/arch/sparc64/Makefile.common
===================================================================
--- uspace/lib/c/arch/sparc64/Makefile.common	(revision 5261062cfc91ad127782b1d8407ef8fd90afdaae)
+++ uspace/lib/c/arch/sparc64/Makefile.common	(revision 009c485952250dbca2420fd8ee4fa68ffaf7b9ac)
@@ -35,5 +35,5 @@
 COMMON_CFLAGS += -m64 -mcmodel=medlow
 
-LFLAGS += -no-check-sections --gc-sections
+LDFLAGS += -Wl,-no-check-sections,--gc-sections
 
 ENDIANESS = BE
Index: uspace/lib/pcut/Makefile
===================================================================
--- uspace/lib/pcut/Makefile	(revision 5261062cfc91ad127782b1d8407ef8fd90afdaae)
+++ uspace/lib/pcut/Makefile	(revision 009c485952250dbca2420fd8ee4fa68ffaf7b9ac)
@@ -36,4 +36,4 @@
 
 test-libpcut-%: $(LIBRARY).a
-	$(LD) -n $(LFLAGS) -T $(LINKER_SCRIPT) -o $@ $(STARTUP) $^ $(LIBRARY).a $(BASE_LIBS)
+	$(CC) $(CFLAGS) $(LDFLAGS) -T $(LINKER_SCRIPT) -o $@ $(STARTUP) $^ $(LIBRARY).a $(BASE_LIBS)
 
Index: uspace/lib/pcut/update-from-master.sh
===================================================================
--- uspace/lib/pcut/update-from-master.sh	(revision 5261062cfc91ad127782b1d8407ef8fd90afdaae)
+++ uspace/lib/pcut/update-from-master.sh	(revision 009c485952250dbca2420fd8ee4fa68ffaf7b9ac)
@@ -80,5 +80,5 @@
 
 test-libpcut-%: $(LIBRARY).a
-	$(LD) -n $(LFLAGS) -T $(LINKER_SCRIPT) -o $@ $(STARTUP) $^ $(LIBRARY).a $(BASE_LIBS)
+	$(CC) $(CFLAGS) $(LDFLAGS) -T $(LINKER_SCRIPT) -o $@ $(STARTUP) $^ $(LIBRARY).a $(BASE_LIBS)
 
 EOF_MAKEFILE_TAIL
Index: uspace/srv/loader/Makefile
===================================================================
--- uspace/srv/loader/Makefile	(revision 5261062cfc91ad127782b1d8407ef8fd90afdaae)
+++ uspace/srv/loader/Makefile	(revision 009c485952250dbca2420fd8ee4fa68ffaf7b9ac)
@@ -30,5 +30,5 @@
 USPACE_PREFIX = ../..
 
-EXTRA_LFLAGS = -Ttext-segment=0x70000000
+EXTRA_LDFLAGS = -Wl,-Ttext-segment=0x70000000
 
 BINARY = loader
