Index: uspace/srv/bd/rd/Makefile
===================================================================
--- uspace/srv/bd/rd/Makefile	(revision 431d6d6a5bc501f28e40f42930d836850a1b2714)
+++ uspace/srv/bd/rd/Makefile	(revision 2aaf80403cfc5d32059b7711a076f77b1dcfd359)
@@ -30,4 +30,5 @@
 USPACE_PREFIX = ../../..
 BINARY = rd
+STATIC_NEEDED = y
 
 SOURCES = \
Index: uspace/srv/devman/Makefile
===================================================================
--- uspace/srv/devman/Makefile	(revision 431d6d6a5bc501f28e40f42930d836850a1b2714)
+++ uspace/srv/devman/Makefile	(revision 2aaf80403cfc5d32059b7711a076f77b1dcfd359)
@@ -30,4 +30,5 @@
 USPACE_PREFIX = ../..
 BINARY = devman
+STATIC_NEEDED = y
 
 SOURCES = \
Index: uspace/srv/devman/devman.c
===================================================================
--- uspace/srv/devman/devman.c	(revision 431d6d6a5bc501f28e40f42930d836850a1b2714)
+++ uspace/srv/devman/devman.c	(revision 2aaf80403cfc5d32059b7711a076f77b1dcfd359)
@@ -39,4 +39,5 @@
 #include <devmap.h>
 #include <str_error.h>
+#include <stdio.h>
 
 #include "devman.h"
Index: uspace/srv/devmap/Makefile
===================================================================
--- uspace/srv/devmap/Makefile	(revision 431d6d6a5bc501f28e40f42930d836850a1b2714)
+++ uspace/srv/devmap/Makefile	(revision 2aaf80403cfc5d32059b7711a076f77b1dcfd359)
@@ -30,4 +30,5 @@
 USPACE_PREFIX = ../..
 BINARY = devmap
+STATIC_NEEDED = y
 
 SOURCES = \
Index: uspace/srv/fs/devfs/Makefile
===================================================================
--- uspace/srv/fs/devfs/Makefile	(revision 431d6d6a5bc501f28e40f42930d836850a1b2714)
+++ uspace/srv/fs/devfs/Makefile	(revision 2aaf80403cfc5d32059b7711a076f77b1dcfd359)
@@ -32,4 +32,5 @@
 EXTRA_CFLAGS += -I$(LIBFS_PREFIX)
 BINARY = devfs
+STATIC_NEEDED = y
 
 SOURCES = \
Index: uspace/srv/fs/fat/Makefile
===================================================================
--- uspace/srv/fs/fat/Makefile	(revision 431d6d6a5bc501f28e40f42930d836850a1b2714)
+++ uspace/srv/fs/fat/Makefile	(revision 2aaf80403cfc5d32059b7711a076f77b1dcfd359)
@@ -32,4 +32,5 @@
 EXTRA_CFLAGS += -I$(LIBBLOCK_PREFIX) -I$(LIBFS_PREFIX)
 BINARY = fat
+STATIC_NEEDED = y
 
 SOURCES = \
Index: uspace/srv/fs/fat/fat_fat.c
===================================================================
--- uspace/srv/fs/fat/fat_fat.c	(revision 431d6d6a5bc501f28e40f42930d836850a1b2714)
+++ uspace/srv/fs/fat/fat_fat.c	(revision 2aaf80403cfc5d32059b7711a076f77b1dcfd359)
@@ -47,4 +47,5 @@
 #include <assert.h>
 #include <fibril_synch.h>
+#include <malloc.h>
 #include <mem.h>
 
Index: uspace/srv/fs/fat/fat_idx.c
===================================================================
--- uspace/srv/fs/fat/fat_idx.c	(revision 431d6d6a5bc501f28e40f42930d836850a1b2714)
+++ uspace/srv/fs/fat/fat_idx.c	(revision 2aaf80403cfc5d32059b7711a076f77b1dcfd359)
@@ -44,4 +44,5 @@
 #include <assert.h>
 #include <fibril_synch.h>
+#include <malloc.h>
 
 /** Each instance of this type describes one interval of freed VFS indices. */
Index: uspace/srv/fs/fat/fat_ops.c
===================================================================
--- uspace/srv/fs/fat/fat_ops.c	(revision 431d6d6a5bc501f28e40f42930d836850a1b2714)
+++ uspace/srv/fs/fat/fat_ops.c	(revision 2aaf80403cfc5d32059b7711a076f77b1dcfd359)
@@ -55,4 +55,5 @@
 #include <sys/mman.h>
 #include <align.h>
+#include <malloc.h>
 
 #define FAT_NODE(node)	((node) ? (fat_node_t *) (node)->data : NULL)
Index: uspace/srv/fs/tmpfs/Makefile
===================================================================
--- uspace/srv/fs/tmpfs/Makefile	(revision 431d6d6a5bc501f28e40f42930d836850a1b2714)
+++ uspace/srv/fs/tmpfs/Makefile	(revision 2aaf80403cfc5d32059b7711a076f77b1dcfd359)
@@ -32,4 +32,5 @@
 EXTRA_CFLAGS += -I$(LIBBLOCK_PREFIX) -I$(LIBFS_PREFIX)
 BINARY = tmpfs
+STATIC_NEEDED = y
 
 SOURCES = \
Index: uspace/srv/hw/netif/ne2000/dp8390.c
===================================================================
--- uspace/srv/hw/netif/ne2000/dp8390.c	(revision 431d6d6a5bc501f28e40f42930d836850a1b2714)
+++ uspace/srv/hw/netif/ne2000/dp8390.c	(revision 2aaf80403cfc5d32059b7711a076f77b1dcfd359)
@@ -53,4 +53,5 @@
 #include <byteorder.h>
 #include <errno.h>
+#include <stdio.h>
 #include <libarch/ddi.h>
 #include <net/packet.h>
