Index: abi/include/abi/asmtool.h
===================================================================
--- abi/include/abi/asmtool.h	(revision 3a34852c5ad9335d47aeef1f7d6c94e3b985fb12)
+++ abi/include/abi/asmtool.h	(revision 8844e7075a44097c359d1ef79350efa377c39ec5)
@@ -36,11 +36,23 @@
 #define ABI_ASMTOOL_H_
 
+#define SYMBOL(sym) \
+	.global sym; \
+	sym:
+#define SYMBOL_BEGIN(sym) \
+	SYMBOL(sym)
+#define SYMBOL_END(sym) \
+	.size sym, . - sym
+
+#define OBJECT_BEGIN(obj) \
+	.type obj, @object; \
+	SYMBOL_BEGIN(obj)
+#define OBJECT_END(obj) \
+	SYMBOL_END(obj)
+
 #define FUNCTION_BEGIN(func) \
-	.global func; \
 	.type func, @function; \
-	func: 	
-
+	SYMBOL_BEGIN(func) 	
 #define FUNCTION_END(func) \
-	.size func, . - func
+	SYMBOL_END(func)
 
 #endif
Index: kernel/arch/ia32/Makefile.inc
===================================================================
--- kernel/arch/ia32/Makefile.inc	(revision 3a34852c5ad9335d47aeef1f7d6c94e3b985fb12)
+++ kernel/arch/ia32/Makefile.inc	(revision 8844e7075a44097c359d1ef79350efa377c39ec5)
@@ -75,5 +75,5 @@
 	arch/$(KARCH)/src/debug/stacktrace.c \
 	arch/$(KARCH)/src/debug/stacktrace_asm.S \
-	arch/$(KARCH)/src/delay.s \
+	arch/$(KARCH)/src/delay.S \
 	arch/$(KARCH)/src/asm.S \
 	arch/$(KARCH)/src/proc/scheduler.c \
Index: kernel/arch/ia32/src/asm.S
===================================================================
--- kernel/arch/ia32/src/asm.S	(revision 3a34852c5ad9335d47aeef1f7d6c94e3b985fb12)
+++ kernel/arch/ia32/src/asm.S	(revision 8844e7075a44097c359d1ef79350efa377c39ec5)
@@ -31,4 +31,5 @@
  */
 
+#include <abi/asmtool.h>
 #include <arch/pm.h>
 #include <arch/cpu.h>
@@ -37,11 +38,4 @@
 
 .text
-.global paging_on
-.global enable_l_apic_in_msr
-.global memcpy_from_uspace
-.global memcpy_from_uspace_failover_address
-.global memcpy_to_uspace
-.global memcpy_to_uspace_failover_address
-.global early_putchar
 
 #define MEMCPY_DST   4
@@ -64,6 +58,6 @@
  *
  */
-memcpy_from_uspace:
-memcpy_to_uspace:
+FUNCTION_BEGIN(memcpy_from_uspace)
+FUNCTION_BEGIN(memcpy_to_uspace)
 	movl %edi, %edx  /* save %edi */
 	movl %esi, %eax  /* save %esi */
@@ -93,4 +87,6 @@
 		movl MEMCPY_DST(%esp), %eax
 		ret
+FUNCTION_END(memcpy_from_uspace)
+FUNCTION_END(memcpy_to_uspace)
 
 /*
@@ -98,6 +94,6 @@
  * above had caused a page fault.
  */
-memcpy_from_uspace_failover_address:
-memcpy_to_uspace_failover_address:
+SYMBOL(memcpy_from_uspace_failover_address)
+SYMBOL(memcpy_to_uspace_failover_address)
 	movl %edx, %edi
 	movl %eax, %esi
@@ -112,5 +108,5 @@
  *
  */
-paging_on:
+FUNCTION_BEGIN(paging_on)
 	movl %cr0, %edx
 	orl $(1 << 31), %edx  /* paging on */
@@ -123,4 +119,5 @@
 	0:
 		ret
+FUNCTION_END(paging_on)
 
 /** Enable local APIC
@@ -129,5 +126,5 @@
  *
  */
