Index: uspace/lib/libc/Makefile.toolchain
===================================================================
--- uspace/lib/libc/Makefile.toolchain	(revision 42ec9198d3475719dcc6743cb7e015e9ecc84a50)
+++ uspace/lib/libc/Makefile.toolchain	(revision bda24ee7e6220d31f6570cc4ac7804163db9055d)
@@ -28,5 +28,5 @@
 
 DEFS = -DARCH=$(ARCH)
-CFLAGS = -fno-builtin -Wall -Werror-implicit-function-declaration -Wmissing-prototypes -O3 -nostdlib -nostdinc -I$(LIBC_PREFIX)/include -pipe
+CFLAGS = -fno-builtin -Wall -Werror-implicit-function-declaration -Wmissing-prototypes -O3 -nostdlib -nostdinc -I$(LIBC_PREFIX)/include -pipe -g
 LFLAGS = -M -N $(SOFTINT_PREFIX)/libsoftint.a
 AFLAGS =
Index: uspace/lib/libc/arch/mips32/include/atomic.h
===================================================================
--- uspace/lib/libc/arch/mips32/include/atomic.h	(revision 42ec9198d3475719dcc6743cb7e015e9ecc84a50)
+++ uspace/lib/libc/arch/mips32/include/atomic.h	(revision bda24ee7e6220d31f6570cc4ac7804163db9055d)
@@ -60,11 +60,12 @@
 		"1:\n"
 		"	ll %0, %1\n"
-		"	addiu %0, %0, %3\n"	/* same as addi, but never traps on overflow */
+		"	addu %0, %0, %3\n"	/* same as add, but never traps on overflow */
 		"       move %2, %0\n"
 		"	sc %0, %1\n"
 		"	beq %0, %4, 1b\n"	/* if the atomic operation failed, try again */
 		/*	nop	*/		/* nop is inserted automatically by compiler */
+		"	nop\n"
 		: "=&r" (tmp), "+m" (val->count), "=&r" (v)
-		: "i" (i), "i" (0)
+		: "r" (i), "i" (0)
 		);
 