Index: uspace/srv/loader/Makefile
===================================================================
--- uspace/srv/loader/Makefile	(revision 431d6d6a5bc501f28e40f42930d836850a1b2714)
+++ uspace/srv/loader/Makefile	(revision 2aaf80403cfc5d32059b7711a076f77b1dcfd359)
@@ -36,12 +36,11 @@
 -include $(COMMON_MAKEFILE)
 -include $(CONFIG_MAKEFILE)
--include arch/$(UARCH)/Makefile.inc
 
-LINKER_SCRIPT = arch/$(UARCH)/_link.ld
-EXTRA_CLEAN = $(LINKER_SCRIPT)
+LINKER_SCRIPT = $(LIBC_PREFIX)/arch/$(UARCH)/_link-loader.ld
 
 EXTRA_CFLAGS = -Iinclude
 
 BINARY = loader
+STATIC_ONLY = y
 
 GENERIC_SOURCES = \
@@ -55,5 +54,2 @@
 
 include $(USPACE_PREFIX)/Makefile.common
-
-$(LINKER_SCRIPT): $(LINKER_SCRIPT).in
-	$(GCC) $(DEFS) $(CFLAGS) -DLIBC_PREFIX=$(LIBC_PREFIX) -E -x c $< | grep -v "^\#" > $@
Index: uspace/srv/loader/arch/abs32le/Makefile.inc
===================================================================
--- uspace/srv/loader/arch/abs32le/Makefile.inc	(revision 431d6d6a5bc501f28e40f42930d836850a1b2714)
+++ 	(revision )
@@ -1,29 +1,0 @@
-#
-# Copyright (c) 2008 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.
-#
-
-ARCH_SOURCES = arch/$(UARCH)/abs32le.c
Index: uspace/srv/loader/arch/abs32le/_link.ld.in
===================================================================
--- uspace/srv/loader/arch/abs32le/_link.ld.in	(revision 431d6d6a5bc501f28e40f42930d836850a1b2714)
+++ 	(revision )
@@ -1,60 +1,0 @@
-/*
- * The difference from _link.ld.in for regular statically-linked apps
- * is the base address and the special interp section.
- */
-
-STARTUP(LIBC_PREFIX/arch/UARCH/src/entry.o)
-ENTRY(__entry)
-
-PHDRS {
-	interp PT_INTERP;
-	text PT_LOAD FILEHDR PHDRS FLAGS(5);
-	data PT_LOAD FLAGS(6);
-}
-
-SECTIONS {
-	.interp : {
-		*(.interp);
-	} :interp
-	
-	. = 0x70001000;
-	
-	.text : {
-		*(.text .text.*);
-		*(.rodata .rodata.*);
-	} :text
-	
-	.data ALIGN(0x1000) : SUBALIGN(0x1000) {
-		*(.data);
-		*(.data.rel*);
-	} :data
-	
-	.tdata : {
-		_tdata_start = .;
-		*(.tdata);
-		*(.gnu.linkonce.tb.*);
-		_tdata_end = .;
-	} :data
-	
-	.tbss : {
-		_tbss_start = .;
-		*(.tbss);
-		_tbss_end = .;
-	} :data
-	
-	_tls_alignment = MAX(ALIGNOF(.tdata), ALIGNOF(.tbss));
-	
-	.sbss : {
-		*(.scommon);
-		*(.sbss);
-	}
-	
-	.bss : {
-		*(COMMON);
-		*(.bss);
-	} :data
-	
-	/DISCARD/ : {
-		*(*);
-	}
-}
Index: uspace/srv/loader/arch/abs32le/abs32le.c
===================================================================
--- uspace/srv/loader/arch/abs32le/abs32le.c	(revision 431d6d6a5bc501f28e40f42930d836850a1b2714)
+++ 	(revision )
@@ -1,42 +1,0 @@
-/*
- * Copyright (c) 2010 Martin Decky
- * 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.
- */
-
-/** @file
- */
-
-#include <bool.h>
-#include "arch.h"
-
-void program_run(void *entry_point, void *pcb)
-{
-	while (true);
-}
-
-/**
- * @}
- */
Index: uspace/srv/loader/arch/amd64/Makefile.inc
===================================================================
--- uspace/srv/loader/arch/amd64/Makefile.inc	(revision 431d6d6a5bc501f28e40f42930d836850a1b2714)
+++ 	(revision )
@@ -1,29 +1,0 @@
-#
-# Copyright (c) 2008 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.
-#
-
-ARCH_SOURCES = arch/$(UARCH)/amd64.s
Index: uspace/srv/loader/arch/amd64/_link.ld.in
===================================================================
--- uspace/srv/loader/arch/amd64/_link.ld.in	(revision 431d6d6a5bc501f28e40f42930d836850a1b2714)
+++ 	(revision )
@@ -1,72 +1,0 @@
-/*
- * The difference from _link.ld.in for regular statically-linked apps
- * is the base address and the special interp section.
- */
-
-STARTUP(LIBC_PREFIX/arch/UARCH/src/entry.o)
-ENTRY(__entry)
-
-PHDRS {
-	interp PT_INTERP;
-	text PT_LOAD FLAGS(5);
-	data PT_LOAD FLAGS(6);
-	debug PT_NOTE;
-}
-
-SECTIONS {
-	.interp : {
-		*(.interp);
-	} :interp
-	
-	/* . = 0x0000700000001000; */
-	. = 0x70001000;
-	
-	.init ALIGN(0x1000) : SUBALIGN(0x1000) {
-		*(.init);
-	} :text
-	
-	.text : {
-		*(.text .text.*);
-		*(.rodata .rodata.*);
-	} :text
-	
-	.data ALIGN(0x1000) : SUBALIGN(0x1000) {
-		*(.data);
-	} :data
-	
-	.tdata : {
-		_tdata_start = .;
-		*(.tdata);
-		_tdata_end = .;
-	} :data
-	
-	.tbss : {
-		_tbss_start = .;
-		*(.tbss);
-		_tbss_end = .;
-	} :data
-	
-	_tls_alignment = MAX(ALIGNOF(.tdata), ALIGNOF(.tbss));
-	
-	.bss : {
-		*(COMMON);
-		*(.bss);
-	} :data
-	
-#ifdef CONFIG_LINE_DEBUG
-	.comment 0 : { *(.comment); } :debug
-	.debug_abbrev 0 : { *(.debug_abbrev); } :debug
-	.debug_aranges 0 : { *(.debug_aranges); } :debug
-	.debug_info 0 : { *(.debug_info); } :debug
-	.debug_line 0 : { *(.debug_line); } :debug
-	.debug_loc 0 : { *(.debug_loc); } :debug
-	.debug_pubnames 0 : { *(.debug_pubnames); } :debug
-	.debug_pubtypes 0 : { *(.debug_pubtypes); } :debug
-	.debug_ranges 0 : { *(.debug_ranges); } :debug
-	.debug_str 0 : { *(.debug_str); } :debug
-#endif
-	
-	/DISCARD/ : {
-		*(*);
-	}
-}
Index: uspace/srv/loader/arch/amd64/amd64.s
===================================================================
--- uspace/srv/loader/arch/amd64/amd64.s	(revision 431d6d6a5bc501f28e40f42930d836850a1b2714)
+++ 	(revision )
@@ -1,43 +1,0 @@
-#
-# Copyright (c) 2008 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.
-#
-
-.globl program_run
-
-## void program_run(void *entry_point, void *pcb);
-#
-# %rdi	contains entry_point
-# %rsi	contains pcb
-#
-# Jump to a program entry point
-program_run:
-	# pcb must be passed in %rdi, use %rdx as a scratch register
-	mov %rdi, %rdx
-	mov %rsi, %rdi
-
-	# jump to entry point
-	jmp %rdx
Index: uspace/srv/loader/arch/arm32/Makefile.inc
===================================================================
--- uspace/srv/loader/arch/arm32/Makefile.inc	(revision 431d6d6a5bc501f28e40f42930d836850a1b2714)
+++ 	(revision )
@@ -1,29 +1,0 @@
-#
-# Copyright (c) 2008 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.
-#
-
-ARCH_SOURCES = arch/$(UARCH)/arm32.s
Index: uspace/srv/loader/arch/arm32/_link.ld.in
===================================================================
--- uspace/srv/loader/arch/arm32/_link.ld.in	(revision 431d6d6a5bc501f28e40f42930d836850a1b2714)
+++ 	(revision )
@@ -1,61 +1,0 @@
-/*
- * The only difference from _link.ld.in for regular statically-linked apps
- * is the base address.
- */
-
-STARTUP(LIBC_PREFIX/arch/UARCH/src/entry.o)
-ENTRY(__entry)
-
-PHDRS {
-	interp PT_INTERP;
-	text PT_LOAD FLAGS(5);
-	data PT_LOAD FLAGS(6);
-}
-
-SECTIONS {
-	.interp : {
-		*(.interp);
-	} : interp
-	
-	. = 0x70001000;
-	
-	.init ALIGN(0x1000): SUBALIGN(0x1000) {
-		*(.init);
-	} :text
-	
-	.text : {
-		*(.text .text.*);
-		*(.rodata .rodata.*);
-	} :text
-	
-	.data ALIGN(0x1000) : SUBALIGN(0x1000) {
-		*(.opd);
-		*(.data .data.*);
-		*(.sdata);
-	} :data
-	
-	.tdata : {
-		_tdata_start = .;
-		*(.tdata);
-		_tdata_end = .;
-	} :data
-	
-	.tbss : {
-		_tbss_start = .;
-		*(.tbss);
-		_tbss_end = .;
-	} :data
-	
-	_tls_alignment = MAX(ALIGNOF(.tdata), ALIGNOF(.tbss));
-	
-	.bss : {
-		*(.sbss);
-		*(.scommon);
-		*(COMMON);
-		*(.bss);
-	} :data
-	
-	/DISCARD/ : {
-		*(*);
-	}
-}
Index: uspace/srv/loader/arch/arm32/arm32.s
===================================================================
--- uspace/srv/loader/arch/arm32/arm32.s	(revision 431d6d6a5bc501f28e40f42930d836850a1b2714)
+++ 	(revision )
@@ -1,42 +1,0 @@
-#
-# Copyright (c) 2008 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.
-#
-
-.globl program_run
-
-## void program_run(void *entry_point, void *pcb);
-#
-# r0	contains entry_point
-# r1	contains pcb
-#
-# Jump to a program entry point
-program_run:
-	# load ras_page address to r2
-	ldr r2, =ras_page
-	ldr r2, [r2]
-	# pcb is passed to the entry point in r1 (where it already is)
-	mov r15, r0
Index: uspace/srv/loader/arch/ia32/Makefile.inc
===================================================================
--- uspace/srv/loader/arch/ia32/Makefile.inc	(revision 431d6d6a5bc501f28e40f42930d836850a1b2714)
+++ 	(revision )
@@ -1,29 +1,0 @@
-#
-# Copyright (c) 2008 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.
-#
-
-ARCH_SOURCES = arch/$(UARCH)/ia32.s
Index: uspace/srv/loader/arch/ia32/_link.ld.in
===================================================================
--- uspace/srv/loader/arch/ia32/_link.ld.in	(revision 431d6d6a5bc501f28e40f42930d836850a1b2714)
+++ 	(revision )
@@ -1,72 +1,0 @@
-/*
- * The difference from _link.ld.in for regular statically-linked apps
- * is the base address and the special interp section.
- */
-
-STARTUP(LIBC_PREFIX/arch/UARCH/src/entry.o)
-ENTRY(__entry)
-
-PHDRS {
-	interp PT_INTERP;
-	text PT_LOAD FILEHDR PHDRS FLAGS(5);
-	data PT_LOAD FLAGS(6);
-	debug PT_NOTE;
-}
-
-SECTIONS {
-	.interp : {
-		*(.interp);
-	} :interp
-	
-	. = 0x70001000;
-	
-	.init ALIGN(0x1000) : SUBALIGN(0x1000) {
-		*(.init);
-	} :text
-	
-	.text : {
-		*(.text .text.*);
-		*(.rodata .rodata.*);
-	} :text
-	
-	.data ALIGN(0x1000) : SUBALIGN(0x1000) {
-		*(.data);
-	} :data
-	
-	.tdata : {
-		_tdata_start = .;
-		*(.tdata);
-		*(.gnu.linkonce.tb.*);
-		_tdata_end = .;
-	} :data
-	
-	.tbss : {
-		_tbss_start = .;
-		*(.tbss);
-		_tbss_end = .;
-	} :data
-	
-	_tls_alignment = MAX(ALIGNOF(.tdata), ALIGNOF(.tbss));
-	
-	.bss : {
-		*(COMMON);
-		*(.bss);
-	} :data
-	
-#ifdef CONFIG_LINE_DEBUG
-	.comment 0 : { *(.comment); } :debug
-	.debug_abbrev 0 : { *(.debug_abbrev); } :debug
-	.debug_aranges 0 : { *(.debug_aranges); } :debug
-	.debug_info 0 : { *(.debug_info); } :debug
-	.debug_line 0 : { *(.debug_line); } :debug
-	.debug_loc 0 : { *(.debug_loc); } :debug
-	.debug_pubnames 0 : { *(.debug_pubnames); } :debug
-	.debug_pubtypes 0 : { *(.debug_pubtypes); } :debug
-	.debug_ranges 0 : { *(.debug_ranges); } :debug
-	.debug_str 0 : { *(.debug_str); } :debug
-#endif
-	
-	/DISCARD/ : {
-		*(*);
-	}
-}
Index: uspace/srv/loader/arch/ia32/ia32.s
===================================================================
--- uspace/srv/loader/arch/ia32/ia32.s	(revision 431d6d6a5bc501f28e40f42930d836850a1b2714)
+++ 	(revision )
@@ -1,49 +1,0 @@
-#
-# Copyright (c) 2008 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.
-#
-
-.globl program_run
-
-## void program_run(void *entry_point, void *pcb);
-#
-# Jump to a program entry point
-program_run:
-	# Use standard ia32 prologue not to confuse anybody
-	push %ebp
-	movl %esp, %ebp
-
-	# %eax := entry_point
-	movl 0x8(%ebp), %eax
-
-	# %edi := pcb
-	# pcb is passed to the entry point in %edi
-	mov 0xc(%ebp), %edi
-
-	# Save a tiny bit of stack space
-	pop %ebp
-
-	jmp *%eax
Index: uspace/srv/loader/arch/ia64/Makefile.inc
===================================================================
--- uspace/srv/loader/arch/ia64/Makefile.inc	(revision 431d6d6a5bc501f28e40f42930d836850a1b2714)
+++ 	(revision )
@@ -1,30 +1,0 @@
-#
-# Copyright (c) 2008 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.
-#
-
-ARCH_SOURCES = arch/$(UARCH)/ia64.s
-AFLAGS += -xexplicit
Index: uspace/srv/loader/arch/ia64/_link.ld.in
===================================================================
--- uspace/srv/loader/arch/ia64/_link.ld.in	(revision 431d6d6a5bc501f28e40f42930d836850a1b2714)
+++ 	(revision )
@@ -1,64 +1,0 @@
-STARTUP(LIBC_PREFIX/arch/UARCH/src/entry.o)
-ENTRY(__entry)
-
-PHDRS {
-	interp PT_INTERP;
-	text PT_LOAD FLAGS(5);
-	data PT_LOAD FLAGS(6);
-}
-
-SECTIONS {
-	.interp : {
-		*(.interp);
-	} :interp
-	
-	/* On Itanium code sections must be aligned to 16 bytes. */
-	. = ALIGN(0x800000000 + SIZEOF_HEADERS, 16);
-	
-	.init : {
-		*(.init);
-	} :text
-	
-	.text : {
-		*(.text .text.*);
-		*(.rodata .rodata.*);
-	} :text
-	
-	. = . + 0x4000;
-	
-	.got : {
-		_gp = .;
-		*(.got .got.*);
-	} :data
-	
-	.data : {
-		*(.opd);
-		*(.data .data.*);
-		*(.sdata);
-	} :data
-	
-	.tdata : {
-		_tdata_start = .;
-		*(.tdata);
-		_tdata_end = .;
-	} :data
-	
-	.tbss : {
-		_tbss_start = .;
-		*(.tbss);
-		_tbss_end = .;
-	} :data
-	
-	_tls_alignment = MAX(ALIGNOF(.tdata), ALIGNOF(.tbss));
-	
-	.bss : {
-		*(.sbss);
-		*(.scommon);
-		*(COMMON);
-		*(.bss);
-	} :data
-	
-	/DISCARD/ : {
-		*(*);
-	}
-}
Index: uspace/srv/loader/arch/ia64/ia64.s
===================================================================
--- uspace/srv/loader/arch/ia64/ia64.s	(revision 431d6d6a5bc501f28e40f42930d836850a1b2714)
+++ 	(revision )
@@ -1,43 +1,0 @@
-#
-# Copyright (c) 2008 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.
-#
-
-.text
-.globl program_run
-
-## void program_run(void *entry_point, void *pcb);
-#
-# in0 (r32)	contains entry_point
-# in1 (r33)	contains pcb
-#
-# Jump to a program entry point
-program_run:
-	# Pass pcb to the entry point in r2
-
-	mov b6 = r32
-	mov r2 = r33 ;;
-	br b6 ;;
Index: uspace/srv/loader/arch/mips32/Makefile.inc
===================================================================
--- uspace/srv/loader/arch/mips32/Makefile.inc	(revision 431d6d6a5bc501f28e40f42930d836850a1b2714)
+++ 	(revision )
@@ -1,29 +1,0 @@
-#
-# Copyright (c) 2008 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.
-#
-
-ARCH_SOURCES = arch/$(UARCH)/mips32.s
Index: uspace/srv/loader/arch/mips32/_link.ld.in
===================================================================
--- uspace/srv/loader/arch/mips32/_link.ld.in	(revision 431d6d6a5bc501f28e40f42930d836850a1b2714)
+++ 	(revision )
@@ -1,70 +1,0 @@
-/*
- * The only difference from _link.ld.in for regular statically-linked apps
- * is the base address.
- */
-
-STARTUP(LIBC_PREFIX/arch/UARCH/src/entry.o)
-ENTRY(__entry)
-
-PHDRS {
-	interp PT_INTERP;
-	text PT_LOAD FLAGS(5);
-	data PT_LOAD FLAGS(6);
-}
-
-SECTIONS {
-	.interp : {
-		*(.interp);
-	} :interp
-	
-	. = 0x70004000;
-	
-	.init ALIGN(0x4000) : SUBALIGN(0x4000) {
-		*(.init);
-	} :text
-	
-	.text : {
-		*(.text .text.*);
-		*(.rodata .rodata.*);
-	} :text
-	
-	. = . + 0x4000;
-	
-	.data : {
-		*(.data);
-		*(.data.rel*);
-	} :data
-	
-	.got : {
-		_gp = .;
-		*(.got);
-	} :data
-	
-	.tdata : {
-		_tdata_start = .;
-		*(.tdata);
-		_tdata_end = .;
-	} :data
-	
-	.tbss : {
-		_tbss_start = .;
-		*(.tbss);
-		_tbss_end = .;
-	} :data
-	
-	_tls_alignment = MAX(ALIGNOF(.tdata), ALIGNOF(.tbss));
-	
-	.sbss : {
-		*(.scommon);
-		*(.sbss);
-	}
-	
-	.bss : {
-		*(.bss);
-		*(COMMON);
-	} :data
-	
-	/DISCARD/ : {
-		*(*);
-	}
-}
Index: uspace/srv/loader/arch/mips32/mips32.s
===================================================================
--- uspace/srv/loader/arch/mips32/mips32.s	(revision 431d6d6a5bc501f28e40f42930d836850a1b2714)
+++ 	(revision )
@@ -1,49 +1,0 @@
-#
-# Copyright (c) 2008 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.
-#
-
-.text
-.section .text
-.global program_run
-.set noreorder
-
-## void program_run(void *entry_point, void *pcb);
-#
-# $a0 (=$4)	contains entry_point
-# $a1 (=$5)	contains pcb
-#
-# Jump to a program entry point
-.ent program_run
-program_run:
-	# tmp := entry_point
-	move $25, $a0
-
-	# Pass pcb to the entry point in $a0
-	move $a0, $a1
-	jr $25
-	nop
-.end
Index: uspace/srv/loader/arch/mips32eb
===================================================================
--- uspace/srv/loader/arch/mips32eb	(revision 431d6d6a5bc501f28e40f42930d836850a1b2714)
+++ 	(revision )
@@ -1,1 +1,0 @@
-mips32
Index: uspace/srv/loader/arch/ppc32/Makefile.inc
===================================================================
--- uspace/srv/loader/arch/ppc32/Makefile.inc	(revision 431d6d6a5bc501f28e40f42930d836850a1b2714)
+++ 	(revision )
@@ -1,29 +1,0 @@
-#
-# Copyright (c) 2008 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.
-#
-
-ARCH_SOURCES = arch/$(UARCH)/ppc32.s
Index: uspace/srv/loader/arch/ppc32/_link.ld.in
===================================================================
--- uspace/srv/loader/arch/ppc32/_link.ld.in	(revision 431d6d6a5bc501f28e40f42930d836850a1b2714)
+++ 	(revision )
@@ -1,59 +1,0 @@
-/*
- * The only difference from _link.ld.in for regular statically-linked apps
- * is the base address.
- */
-
-STARTUP(LIBC_PREFIX/arch/UARCH/src/entry.o)
-ENTRY(__entry)
-
-PHDRS {
-	interp PT_INTERP;
-	text PT_LOAD FLAGS(5);
-	data PT_LOAD FLAGS(6);
-}
-
-SECTIONS {
-	.interp : {
-		*(.interp);
-	} :interp
-	
-	. = 0x70001000;
-	
-	.init ALIGN(0x1000) : SUBALIGN(0x1000) {
-		*(.init);
-	} :text
-	
-	.text : {
-		*(.text .text.*);
-		*(.rodata .rodata.*);
-	} :text
-	
-	.data ALIGN(0x1000) : SUBALIGN(0x1000) {
-		*(.data);
-		*(.sdata);
-	} :data
-	
-	.tdata : {
-		_tdata_start = .;
-		*(.tdata);
-		_tdata_end = .;
-	} :data
-	
-	.tbss : {
-		_tbss_start = .;
-		*(.tbss);
-		_tbss_end = .;
-	} :data
-	
-	_tls_alignment = MAX(ALIGNOF(.tdata), ALIGNOF(.tbss));
-	
-	.bss : {
-		*(.sbss);
-		*(COMMON);
-		*(.bss);
-	} :data
-	
-	/DISCARD/ : {
-		*(*);
-	}
-}
Index: uspace/srv/loader/arch/ppc32/ppc32.s
===================================================================
--- uspace/srv/loader/arch/ppc32/ppc32.s	(revision 431d6d6a5bc501f28e40f42930d836850a1b2714)
+++ 	(revision )
@@ -1,40 +1,0 @@
-#
-# Copyright (c) 2008 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.
-#
-
-.globl program_run
-
-## void program_run(void *entry_point, void *pcb);
-#
-# %r3	contains entry_point
-# %r4	contains pcb
-#
-# Jump to a program entry point
-program_run:
-	mtctr %r3
-	mr %r6, %r4	# Pass pcb to the entry point in %r6
-	bctr
Index: uspace/srv/loader/arch/sparc64/Makefile.inc
===================================================================
--- uspace/srv/loader/arch/sparc64/Makefile.inc	(revision 431d6d6a5bc501f28e40f42930d836850a1b2714)
+++ 	(revision )
@@ -1,29 +1,0 @@
-#
-# Copyright (c) 2008 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.
-#
-
-ARCH_SOURCES = arch/$(UARCH)/sparc64.s
Index: uspace/srv/loader/arch/sparc64/_link.ld.in
===================================================================
--- uspace/srv/loader/arch/sparc64/_link.ld.in	(revision 431d6d6a5bc501f28e40f42930d836850a1b2714)
+++ 	(revision )
@@ -1,61 +1,0 @@
-STARTUP(LIBC_PREFIX/arch/UARCH/src/entry.o)
-ENTRY(__entry)
-
-PHDRS {
-	interp PT_INTERP;
-	text PT_LOAD FLAGS(5);
-	data PT_LOAD FLAGS(6);
-}
-
-SECTIONS {
-	.interp : {
-		*(.interp);
-	} :interp
-	
-	. = 0x70004000 + SIZEOF_HEADERS;
-	
-	.init : {
-		*(.init);
-	} :text
-	
-	.text : {
-		*(.text .text.*);
-		*(.rodata .rodata.*);
-	} :text
-	
-	. = . + 0x4000;
-	
-	.got : {
-		 _gp = .;
-		 *(.got*);
-	} :data
-	
-	.data : {
-		*(.data);
-		*(.sdata);
-	} :data
-	
-	.tdata : {
-		_tdata_start = .;
-		*(.tdata);
-		_tdata_end = .;
-	} :data
-	
-	.tbss : {
-		_tbss_start = .;
-		*(.tbss);
-		_tbss_end = .;
-	} :data
-	
-	_tls_alignment = MAX(ALIGNOF(.tdata), ALIGNOF(.tbss));
-	
-	.bss : {
-		*(.sbss);
-		*(COMMON);
-		*(.bss);
-	} :data
-	
-	/DISCARD/ : {
-		*(*);
-	}
-}
Index: uspace/srv/loader/arch/sparc64/sparc64.s
===================================================================
--- uspace/srv/loader/arch/sparc64/sparc64.s	(revision 431d6d6a5bc501f28e40f42930d836850a1b2714)
+++ 	(revision )
@@ -1,42 +1,0 @@
-#
-# Copyright (c) 2008 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.
-#
-
-.globl program_run
-
-## void program_run(void *entry_point, void *pcb);
-#
-# %o0	contains entry_point
-# %o1	contains pcb
-#
-# Jump to a program entry point
-program_run:
-	# Pass pcb pointer to entry point in %o1. As it is already
-	# there, no action is needed.
-	call %o0
-	nop
-	# fixme: use branch instead of call
Index: uspace/srv/loader/elf_load.c
===================================================================
--- uspace/srv/loader/elf_load.c	(revision 431d6d6a5bc501f28e40f42930d836850a1b2714)
+++ uspace/srv/loader/elf_load.c	(revision 2aaf80403cfc5d32059b7711a076f77b1dcfd359)
@@ -2,5 +2,5 @@
  * Copyright (c) 2006 Sergey Bondari
  * Copyright (c) 2006 Jakub Jermar