-enable_l_apic_in_msr:
+FUNCTION_BEGIN(enable_l_apic_in_msr)
 	movl $0x1b, %ecx
 	rdmsr
@@ -136,4 +133,5 @@
 	wrmsr
 	ret
+FUNCTION_END(enable_l_apic_in_msr)
 
 /*
@@ -152,6 +150,5 @@
  * entirely in registers.
  */
-.global sysenter_handler
-sysenter_handler:
+SYMBOL(sysenter_handler)
 
 	/*
@@ -232,6 +229,5 @@
  * This is the legacy syscall handler using the interrupt mechanism.
  */
-.global int_syscall
-int_syscall:
+SYMBOL(int_syscall)
 	subl $(ISTATE_SOFT_SIZE + 4), %esp
 
@@ -319,6 +315,5 @@
 
 .macro handler i
-.global int_\i
-int_\i:
+SYMBOL(int_\i)
 	/*
 	 * This macro distinguishes between two versions of ia32
@@ -462,5 +457,5 @@
  *
  */
-early_putchar:
+FUNCTION_BEGIN(early_putchar)
 	
 #if ((defined(CONFIG_EGA)) && (!defined(CONFIG_FB)))
@@ -594,3 +589,4 @@
 	
 	ret
-
+FUNCTION_END(early_putchar)
+
Index: kernel/arch/ia32/src/atomic.S
===================================================================
--- kernel/arch/ia32/src/atomic.S	(revision 3a34852c5ad9335d47aeef1f7d6c94e3b985fb12)
+++ kernel/arch/ia32/src/atomic.S	(revision 8844e7075a44097c359d1ef79350efa377c39ec5)
@@ -27,14 +27,14 @@
 #
 
+#include <abi/asmtool.h>
+
 .text
 
 #ifdef CONFIG_SMP
 
-.global spinlock_arch
-
 #
 # This is a bus-and-hyperthreading-friendly implementation of spinlock 
 #
-spinlock_arch:
+FUNCTION_BEGIN(spinlock_arch)
 	pushl %eax
 	pushl %ebx
@@ -55,4 +55,5 @@
 	popl %eax
 	ret
+FUNCTION_END(spinlock_arch)
 	
 #endif
Index: kernel/arch/ia32/src/boot/multiboot.S
===================================================================
--- kernel/arch/ia32/src/boot/multiboot.S	(revision 3a34852c5ad9335d47aeef1f7d6c94e3b985fb12)
+++ kernel/arch/ia32/src/boot/multiboot.S	(revision 8844e7075a44097c359d1ef79350efa377c39ec5)
@@ -29,4 +29,5 @@
  */
 
+#include <abi/asmtool.h>
 #include <arch/boot/boot.h>
 #include <arch/mm/page.h>
@@ -61,5 +62,4 @@
 
 .align 4
-.global multiboot_image_start
 multiboot_header:
 	.long MULTIBOOT_HEADER_MAGIC
@@ -72,5 +72,5 @@
 	.long multiboot_image_start
 
-multiboot_image_start:
+SYMBOL(multiboot_image_start)
 	cli
 	cld
@@ -162,5 +162,5 @@
  *
  */
-.global map_kernel_pse
+FUNCTION_BEGIN(map_kernel_pse)
 map_kernel_pse:
 	/* Paging features */
@@ -194,4 +194,5 @@
 	movl %ebx, %cr0
 	ret
+FUNCTION_END(map_kernel_pse)
 
 /** Setup mapping for the kernel (non-PSE variant).
@@ -201,6 +202,5 @@
  *
  */
-.global map_kernel_non_pse
-map_kernel_non_pse:
+FUNCTION_BEGIN(map_kernel_non_pse)
 	/* Paging features */
 	movl %cr4, %ecx
@@ -281,4 +281,5 @@
 		
 		ret
+FUNCTION_END(map_kernel_non_pse)
 
 /** Calculate unmapped address of the end of the kernel. */
@@ -707,20 +708,16 @@
 	.space 4096, 0
 
-.global bootstrap_idtr
-bootstrap_idtr:
+SYMBOL(bootstrap_idtr)
 	.word 0
 	.long 0
 
