Index: uspace/lib/c/arch/abs32le/_link.ld.in
===================================================================
--- uspace/lib/c/arch/abs32le/_link.ld.in	(revision fc51296af4f45da426f5626f3573adee6b0babda)
+++ uspace/lib/c/arch/abs32le/_link.ld.in	(revision a30e4354a9608d1a27fa141c8d89409ef2d9aae8)
@@ -11,6 +11,6 @@
 	
 	.text : {
-		*(.text);
-		*(.rodata*);
+		*(.text .text.*);
+		*(.rodata .rodata.*);
 	} :text
 	
Index: uspace/lib/c/arch/amd64/_link.ld.in
===================================================================
--- uspace/lib/c/arch/amd64/_link.ld.in	(revision fc51296af4f45da426f5626f3573adee6b0babda)
+++ uspace/lib/c/arch/amd64/_link.ld.in	(revision a30e4354a9608d1a27fa141c8d89409ef2d9aae8)
@@ -16,6 +16,6 @@
 	
 	.text : {
-		*(.text);
-		*(.rodata*);
+		*(.text .text.*);
+		*(.rodata .rodata.*);
 	} :text
 	
Index: uspace/lib/c/arch/arm32/_link.ld.in
===================================================================
--- uspace/lib/c/arch/arm32/_link.ld.in	(revision fc51296af4f45da426f5626f3573adee6b0babda)
+++ uspace/lib/c/arch/arm32/_link.ld.in	(revision a30e4354a9608d1a27fa141c8d89409ef2d9aae8)
@@ -15,6 +15,6 @@
 	
 	.text : {
-		*(.text);
-		*(.rodata*);
+		*(.text .text.*);
+		*(.rodata .rodata.*);
 	} :text
 	
Index: uspace/lib/c/arch/ia32/_link.ld.in
===================================================================
--- uspace/lib/c/arch/ia32/_link.ld.in	(revision fc51296af4f45da426f5626f3573adee6b0babda)
+++ uspace/lib/c/arch/ia32/_link.ld.in	(revision a30e4354a9608d1a27fa141c8d89409ef2d9aae8)
@@ -16,6 +16,6 @@
 	
 	.text : {
-		*(.text);
-		*(.rodata*);
+		*(.text .text.*);
+		*(.rodata .rodata.*);
 	} :text
 	
Index: uspace/lib/c/arch/ia64/_link.ld.in
===================================================================
--- uspace/lib/c/arch/ia64/_link.ld.in	(revision fc51296af4f45da426f5626f3573adee6b0babda)
+++ uspace/lib/c/arch/ia64/_link.ld.in	(revision a30e4354a9608d1a27fa141c8d89409ef2d9aae8)
@@ -15,6 +15,6 @@
 	
 	.text : {
-		*(.text);
-		*(.rodata*);
+		*(.text .text.*);
+		*(.rodata .rodata.*);
 	} :text
 	
@@ -23,5 +23,5 @@
 	.got : {
 		_gp = .;
-		*(.got*);
+		*(.got .got.*);
 	} :data
 	
Index: uspace/lib/c/arch/mips32/_link.ld.in
===================================================================
--- uspace/lib/c/arch/mips32/_link.ld.in	(revision fc51296af4f45da426f5626f3573adee6b0babda)
+++ uspace/lib/c/arch/mips32/_link.ld.in	(revision a30e4354a9608d1a27fa141c8d89409ef2d9aae8)
@@ -15,6 +15,6 @@
 	
 	.text : {
-		*(.text);
-		*(.rodata*);
+		*(.text .text.*);
+		*(.rodata .rodata.*);
 	} :text
 	