- * Copyright (c) 2008 Jiri Svoboda
+ * Copyright (c) 2011 Jiri Svoboda
  * All rights reserved.
  *
@@ -53,8 +53,8 @@
 #include <smc.h>
 #include <loader/pcb.h>
+#include <entry_point.h>
 
 #include "elf.h"
 #include "elf_load.h"
-#include "arch.h"
 
 #define DPRINTF(...)
@@ -103,5 +103,6 @@
  *
  */
-int elf_load_file(const char *file_name, size_t so_bias, elf_info_t *info)
+int elf_load_file(const char *file_name, size_t so_bias, eld_flags_t flags,
+    elf_info_t *info)
 {
 	elf_ld_t elf;
@@ -118,4 +119,5 @@
 	elf.fd = fd;
 	elf.info = info;
+	elf.flags = flags;
 
 	rc = elf_load(&elf, so_bias);
@@ -124,19 +126,4 @@
 
 	return rc;
-}
-
-/** Run an ELF executable.
- *
- * Transfers control to the entry point of an ELF executable loaded
- * earlier with elf_load_file(). This function does not return.
- *
- * @param info Info structure filled earlier by elf_load_file()
- *
- */
-void elf_run(elf_info_t *info, pcb_t *pcb)
-{
-	program_run(info->entry, pcb);
-
-	/* not reached */
 }
 