-.global bootstrap_gdtr
-bootstrap_gdtr:
+SYMBOL(bootstrap_gdtr)
 	.word GDT_SELECTOR(GDT_ITEMS)
 	.long KA2PA(gdt)
 
-.global multiboot_eax
-multiboot_eax:
+SYMBOL(multiboot_eax)
 	.long 0
 
-.global multiboot_ebx
-multiboot_ebx:
+SYMBOL(multiboot_ebx)
 	.long 0
 
Index: kernel/arch/ia32/src/boot/multiboot2.S
===================================================================
--- kernel/arch/ia32/src/boot/multiboot2.S	(revision 3a34852c5ad9335d47aeef1f7d6c94e3b985fb12)
+++ kernel/arch/ia32/src/boot/multiboot2.S	(revision 8844e7075a44097c359d1ef79350efa377c39ec5)
@@ -27,4 +27,5 @@
  */
 
+#include <abi/asmtool.h>
 #include <arch/boot/boot.h>
 #include <arch/pm.h>
@@ -39,5 +40,4 @@
 
 .align 8
-.global multiboot2_image_start
 multiboot2_header_start:
 	.long MULTIBOOT2_HEADER_MAGIC
@@ -120,5 +120,5 @@
 multiboot2_header_end:
 
-multiboot2_image_start:
+SYMBOL(multiboot2_image_start)
 	cli
 	cld
Index: kernel/arch/ia32/src/context.S
===================================================================
--- kernel/arch/ia32/src/context.S	(revision 3a34852c5ad9335d47aeef1f7d6c94e3b985fb12)
+++ kernel/arch/ia32/src/context.S	(revision 8844e7075a44097c359d1ef79350efa377c39ec5)
@@ -27,11 +27,8 @@
 #
 
+#include <abi/asmtool.h>
 #include <arch/context_struct.h>
 
 .text
-
-.global context_save_arch
-.global context_restore_arch
-
 
 ## Save current CPU context
@@ -40,5 +37,5 @@
 # pointed by the 1st argument. Returns 1 in EAX.
 #
-context_save_arch:
+FUNCTION_BEGIN(context_save_arch)
 	movl 0(%esp), %eax	# save pc value into eax	
 	movl 4(%esp), %edx	# address of the context variable to save context to 
@@ -55,4 +52,5 @@
 	incl %eax
 	ret
+FUNCTION_END(context_save_arch)
 
 
@@ -62,5 +60,5 @@
 # pointed by the 1st argument. Returns 0 in EAX.
 #
-context_restore_arch:
+FUNCTION_BEGIN(context_restore_arch)
 	movl 4(%esp), %eax	# address of the context variable to restore context from
 
@@ -76,3 +74,3 @@
 	xorl %eax, %eax		# context_restore returns 0
 	ret
-
+FUNCTION_END(context_restore_arch)
Index: kernel/arch/ia32/src/debug/stacktrace_asm.S
===================================================================
--- kernel/arch/ia32/src/debug/stacktrace_asm.S	(revision 3a34852c5ad9335d47aeef1f7d6c94e3b985fb12)
+++ kernel/arch/ia32/src/debug/stacktrace_asm.S	(revision 8844e7075a44097c359d1ef79350efa377c39ec5)
@@ -27,14 +27,15 @@
 #
 
+#include <abi/asmtool.h>
+
 .text
 
-.global frame_pointer_get
-.global program_counter_get
-
-frame_pointer_get:
+FUNCTION_BEGIN(frame_pointer_get)
 	movl %ebp, %eax
 	ret
+FUNCTION_END(frame_pointer_get)
 
-program_counter_get:
+FUNCTION_BEGIN(program_counter_get)
 	movl (%esp), %eax
 	ret