Index: uspace/lib/c/arch/ppc32/_link.ld.in
===================================================================
--- uspace/lib/c/arch/ppc32/_link.ld.in	(revision fc51296af4f45da426f5626f3573adee6b0babda)
+++ uspace/lib/c/arch/ppc32/_link.ld.in	(revision a30e4354a9608d1a27fa141c8d89409ef2d9aae8)
@@ -15,6 +15,6 @@
 	
 	.text : {
-		*(.text);
-		*(.rodata*);
+		*(.text .text.*);
+		*(.rodata .rodata.*);
 	} :text
 	
Index: uspace/lib/c/arch/sparc64/_link.ld.in
===================================================================
--- uspace/lib/c/arch/sparc64/_link.ld.in	(revision fc51296af4f45da426f5626f3573adee6b0babda)
+++ uspace/lib/c/arch/sparc64/_link.ld.in	(revision a30e4354a9608d1a27fa141c8d89409ef2d9aae8)
@@ -15,6 +15,6 @@
 	
 	.text : {
-		*(.text);
-		*(.rodata*);
+		*(.text .text.*);
+		*(.rodata .rodata.*);
 	} :text
 	
Index: uspace/lib/c/generic/net/packet.c
===================================================================
--- uspace/lib/c/generic/net/packet.c	(revision fc51296af4f45da426f5626f3573adee6b0babda)
+++ uspace/lib/c/generic/net/packet.c	(revision a30e4354a9608d1a27fa141c8d89409ef2d9aae8)
@@ -190,5 +190,5 @@
 		}
 	}
-	gpm_destroy(&pm_globals.packet_map);
+	gpm_destroy(&pm_globals.packet_map, free);
 	/* leave locked */
 }
Index: uspace/lib/c/generic/net/socket_client.c
===================================================================
--- uspace/lib/c/generic/net/socket_client.c	(revision fc51296af4f45da426f5626f3573adee6b0babda)
+++ uspace/lib/c/generic/net/socket_client.c	(revision a30e4354a9608d1a27fa141c8d89409ef2d9aae8)
@@ -749,5 +749,5 @@
 	dyn_fifo_destroy(&socket->received);
 	dyn_fifo_destroy(&socket->accepted);
-	sockets_exclude(socket_get_sockets(), socket->socket_id);
+	sockets_exclude(socket_get_sockets(), socket->socket_id, free);
 }
 