@@ -153,4 +140,5 @@
 	pcb->entry = info->entry;
 	pcb->dynamic = info->dynamic;
+	pcb->rtld_runtime = NULL;
 }
 
@@ -306,11 +294,20 @@
 		break;
 	case PT_INTERP:
-		/* Assume silently interp == "/rtld.so" */
-		elf->info->interp = "/rtld.so";
+		/* Assume silently interp == "/app/dload" */
+		elf->info->interp = "/app/dload";
 		break;
 	case PT_DYNAMIC:
+		/* Record pointer to dynamic section into info structure */
+		elf->info->dynamic =
+		    (void *)((uint8_t *)entry->p_vaddr + elf->bias);
+		DPRINTF("dynamic section found at 0x%x\n",
+			(uintptr_t)elf->info->dynamic);
+		break;
+	case 0x70000000:
+		/* FIXME: MIPS reginfo */
+		break;
 	case PT_SHLIB:
-	case PT_LOPROC:
-	case PT_HIPROC:
+//	case PT_LOPROC:
+//	case PT_HIPROC:
 	default:
 		DPRINTF("Segment p_type %d unknown.\n", entry->p_type);
@@ -383,5 +380,6 @@
 	    AS_AREA_READ | AS_AREA_WRITE | AS_AREA_CACHEABLE);
 	if (a == (void *)(-1)) {
-		DPRINTF("Memory mapping failed.\n");
+		DPRINTF("memory mapping failed (0x%x, %d)\n",
+			base+bias, mem_sz);
 		return EE_MEMORY;
 	}
