Index: uspace/Makefile.common
===================================================================
--- uspace/Makefile.common	(revision e2098dd700e887f07033562383371ac8e5d5b139)
+++ uspace/Makefile.common	(revision 0e9b512035036713c382370cb570a3881afa4209)
@@ -255,9 +255,15 @@
 endif
 
-%.lo: %.S
-	$(CC) $(DEFS) $(AFLAGS) $(CFLAGS) -D__ASM__ -c $< -o $@
-
-%.lo: %.s
-	$(AS) $(AFLAGS) $< -o $@
+%.lo: %.S $(DEPEND)
+	$(CC) $(DEFS) $(LIB_CFLAGS) -D__ASM__ -c $< -o $@
+ifeq ($(PRECHECK),y)
+	$(JOBFILE) $(JOB) $< $@ as asm/preproc $(DEFS) $(CFLAGS) -D__ASM__
+endif
+
+%.lo: %.s $(DEPEND)
+	$(AS) $(AFLAGS) -o $@ $<
+ifeq ($(PRECHECK),y)
+	$(JOBFILE) $(JOB) $< $@ as asm
+endif
 
 %.lo: %.c $(DEPEND)
Index: uspace/app/dload/arch/mips32/_link.ld.in
===================================================================
--- uspace/app/dload/arch/mips32/_link.ld.in	(revision e2098dd700e887f07033562383371ac8e5d5b139)
+++ uspace/app/dload/arch/mips32/_link.ld.in	(revision 0e9b512035036713c382370cb570a3881afa4209)
@@ -14,5 +14,5 @@
 	} :text
 	.text : {
-	        *(.text);
+	        *(.text*);
 		*(.rodata*);
 	} :text
Index: uspace/app/dload/dload.c
===================================================================
--- uspace/app/dload/dload.c	(revision e2098dd700e887f07033562383371ac8e5d5b139)
+++ uspace/app/dload/dload.c	(revision 0e9b512035036713c382370cb570a3881afa4209)
@@ -70,5 +70,5 @@
 	 */
 
-	DPRINTF("Parse program .dynamic section at 0x%x\n", __pcb->dynamic);
+	DPRINTF("Parse program .dynamic section at %p\n", __pcb->dynamic);
 	dynamic_parse(__pcb->dynamic, 0, &prog.dyn);
 	prog.bias = 0;
@@ -106,5 +106,5 @@
 	 * Finally, run the main program.
 	 */
-	DPRINTF("Run program.. (at 0x%lx)\n", (uintptr_t)__pcb->entry);
+	DPRINTF("Run program.. (at %p)\n", __pcb->entry);
 
 #ifndef RTLD_DEBUG
Index: uspace/lib/c/arch/ppc32/src/tls.c
===================================================================
--- uspace/lib/c/arch/ppc32/src/tls.c	(revision e2098dd700e887f07033562383371ac8e5d5b139)
+++ uspace/lib/c/arch/ppc32/src/tls.c	(revision 0e9b512035036713c382370cb570a3881afa4209)
@@ -48,4 +48,5 @@
 }
 