+FUNCTION_END(program_counter_get)
Index: kernel/arch/ia32/src/delay.S
===================================================================
--- kernel/arch/ia32/src/delay.S	(revision 8844e7075a44097c359d1ef79350efa377c39ec5)
+++ kernel/arch/ia32/src/delay.S	(revision 8844e7075a44097c359d1ef79350efa377c39ec5)
@@ -0,0 +1,52 @@
+#
+# Copyright (c) 2001-2004 Jakub Jermar
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# - Redistributions of source code must retain the above copyright
+#   notice, this list of conditions and the following disclaimer.
+# - Redistributions in binary form must reproduce the above copyright
+#   notice, this list of conditions and the following disclaimer in the
+#   documentation and/or other materials provided with the distribution.
+# - The name of the author may not be used to endorse or promote products
+#   derived from this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+
+#
+# Micro second delay loop functions.
+#
+
+#include <abi/asmtool.h>
+
+.text
+
+FUNCTION_BEGIN(asm_delay_loop)
+	movl 4(%esp),%ecx	# move argument to %ecx
+0:	lahf
+	dec %ecx
+	jnz 0b
+	ret
+FUNCTION_END(asm_delay_loop)
+
+FUNCTION_BEGIN(asm_fake_loop)
+	movl 4(%esp),%ecx	# move argument to %ecx
+0:	lahf
+	dec %ecx
+	jz 0b
+	ret
+FUNCTION_END(asm_fake_loop)
+
Index: rnel/arch/ia32/src/delay.s
===================================================================
--- kernel/arch/ia32/src/delay.s	(revision 3a34852c5ad9335d47aeef1f7d6c94e3b985fb12)
+++ 	(revision )
@@ -1,50 +1,0 @@
-#
-# Copyright (c) 2001-2004 Jakub Jermar
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-#
-# Micro second delay loop functions.
-#
-
-.text
-
-.global asm_delay_loop
-.global asm_fake_loop
-
-asm_delay_loop:
-	movl 4(%esp),%ecx	# move argument to %ecx
-0:	lahf
-	dec %ecx
-	jnz 0b
-	ret
-
-asm_fake_loop:
-	movl 4(%esp),%ecx	# move argument to %ecx
-0:	lahf
-	dec %ecx
-	jz 0b
-	ret
Index: kernel/arch/ia32/src/smp/ap.S
===================================================================
--- kernel/arch/ia32/src/smp/ap.S	(revision 3a34852c5ad9335d47aeef1f7d6c94e3b985fb12)
+++ kernel/arch/ia32/src/smp/ap.S	(revision 8844e7075a44097c359d1ef79350efa377c39ec5)
@@ -32,4 +32,5 @@
  */
 
+#include <abi/asmtool.h>
 #include <arch/boot/boot.h>
 #include <arch/boot/memmap.h>
@@ -40,6 +41,4 @@
 
 #ifdef CONFIG_SMP
-
-.global unmapped_ap_boot
 
 KTEXT=8
@@ -53,5 +52,5 @@
 
 .align 4096
-unmapped_ap_boot:
+SYMBOL(unmapped_ap_boot)
 .code16
 	cli
@@ -99,7 +98,5 @@
 #ifdef CONFIG_SMP
 
-.global unmapped_ap_gdtr
-
-unmapped_ap_gdtr:
+SYMBOL(unmapped_ap_gdtr)
 	.word 0
 	.long 0
Index: uspace/lib/c/arch/ia32/Makefile.inc
===================================================================
--- uspace/lib/c/arch/ia32/Makefile.inc	(revision 3a34852c5ad9335d47aeef1f7d6c94e3b985fb12)
+++ uspace/lib/c/arch/ia32/Makefile.inc	(revision 8844e7075a44097c359d1ef79350efa377c39ec5)
@@ -29,6 +29,6 @@
 ARCH_SOURCES = \
 	arch/$(UARCH)/src/entry.S \
-	arch/$(UARCH)/src/entryjmp.s \
-	arch/$(UARCH)/src/thread_entry.s \
+	arch/$(UARCH)/src/entryjmp.S \
+	arch/$(UARCH)/src/thread_entry.S \
 	arch/$(UARCH)/src/syscall.S \
 	arch/$(UARCH)/src/fibril.S \
Index: uspace/lib/c/arch/ia32/src/entry.S
===================================================================
--- uspace/lib/c/arch/ia32/src/entry.S	(revision 3a34852c5ad9335d47aeef1f7d6c94e3b985fb12)
+++ uspace/lib/c/arch/ia32/src/entry.S	(revision 8844e7075a44097c359d1ef79350efa377c39ec5)
@@ -27,4 +27,6 @@
 #
 