@@ -425,4 +423,11 @@
 	}
 
+	/*
+	 * The caller wants to modify the segments first. He will then
+	 * need to set the right access mode and ensure SMC coherence.
+	 */
+	if ((elf->flags & ELDF_RW) != 0) return EE_OK;
+
+//	printf("set area flags to %d\n", flags);
 	rc = as_area_change_flags(seg_ptr, flags);
 	if (rc != 0) {
Index: uspace/srv/loader/include/arch.h
===================================================================
--- uspace/srv/loader/include/arch.h	(revision 431d6d6a5bc501f28e40f42930d836850a1b2714)
+++ 	(revision )
@@ -1,45 +1,0 @@
-/*
- * Copyright (c) 2008 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.
- */
-
-/** @addtogroup fs
- * @{
- */
-/** @file
- * @brief
- */
-
-#ifndef LOADER_ARCH_H_
-#define LOADER_ARCH_H_
-
-extern void program_run(void *entry_point, void *pcb);
-
-#endif
-
-/**
- * @}
- */
Index: uspace/srv/loader/include/elf_load.h
===================================================================
--- uspace/srv/loader/include/elf_load.h	(revision 431d6d6a5bc501f28e40f42930d836850a1b2714)
+++ uspace/srv/loader/include/elf_load.h	(revision 2aaf80403cfc5d32059b7711a076f77b1dcfd359)
@@ -43,4 +43,9 @@
 #include "elf.h"
 
+typedef enum {
+	/** Leave all segments in RW access mode. */
+	ELDF_RW = 1
+} eld_flags_t;
+
 /**
  * Some data extracted from the headers are stored here
@@ -67,4 +72,7 @@
 	uintptr_t bias;
 
+	/** Flags passed to the ELF loader. */
+	eld_flags_t flags;
+
 	/** A copy of the ELF file header */
 	elf_header_t *header;
@@ -74,6 +82,6 @@
 } elf_ld_t;
 
