Index: libcfa/src/bits/locks.hfa
===================================================================
--- libcfa/src/bits/locks.hfa	(revision 575a6e500466575fde0acedd9b84c09b42ac2ee8)
+++ libcfa/src/bits/locks.hfa	(revision 9aa9126e40385076b70bce81cfd5925a9c8b56ee)
@@ -64,4 +64,10 @@
 		extern void disable_interrupts();
 		extern void enable_interrupts_noPoll();
+
+		#ifdef __CFA_DEBUG__
+			void __cfaabi_dbg_record(__spinlock_t & this, const char * prev_name);
+		#else
+			#define __cfaabi_dbg_record(x, y)
+		#endif
 	}
 
@@ -71,11 +77,4 @@
 		this.lock = 0;
 	}
-
-
-	#ifdef __CFA_DEBUG__
-		void __cfaabi_dbg_record(__spinlock_t & this, const char * prev_name);
-	#else
-		#define __cfaabi_dbg_record(x, y)
-	#endif
 
 	// Lock the spinlock, return false if already acquired
Index: libcfa/src/concurrency/kernel.cfa
===================================================================
--- libcfa/src/concurrency/kernel.cfa	(revision 575a6e500466575fde0acedd9b84c09b42ac2ee8)
+++ libcfa/src/concurrency/kernel.cfa	(revision 9aa9126e40385076b70bce81cfd5925a9c8b56ee)
@@ -833,7 +833,9 @@
 // Debug
 __cfaabi_dbg_debug_do(
-	void __cfaabi_dbg_record(__spinlock_t & this, const char * prev_name) {
-		this.prev_name = prev_name;
-		this.prev_thrd = kernelTLS.this_thread;
+	extern "C" {
+		void __cfaabi_dbg_record(__spinlock_t & this, const char * prev_name) {
+			this.prev_name = prev_name;
+			this.prev_thrd = kernelTLS.this_thread;
+		}
 	}
 )
Index: libcfa/src/startup.cfa
===================================================================
--- libcfa/src/startup.cfa	(revision 575a6e500466575fde0acedd9b84c09b42ac2ee8)
+++ libcfa/src/startup.cfa	(revision 9aa9126e40385076b70bce81cfd5925a9c8b56ee)
@@ -40,5 +40,7 @@
 
 struct __spinlock_t;
-void __cfaabi_dbg_record(struct __spinlock_t & this, const char * prev_name) __attribute__(( weak )) {}
+extern "C" {
+	void __cfaabi_dbg_record(struct __spinlock_t & this, const char * prev_name) __attribute__(( weak )) {}
+}
 
 // Local Variables: //