+#include <abi/asmtool.h>
+
 INTEL_CPUID_STANDARD = 1
 INTEL_SEP = 11
@@ -34,11 +36,9 @@
 .org 0
 
-.globl __entry
-
 ## User-space task entry point
 #
 # %edi contains the PCB pointer
 #
-__entry:
+SYMBOL(__entry)
 	mov %ss, %ax
 	mov %ax, %ds
Index: uspace/lib/c/arch/ia32/src/entryjmp.S
===================================================================
--- uspace/lib/c/arch/ia32/src/entryjmp.S	(revision 8844e7075a44097c359d1ef79350efa377c39ec5)
+++ uspace/lib/c/arch/ia32/src/entryjmp.S	(revision 8844e7075a44097c359d1ef79350efa377c39ec5)
@@ -0,0 +1,49 @@
+#
+# Copyright (c) 2008 Jiri Svoboda
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# - Redistributions of source code must retain the above copyright
+#   notice, this list of conditions and the following disclaimer.
+# - Redistributions in binary form must reproduce the above copyright
+#   notice, this list of conditions and the following disclaimer in the
+#   documentation and/or other materials provided with the distribution.
+# - The name of the author may not be used to endorse or promote products
+#   derived from this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+
+#include <abi/asmtool.h>
+
+## void entry_point_jmp(void *entry_point, void *pcb);
+#
+# Jump to program entry point
+SYMBOL(entry_point_jmp)
+	# Use standard ia32 prologue not to confuse anybody
+	push %ebp
+	movl %esp, %ebp
+	
+	# %eax := entry_point
+	movl 0x8(%ebp), %eax
+	
+	# %edi := pcb
+	# pcb is passed to the entry point in %edi
+	mov 0xc(%ebp), %edi
+	
+	# Save a tiny bit of stack space
+	pop %ebp
+	
+	jmp *%eax
Index: pace/lib/c/arch/ia32/src/entryjmp.s
===================================================================
--- uspace/lib/c/arch/ia32/src/entryjmp.s	(revision 3a34852c5ad9335d47aeef1f7d6c94e3b985fb12)
+++ 	(revision )
@@ -1,49 +1,0 @@
-#
-# Copyright (c) 2008 Jiri Svoboda
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-.globl entry_point_jmp
-
-## void entry_point_jmp(void *entry_point, void *pcb);
-#
-# Jump to program entry point
-entry_point_jmp:
-	# Use standard ia32 prologue not to confuse anybody
-	push %ebp
-	movl %esp, %ebp
-	
-	# %eax := entry_point
-	movl 0x8(%ebp), %eax
-	
-	# %edi := pcb
-	# pcb is passed to the entry point in %edi
-	mov 0xc(%ebp), %edi
-	
-	# Save a tiny bit of stack space
-	pop %ebp
-	
-	jmp *%eax
Index: uspace/lib/c/arch/ia32/src/stacktrace_asm.S
===================================================================
--- uspace/lib/c/arch/ia32/src/stacktrace_asm.S	(revision 3a34852c5ad9335d47aeef1f7d6c94e3b985fb12)
+++ uspace/lib/c/arch/ia32/src/stacktrace_asm.S	(revision 8844e7075a44097c359d1ef79350efa377c39ec5)
@@ -27,18 +27,19 @@
 #
 
+#include <abi/asmtool.h>
+
 .text
 
-.global stacktrace_prepare
-.global stacktrace_fp_get
-.global stacktrace_pc_get
+FUNCTION_BEGIN(stacktrace_prepare)
+	ret
+FUNCTION_END(stacktrace_prepare)
 
-stacktrace_prepare:
-	ret
-
-stacktrace_fp_get:
+FUNCTION_BEGIN(stacktrace_fp_get)
 	movl %ebp, %eax
 	ret
+FUNCTION_END(stacktrace_fp_get)
 
-stacktrace_pc_get:
+FUNCTION_BEGIN(stacktrace_pc_get)
 	movl (%esp), %eax
 	ret