-int elf_load_file(const char *file_name, size_t so_bias, elf_info_t *info);
-void elf_run(elf_info_t *info, pcb_t *pcb);
+int elf_load_file(const char *file_name, size_t so_bias, eld_flags_t flags,
+    elf_info_t *info);
 void elf_create_pcb(elf_info_t *info, pcb_t *pcb);
 
Index: uspace/srv/loader/main.c
===================================================================
--- uspace/srv/loader/main.c	(revision 431d6d6a5bc501f28e40f42930d836850a1b2714)
+++ uspace/srv/loader/main.c	(revision 2aaf80403cfc5d32059b7711a076f77b1dcfd359)
@@ -55,4 +55,5 @@
 #include <macros.h>
 #include <loader/pcb.h>
+#include <entry_point.h>
 #include <errno.h>
 #include <async.h>
@@ -62,4 +63,12 @@
 #include <elf.h>
 #include <elf_load.h>
+
+#ifdef CONFIG_RTLD
+#include <rtld/rtld.h>
+#include <rtld/dynamic.h>
+#include <rtld/module.h>
+
+static int ldr_load_dyn_linked(elf_info_t *p_info);
+#endif
 
 #define DPRINTF(...)
@@ -89,10 +98,13 @@
 
 static elf_info_t prog_info;
