Index: uspace/Makefile.common
===================================================================
--- uspace/Makefile.common	(revision 5d4763bf9f73f33ab7140013e61f50715ed3fbc9)
+++ uspace/Makefile.common	(revision 54146a0e4e89ae79bdb89d2cd48c51829a471c3d)
@@ -47,4 +47,6 @@
 #   STATIC_NEEDED      set to 'y' for init binaries, will build statically
 #                      linked version
+#   STATIC_ONLY        set to 'y' if binary cannot be linked dynamically
+#                      (e.g. uses thread-local variables)
 #
 # Optionally, for a libary:
@@ -113,8 +115,12 @@
 	STATIC_BUILD = y
 else
-	ifeq ($(CONFIG_USE_SHARED_LIBS), y)
-		STATIC_BUILD = n
+	ifeq ($(STATIC_ONLY),y)
+		STATIC_BUILD = y
 	else
-		STATIC_BUILD = y
+		ifeq ($(CONFIG_USE_SHARED_LIBS), y)
+			STATIC_BUILD = n
+		else
+			STATIC_BUILD = y
+		endif
 	endif
 endif
Index: uspace/lib/c/arch/ia32/_link.ld.in
===================================================================
--- uspace/lib/c/arch/ia32/_link.ld.in	(revision 5d4763bf9f73f33ab7140013e61f50715ed3fbc9)
+++ uspace/lib/c/arch/ia32/_link.ld.in	(revision 54146a0e4e89ae79bdb89d2cd48c51829a471c3d)
@@ -5,10 +5,7 @@
 
 PHDRS {
-#if defined(LOADER)
+#if defined(LOADER) || defined(DLEXE)
 	interp PT_INTERP;
 	text PT_LOAD FILEHDR PHDRS FLAGS(5);
-#elif defined(DLEXE)
-	interp PT_INTERP;
-	text PT_LOAD FLAGS(5);
 #else
 	text PT_LOAD FLAGS(5);
@@ -64,4 +61,8 @@
 		*(.dynstr);
 	} :text
+	
+	.hash : {
+		*(.hash);
+	} :text
 #endif
 	. = . + 0x1000;
@@ -79,5 +80,5 @@
 #if defined(SHLIB) || defined(DLEXE)
 	.data.rel : {
-                *(.data.rel);
+                *(.data.rel .data.rel.*);
 	} :data
 
@@ -105,4 +106,5 @@
 	
 	.bss : {
+		*(.dynbss);
 		*(COMMON);
 		*(.bss);
@@ -122,13 +124,6 @@
 #endif
 	
-#if defined(SHLIB)
-#elif defined(DLEXE)
-	/DISCARD/ : {
-		*(.comment);
-	}
-#else
 	/DISCARD/ : {
 		*(*);
 	}
-#endif
 }
Index: uspace/srv/net/tl/icmp/Makefile
===================================================================
--- uspace/srv/net/tl/icmp/Makefile	(revision 5d4763bf9f73f33ab7140013e61f50715ed3fbc9)
+++ uspace/srv/net/tl/icmp/Makefile	(revision 54146a0e4e89ae79bdb89d2cd48c51829a471c3d)
@@ -32,4 +32,5 @@
 EXTRA_CFLAGS = -I$(LIBNET_PREFIX)/include
 BINARY = icmp
+STATIC_ONLY = y
 
 SOURCES = \