+FUNCTION_END(stacktrace_pc_get)
Index: uspace/lib/c/arch/ia32/src/syscall.S
===================================================================
--- uspace/lib/c/arch/ia32/src/syscall.S	(revision 3a34852c5ad9335d47aeef1f7d6c94e3b985fb12)
+++ uspace/lib/c/arch/ia32/src/syscall.S	(revision 8844e7075a44097c359d1ef79350efa377c39ec5)
@@ -27,10 +27,11 @@
 #
 
+#include <abi/asmtool.h>
+
 .data
 
-.global __syscall_fast_func
-__syscall_fast_func:
+OBJECT_BEGIN(__syscall_fast_func)
 	.long __syscall_slow
-	.size __syscall_fast_func, . - __syscall_fast_func
+OBJECT_END(__syscall_fast_func)
 
 .text
@@ -42,6 +43,5 @@
  * could benefit from this and not save unused registers on the stack.
  */
-.global __syscall_slow
-__syscall_slow:
+FUNCTION_BEGIN(__syscall_slow)
 	pushl %ebx
 	pushl %esi
@@ -61,4 +61,5 @@
 	popl %ebx
 	ret
+FUNCTION_END(__syscall_slow)
 
 
@@ -71,8 +72,5 @@
  * segment, otherwise the SYSENTER wouldn't work in the first place).
  */
-.global __syscall_fast
-	.type __syscall_fast, @function
-
-__syscall_fast:
+FUNCTION_BEGIN(__syscall_fast)
 	pushl %ebx
 	pushl %esi
@@ -98,4 +96,3 @@
 	popl %ebx
 	ret
-
-	.size __syscall_fast, . - __syscall_fast
+FUNCTION_END(__syscall_fast)
Index: uspace/lib/c/arch/ia32/src/thread_entry.S
===================================================================
--- uspace/lib/c/arch/ia32/src/thread_entry.S	(revision 8844e7075a44097c359d1ef79350efa377c39ec5)
+++ uspace/lib/c/arch/ia32/src/thread_entry.S	(revision 8844e7075a44097c359d1ef79350efa377c39ec5)
@@ -0,0 +1,59 @@
+#
+# Copyright (c) 2006 Jakub Jermar
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# - Redistributions of source code must retain the above copyright
+#   notice, this list of conditions and the following disclaimer.
+# - Redistributions in binary form must reproduce the above copyright
+#   notice, this list of conditions and the following disclaimer in the
+#   documentation and/or other materials provided with the distribution.
+# - The name of the author may not be used to endorse or promote products
+#   derived from this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+
+#include <abi/asmtool.h>
+
+.text
+
+## User-space thread entry point for all but the first threads.
+#
+#
+SYMBOL_BEGIN(__thread_entry)
+	mov %ss, %dx
+	mov %dx, %ds
+	mov %dx, %es
+	mov %dx, %fs
+	# Do not set %gs, it contains descriptor that can see TLS
+	
+	#
+	# Create the first stack frame.
+	#
+	pushl $0
+	pushl $0
+	mov %esp, %ebp
+	
+	#
+	# EAX contains address of uarg.
+	#
+	pushl %eax
+	call __thread_main
+	
+	#
+	# Not reached.
+	#
+SYMBOL_END(__thread_entry)
Index: pace/lib/c/arch/ia32/src/thread_entry.s
===================================================================
--- uspace/lib/c/arch/ia32/src/thread_entry.s	(revision 3a34852c5ad9335d47aeef1f7d6c94e3b985fb12)
+++ 	(revision )
@@ -1,60 +1,0 @@
-#
-# Copyright (c) 2006 Jakub Jermar
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-.text
-
-.globl __thread_entry
-
-## User-space thread entry point for all but the first threads.
-#
-#
-__thread_entry:
-	mov %ss, %dx
-	mov %dx, %ds
-	mov %dx, %es
-	mov %dx, %fs
-	# Do not set %gs, it contains descriptor that can see TLS
-	
-	#
-	# Create the first stack frame.
-	#
-	pushl $0
-	pushl $0
-	mov %esp, %ebp
-	
-	#
-	# EAX contains address of uarg.
-	#
-	pushl %eax
-	call __thread_main
-	
-	#
-	# Not reached.
-	#
-	
-.end __thread_entry