-static elf_info_t interp_info;
-
-static bool is_dyn_linked;
 
 /** Used to limit number of connections to one. */
 static bool connected = false;
+
+#ifdef CONFIG_RTLD
+/** State structure of the dynamic linker. */
+runtime_env_t dload_re;
+static module_t prog_mod;
+#endif
 
 static void ldr_get_taskid(ipc_callid_t rid, ipc_call_t *request)
@@ -283,5 +295,5 @@
 	int rc;
 	
-	rc = elf_load_file(pathname, 0, &prog_info);
+	rc = elf_load_file(pathname, 0, 0, &prog_info);
 	if (rc != EE_OK) {
 		DPRINTF("Failed to load executable '%s'.\n", pathname);
@@ -302,23 +314,70 @@
 	if (prog_info.interp == NULL) {
 		/* Statically linked program */
-		is_dyn_linked = false;
 		async_answer_0(rid, EOK);
 		return 0;
 	}
 	
-	rc = elf_load_file(prog_info.interp, 0, &interp_info);
-	if (rc != EE_OK) {
-		DPRINTF("Failed to load interpreter '%s.'\n",
-		    prog_info.interp);
-		async_answer_0(rid, EINVAL);
-		return 1;
-	}
-	
-	is_dyn_linked = true;
-	async_answer_0(rid, EOK);
-	
+	DPRINTF("Binary is dynamically linked.\n");
+#ifdef CONFIG_RTLD
+	DPRINTF(" - pcb address: %p\n", &pcb);
+	DPRINTF( "- prog dynamic: %p\n", prog_info.dynamic);
+
+	rc = ldr_load_dyn_linked(&prog_info);
+#else
+	rc = ENOTSUP;
+#endif
+	async_answer_0(rid, rc);
 	return 0;
 }
 