Index: uspace/lib/c/generic/vfs/vfs.c
===================================================================
--- uspace/lib/c/generic/vfs/vfs.c	(revision fc51296af4f45da426f5626f3573adee6b0babda)
+++ uspace/lib/c/generic/vfs/vfs.c	(revision a30e4354a9608d1a27fa141c8d89409ef2d9aae8)
@@ -756,8 +756,9 @@
 {
 	struct stat stat;
-	int rc;
-
-	rc = fstat(fildes, &stat);
-
+	
+	int rc = fstat(fildes, &stat);
+	if (rc != 0)
+		return rc;
+	
 	if (!stat.device)
 		return -1;
Index: uspace/lib/c/include/adt/generic_char_map.h
===================================================================
--- uspace/lib/c/include/adt/generic_char_map.h	(revision fc51296af4f45da426f5626f3573adee6b0babda)
+++ uspace/lib/c/include/adt/generic_char_map.h	(revision a30e4354a9608d1a27fa141c8d89409ef2d9aae8)
@@ -47,4 +47,8 @@
 #define GENERIC_CHAR_MAP_MAGIC_VALUE	0x12345622
 
+/** Generic destructor function pointer. */
+#define DTOR_T(identifier) \
+	void (*identifier)(const void *)
+
 /** Character string to generic type map declaration.
  *  @param[in] name	Name of the map.
@@ -64,6 +68,6 @@
 	int name##_add(name##_t *, const uint8_t *, const size_t, type *); \
 	int name##_count(name##_t *); \
-	void name##_destroy(name##_t *); \
-	void name##_exclude(name##_t *, const uint8_t *, const size_t); \
+	void name##_destroy(name##_t *, DTOR_T()); \
+	void name##_exclude(name##_t *, const uint8_t *, const size_t, DTOR_T()); \
 	type *name##_find(name##_t *, const uint8_t *, const size_t); \
 	int name##_initialize(name##_t *); \
@@ -84,5 +88,4 @@
 	     type *value) \
 	{ \
-		int rc; \
 		int index; \
 		if (!name##_is_valid(map)) \
@@ -91,10 +94,5 @@
 		if (index < 0) \
 			return index; \
-		rc = char_map_add(&map->names, name, length, index); \
-		if (rc != EOK) { \
-			name##_items_exclude_index(&map->values, index); \
-			return rc; \
-		} \
-		return EOK; \
+		return char_map_add(&map->names, name, length, index); \
 	} \
 	\
@@ -105,14 +103,14 @@
 	} \
 	\
-	void name##_destroy(name##_t *map) \
+	void name##_destroy(name##_t *map, DTOR_T(dtor)) \
 	{ \
 		if (name##_is_valid(map)) { \
 			char_map_destroy(&map->names); \
-			name##_items_destroy(&map->values); \
+			name##_items_destroy(&map->values, dtor); \
 		} \
 	} \
 	\
 	void name##_exclude(name##_t *map, const uint8_t *name, \
-	    const size_t length) \
+	    const size_t length, DTOR_T(dtor)) \
 	{ \
 		if (name##_is_valid(map)) { \
@@ -121,5 +119,5 @@
 			if (index != CHAR_MAP_NULL) \
 				name##_items_exclude_index(&map->values, \
-				     index); \
+				     index, dtor); \
 		} \
 	} \
Index: uspace/lib/c/include/adt/generic_field.h
===================================================================
--- uspace/lib/c/include/adt/generic_field.h	(revision fc51296af4f45da426f5626f3573adee6b0babda)
+++ uspace/lib/c/include/adt/generic_field.h	(revision a30e4354a9608d1a27fa141c8d89409ef2d9aae8)
@@ -46,4 +46,8 @@
 #define GENERIC_FIELD_MAGIC_VALUE		0x55667788
 
+/** Generic destructor function pointer. */
+#define DTOR_T(identifier) \
+	void (*identifier)(const void *)
+
 /** Generic type field declaration.
  *
@@ -63,6 +67,6 @@
 	int name##_add(name##_t *, type *); \
 	int name##_count(name##_t *); \
-	void name##_destroy(name##_t *); \
-	void name##_exclude_index(name##_t *, int); \
+	void name##_destroy(name##_t *, DTOR_T()); \
+	void name##_exclude_index(name##_t *, int, DTOR_T()); \
 	type **name##_get_field(name##_t *); \
 	type *name##_get_index(name##_t *, int); \
@@ -103,12 +107,14 @@
 	} \
 	\
-	void name##_destroy(name##_t *field) \
+	void name##_destroy(name##_t *field, DTOR_T(dtor)) \
 	{ \
 		if (name##_is_valid(field)) { \
 			int index; \
 			field->magic = 0; \
-			for (index = 0; index < field->next; index++) { \
-				if (field->items[index]) \
-					free(field->items[index]); \
+			if (dtor) { \
+				for (index = 0; index < field->next; index++) { \
+					if (field->items[index]) \
+						dtor(field->items[index]); \
+				} \
 			} \
 			free(field->items); \
@@ -116,9 +122,10 @@
 	} \
 	 \
-	void name##_exclude_index(name##_t *field, int index) \
+	void name##_exclude_index(name##_t *field, int index, DTOR_T(dtor)) \
 	{ \
 		if (name##_is_valid(field) && (index >= 0) && \
 		    (index < field->next) && (field->items[index])) { \
-			free(field->items[index]); \
+			if (dtor) \
+				dtor(field->items[index]); \
 			field->items[index] = NULL; \
 		} \
Index: uspace/lib/c/include/adt/int_map.h
===================================================================
--- uspace/lib/c/include/adt/int_map.h	(revision fc51296af4f45da426f5626f3573adee6b0babda)
+++ uspace/lib/c/include/adt/int_map.h	(revision a30e4354a9608d1a27fa141c8d89409ef2d9aae8)
@@ -49,4 +49,8 @@
 #define INT_MAP_ITEM_MAGIC_VALUE	0x55667788
 
+/** Generic destructor function pointer. */
+#define DTOR_T(identifier) \
+	void (*identifier)(const void *)
+
 /** Integer to generic type map declaration.
  *
@@ -72,9 +76,9 @@
 	\
 	int name##_add(name##_t *, int, type *); \
-	void name##_clear(name##_t *); \
+	void name##_clear(name##_t *, DTOR_T()); \
 	int name##_count(name##_t *); \
-	void name##_destroy(name##_t *); \
-	void name##_exclude(name##_t *, int); \
-	void name##_exclude_index(name##_t *, int); \
+	void name##_destroy(name##_t *, DTOR_T()); \
+	void name##_exclude(name##_t *, int, DTOR_T()); \
+	void name##_exclude_index(name##_t *, int, DTOR_T()); \
 	type *name##_find(name##_t *, int); \
 	int name##_update(name##_t *, int, int); \
@@ -82,5 +86,5 @@
 	int name##_initialize(name##_t *); \
 	int name##_is_valid(name##_t *); \
-	void name##_item_destroy(name##_item_t *); \
+	void name##_item_destroy(name##_item_t *, DTOR_T()); \
 	int name##_item_is_valid(name##_item_t *);
 
@@ -115,5 +119,5 @@
 	} \
 	\
-	void name##_clear(name##_t *map) \
+	void name##_clear(name##_t *map, DTOR_T(dtor)) \
 	{ \
 		if (name##_is_valid(map)) { \
@@ -122,5 +126,5 @@
 				if (name##_item_is_valid(&map->items[index])) { \
 					name##_item_destroy( \
-					    &map->items[index]); \
+					    &map->items[index], dtor); \
 				} \
 			} \
@@ -135,5 +139,5 @@
 	} \
 	\
-	void name##_destroy(name##_t *map) \
+	void name##_destroy(name##_t *map, DTOR_T(dtor)) \
 	{ \
 		if (name##_is_valid(map)) { \
@@ -143,5 +147,5 @@
 				if (name##_item_is_valid(&map->items[index])) { \
 					name##_item_destroy( \
-					    &map->items[index]); \
+					    &map->items[index], dtor); \
 				} \
 			} \
@@ -150,5 +154,5 @@
 	} \
 	\
-	void name##_exclude(name##_t *map, int key) \
+	void name##_exclude(name##_t *map, int key, DTOR_T(dtor)) \
 	{ \
 		if (name##_is_valid(map)) { \
@@ -158,16 +162,16 @@
 				    (map->items[index].key == key)) { \
 					name##_item_destroy( \
-					    &map->items[index]); \
-				} \
-			} \
-		} \
-	} \
-	\
-	void name##_exclude_index(name##_t *map, int index) \
+					    &map->items[index], dtor); \
+				} \
+			} \
+		} \
+	} \
+	\
+	void name##_exclude_index(name##_t *map, int index, DTOR_T(dtor)) \
 	{ \
 		if (name##_is_valid(map) && (index >= 0) && \
 		    (index < map->next) && \
 		    name##_item_is_valid(&map->items[index])) { \
-			name##_item_destroy(&map->items[index]); \
+			name##_item_destroy(&map->items[index], dtor); \
 		} \
 	} \
@@ -236,10 +240,11 @@
 	} \
 	\
-	void name##_item_destroy(name##_item_t *item) \
+	void name##_item_destroy(name##_item_t *item, DTOR_T(dtor)) \
 	{ \
 		if (name##_item_is_valid(item)) { \
 			item->magic = 0; \
 			if (item->value) { \
-				free(item->value); \
+				if (dtor) \
+					dtor(item->value); \
 				item->value = NULL; \
 			} \