+/*
 static void kputint(unsigned i)
 {
@@ -59,4 +60,5 @@
 	) ;
 }
+*/
 
 typedef struct {
Index: uspace/lib/c/rtld/arch/mips32/src/reloc.c
===================================================================
--- uspace/lib/c/rtld/arch/mips32/src/reloc.c	(revision e2098dd700e887f07033562383371ac8e5d5b139)
+++ uspace/lib/c/rtld/arch/mips32/src/reloc.c	(revision 0e9b512035036713c382370cb570a3881afa4209)
@@ -38,8 +38,9 @@
 #include <stdlib.h>
 
-#include <arch.h>
 #include <elf_dyn.h>
 #include <symbol.h>
 #include <rtld.h>
+
+#include <rtld_arch.h>
 
 void module_process_pre_arch(module_t *m)
@@ -52,5 +53,5 @@
 	uint32_t *got;
 	char *str_tab;
-	int i, j;
+	unsigned i, j;
 
 	uint32_t sym_addr;
@@ -124,5 +125,5 @@
 		sym_def = symbol_def_find(str_tab + sym->st_name, m, &dest);
 		if (sym_def) {
-			sym_addr = symbol_get_addr(sym_def, dest);
+			sym_addr = (uintptr_t) symbol_get_addr(sym_def, dest);
 			DPRINTF("symbol definition found, addr=0x%x\n", sym_addr);
 		} else {
@@ -142,5 +143,5 @@
 void rel_table_process(module_t *m, elf_rel_t *rt, size_t rt_size)
 {
-	int i;
+	unsigned i;
 
 	size_t rt_entries;
@@ -154,5 +155,5 @@
 	elf_symbol_t *sym;
 	uint32_t *r_ptr;
-	uint16_t *r_ptr16;
+/*	uint16_t *r_ptr16;*/
 	char *str_tab;
 	
@@ -174,5 +175,5 @@
 	lgotno = m->dyn.arch.lgotno;
 
-	DPRINTF("got=0x%lx, gotsym=%d\n", (uintptr_t) got, gotsym);
+	DPRINTF("got=0x%x, gotsym=%d\n", (uintptr_t) got, gotsym);
 
 	DPRINTF("address: 0x%x, entries: %d\n", (uintptr_t)rt, rt_entries);
@@ -193,5 +194,5 @@
 		rel_type = ELF32_R_TYPE(r_info);
 		r_ptr = (uint32_t *)(r_offset + m->bias);
-		r_ptr16 = (uint16_t *)(r_offset + m->bias);
+		/*r_ptr16 = (uint16_t *)(r_offset + m->bias);*/
 
 		if (sym->st_name != 0) {
@@ -200,5 +201,6 @@
 			DPRINTF("dest bias: 0x%x\n", dest->bias);
 			if (sym_def) {
-				sym_addr = symbol_get_addr(sym_def, dest);
+				sym_addr = (uintptr_t) symbol_get_addr(sym_def,
+				    dest);
 				DPRINTF("symbol definition found, addr=0x%x\n", sym_addr);
 			} else {
@@ -206,4 +208,7 @@
 				continue;
 			}
+		} else {
+			sym_def = NULL;
+			sym_addr = 0;
 		}
 
Index: uspace/lib/c/rtld/arch/ppc32/src/reloc.c
===================================================================
--- uspace/lib/c/rtld/arch/ppc32/src/reloc.c	(revision e2098dd700e887f07033562383371ac8e5d5b139)
+++ uspace/lib/c/rtld/arch/ppc32/src/reloc.c	(revision 0e9b512035036713c382370cb570a3881afa4209)
@@ -38,5 +38,4 @@
 #include <stdlib.h>
 
-#include <arch.h>
 #include <elf_dyn.h>
 #include <symbol.h>
@@ -44,4 +43,6 @@
 #include <smc.h>
 
+#include <rtld_arch.h>
+
 #define __L(ptr) ((uint32_t)(ptr) & 0x0000ffff)
 #define __HA(ptr) ((uint32_t)(ptr) >> 16)
@@ -85,5 +86,5 @@
 {
 	uint32_t *plt;
-	uint32_t *_plt_ent;
+//	uint32_t *_plt_ent;
 	
 	/* No lazy linking -- no pre-processing yet. */
@@ -97,5 +98,5 @@
 
 	// PLT entries start here. However, each occupies 2 words
-	_plt_ent = plt + 18;
+//	_plt_ent = plt + 18;
 
 	// By definition of the ppc ABI, there's 1:1 correspondence
@@ -104,9 +105,9 @@
 
 	uint32_t *_plt_table;
-	uint32_t *_plt_call;
-	uint32_t *_plt_resolve;
-
-	_plt_resolve = plt;
-	_plt_call = plt + 6;
+//	uint32_t *_plt_call;
+//	uint32_t *_plt_resolve;
+
+//	_plt_resolve = plt;
+//	_plt_call = plt + 6;
 	_plt_table = plt + 18 + plt_n;
 
@@ -136,5 +137,5 @@
 void rela_table_process(module_t *m, elf_rela_t *rt, size_t rt_size)
 {
-	int i;
+	unsigned i;
 
 	size_t rt_entries;
@@ -156,5 +157,5 @@
 
 	uint32_t *plt;
-	uint32_t *_plt_table;
+//	uint32_t *_plt_table;
 	uint32_t *_plt_ent;
 	uint32_t plt_n;
@@ -166,5 +167,5 @@
 	plt_n = m->dyn.plt_rel_sz / sizeof(elf_rela_t);
 	_plt_ent = plt+ 18;
-	_plt_table = plt + 18 + plt_n;
+//	_plt_table = plt + 18 + plt_n;
 
 	DPRINTF("parse relocation table\n");
@@ -201,5 +202,6 @@
 			DPRINTF("dest bias: 0x%x\n", dest->bias);
 			if (sym_def) {
-				sym_addr = symbol_get_addr(sym_def, dest);
+				sym_addr = (uintptr_t) symbol_get_addr(
+				    sym_def, dest);
 				DPRINTF("symbol definition found, addr=0x%x\n", sym_addr);
 			} else {
@@ -207,4 +209,7 @@
 				continue;
 			}
+		} else {
+			sym_def = NULL;
+			sym_addr = 0;
 		}
 
@@ -247,4 +252,5 @@
 			 */
 			DPRINTF("fixup R_PPC_COPY (s)\n");
+
 			sym_size = sym->st_size;
 			if (sym_size != sym_def->st_size) {
Index: uspace/lib/c/rtld/include/rtld.h
===================================================================
--- uspace/lib/c/rtld/include/rtld.h	(revision e2098dd700e887f07033562383371ac8e5d5b139)
+++ uspace/lib/c/rtld/include/rtld.h	(revision 0e9b512035036713c382370cb570a3881afa4209)
@@ -46,7 +46,7 @@
 
 #ifdef RTLD_DEBUG
-	#define DPRINTF(format, ...) printf(format, ##__VA_ARGS__);
+	#define DPRINTF(format, ...) printf(format, ##__VA_ARGS__)
 #else
-	#define DPRINTF(format, ...)
+	#define DPRINTF(format, ...) if (0) printf(format, ##__VA_ARGS__)
 #endif
 