+#ifdef CONFIG_RTLD
+
+static int ldr_load_dyn_linked(elf_info_t *p_info)
+{
+	runtime_env = &dload_re;
+
+	DPRINTF("Load dynamically linked program.\n");
+
+	/*
+	 * First we need to process dynamic sections of the executable
+	 * program and insert it into the module graph.
+	 */
+
+	DPRINTF("Parse program .dynamic section at %p\n", p_info->dynamic);
+	dynamic_parse(p_info->dynamic, 0, &prog_mod.dyn);
+	prog_mod.bias = 0;
+	prog_mod.dyn.soname = "[program]";
+
+	/* Initialize list of loaded modules */
+	list_initialize(&runtime_env->modules_head);
+	list_append(&prog_mod.modules_link, &runtime_env->modules_head);
+
+	/* Pointer to program module. Used as root of the module graph. */
+	runtime_env->program = &prog_mod;
+
+	/* Work around non-existent memory space allocation. */
+	runtime_env->next_bias = 0x1000000;
+
+	/*
+	 * Now we can continue with loading all other modules.
+	 */
+
+	DPRINTF("Load all program dependencies\n");
+	module_load_deps(&prog_mod);
+
+	/*
+	 * Now relocate/link all modules together.
+	 */
+
+	/* Process relocations in all modules */
+	DPRINTF("Relocate all modules\n");
+	modules_process_relocs(&prog_mod);
+
+	/* Pass runtime evironment pointer through PCB. */
+	pcb.rtld_runtime = (void *) runtime_env;
+
+	return 0;
+}
+#endif
 
 /** Run the previously loaded program.
@@ -332,4 +391,6 @@
 	const char *cp;
 	
+	DPRINTF("Set task name\n");
+
 	/* Set the task name. */
 	cp = str_rchr(pathname, '/');
@@ -337,16 +398,9 @@
 	task_set_name(cp);
 	
-	if (is_dyn_linked == true) {
-		/* Dynamically linked program */
-		DPRINTF("Run ELF interpreter.\n");
-		DPRINTF("Entry point: %p\n", interp_info.entry);
-		
-		async_answer_0(rid, EOK);
-		elf_run(&interp_info, &pcb);
-	} else {
-		/* Statically linked program */
-		async_answer_0(rid, EOK);
-		elf_run(&prog_info, &pcb);
-	}
+	/* Run program */
+	DPRINTF("Reply OK\n");
+	async_answer_0(rid, EOK);
+	DPRINTF("Jump to entry point at %p\n", pcb.entry);
+	entry_point_jmp(prog_info.entry, &pcb);
 	
 	/* Not reached */
Index: uspace/srv/net/tl/icmp/Makefile
===================================================================
--- uspace/srv/net/tl/icmp/Makefile	(revision 431d6d6a5bc501f28e40f42930d836850a1b2714)
+++ uspace/srv/net/tl/icmp/Makefile	(revision 2aaf80403cfc5d32059b7711a076f77b1dcfd359)
@@ -32,4 +32,5 @@
 EXTRA_CFLAGS = -I$(LIBNET_PREFIX)/include
 BINARY = icmp
+STATIC_ONLY = y
 
 SOURCES = \
Index: uspace/srv/ns/Makefile
===================================================================
--- uspace/srv/ns/Makefile	(revision 431d6d6a5bc501f28e40f42930d836850a1b2714)
+++ uspace/srv/ns/Makefile	(revision 2aaf80403cfc5d32059b7711a076f77b1dcfd359)
@@ -30,4 +30,5 @@
 USPACE_PREFIX = ../..
 BINARY = ns
+STATIC_NEEDED = y
 
 SOURCES = \
Index: uspace/srv/ns/clonable.c
===================================================================
--- uspace/srv/ns/clonable.c	(revision 431d6d6a5bc501f28e40f42930d836850a1b2714)
+++ uspace/srv/ns/clonable.c	(revision 2aaf80403cfc5d32059b7711a076f77b1dcfd359)
@@ -78,5 +78,5 @@
 	if (list_empty(&cs_req)) {
 		/* There was no pending connection request. */
-		printf(NAME ": Unexpected clonable server.\n");
+		printf("%s: Unexpected clonable server.\n", NAME);
 		ipc_answer_0(callid, EBUSY);
 		return;
Index: uspace/srv/ns/service.c
===================================================================
--- uspace/srv/ns/service.c	(revision 431d6d6a5bc501f28e40f42930d836850a1b2714)
+++ uspace/srv/ns/service.c	(revision 2aaf80403cfc5d32059b7711a076f77b1dcfd359)
@@ -35,4 +35,6 @@
 #include <assert.h>
 #include <errno.h>
+#include <stdio.h>
+#include <malloc.h>
 #include "service.h"
 #include "ns.h"
Index: uspace/srv/ns/task.c
===================================================================
--- uspace/srv/ns/task.c	(revision 431d6d6a5bc501f28e40f42930d836850a1b2714)
+++ uspace/srv/ns/task.c	(revision 2aaf80403cfc5d32059b7711a076f77b1dcfd359)
@@ -39,4 +39,5 @@
 #include <stdio.h>
 #include <macros.h>
+#include <malloc.h>
 #include "task.h"
 #include "ns.h"
Index: uspace/srv/vfs/Makefile
===================================================================
--- uspace/srv/vfs/Makefile	(revision 431d6d6a5bc501f28e40f42930d836850a1b2714)
+++ uspace/srv/vfs/Makefile	(revision 2aaf80403cfc5d32059b7711a076f77b1dcfd359)
@@ -30,4 +30,5 @@
 USPACE_PREFIX = ../..
 BINARY = vfs
+STATIC_NEEDED = y
 
 SOURCES = \
