Index: uspace/lib/c/arch/amd64/Makefile.inc
===================================================================
--- uspace/lib/c/arch/amd64/Makefile.inc	(revision 8844e7075a44097c359d1ef79350efa377c39ec5)
+++ uspace/lib/c/arch/amd64/Makefile.inc	(revision 96521f2f62397b11b7b23251e5a66693fb739e47)
@@ -28,7 +28,7 @@
 
 ARCH_SOURCES = \
-	arch/$(UARCH)/src/entry.s \
-	arch/$(UARCH)/src/entryjmp.s \
-	arch/$(UARCH)/src/thread_entry.s \
+	arch/$(UARCH)/src/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/amd64/src/entry.S
===================================================================
--- uspace/lib/c/arch/amd64/src/entry.S	(revision 96521f2f62397b11b7b23251e5a66693fb739e47)
+++ uspace/lib/c/arch/amd64/src/entry.S	(revision 96521f2f62397b11b7b23251e5a66693fb739e47)
@@ -0,0 +1,49 @@
+#
+# Copyright (c) 2006 Ondrej Palkovsky
+# 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>
+
+.section .init, "ax"
+
+.org 0
+
+## User-space task entry point
+#
+# %rdi contains the PCB pointer
+#
+SYMBOL(__entry)
+	#
+	# Create the first stack frame.
+	#
+	pushq $0
+	pushq $0
+	movq %rsp, %rbp
+	
+	# %rdi was deliberately chosen as the first argument is also in %rdi
+	# Pass PCB pointer to __main (no operation)
+	call __main
Index: uspace/lib/c/arch/amd64/src/entry.s
===================================================================
--- uspace/lib/c/arch/amd64/src/entry.s	(revision 8844e7075a44097c359d1ef79350efa377c39ec5)
+++ 	(revision )
@@ -1,49 +1,0 @@
-#
-# Copyright (c) 2006 Ondrej Palkovsky
-# 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.
-#
-
-.section .init, "ax"
-
-.org 0
-
-.globl __entry
-
-## User-space task entry point
-#
-# %rdi contains the PCB pointer
-#
-__entry:
-	#
-	# Create the first stack frame.
-	#
-	pushq $0
-	pushq $0
-	movq %rsp, %rbp
-	
-	# %rdi was deliberately chosen as the first argument is also in %rdi
-	# Pass PCB pointer to __main (no operation)
-	call __main
Index: uspace/lib/c/arch/amd64/src/entryjmp.S
===================================================================
--- uspace/lib/c/arch/amd64/src/entryjmp.S	(revision 96521f2f62397b11b7b23251e5a66693fb739e47)
+++ uspace/lib/c/arch/amd64/src/entryjmp.S	(revision 96521f2f62397b11b7b23251e5a66693fb739e47)
@@ -0,0 +1,47 @@
+#
+# 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);
+#
+# %rdi	contains entry_point
+# %rsi	contains pcb
+#
+# Jump to program entry point
+SYMBOL(entry_point_jmp)
+	# use standard amd32 prologue not to confuse anybody
+	push %rbp
+	movq %rsp, %rbp
+	
+	# pcb must be passed in %rdi, use %rdx as a scratch register
+	mov %rdi, %rdx
+	mov %rsi, %rdi
+	
+	# jump to entry point
+	jmp *%rdx
Index: uspace/lib/c/arch/amd64/src/entryjmp.s
===================================================================
--- uspace/lib/c/arch/amd64/src/entryjmp.s	(revision 8844e7075a44097c359d1ef79350efa377c39ec5)
+++ 	(revision )
@@ -1,47 +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);
-#
-# %rdi	contains entry_point
-# %rsi	contains pcb
-#
-# Jump to program entry point
-entry_point_jmp:
-	# use standard amd32 prologue not to confuse anybody
-	push %rbp
-	movq %rsp, %rbp
-	
-	# pcb must be passed in %rdi, use %rdx as a scratch register
-	mov %rdi, %rdx
-	mov %rsi, %rdi
-	
-	# jump to entry point
-	jmp *%rdx
Index: uspace/lib/c/arch/amd64/src/fibril.S
===================================================================
--- uspace/lib/c/arch/amd64/src/fibril.S	(revision 8844e7075a44097c359d1ef79350efa377c39ec5)
+++ uspace/lib/c/arch/amd64/src/fibril.S	(revision 96521f2f62397b11b7b23251e5a66693fb739e47)
@@ -27,10 +27,8 @@
 #
 
+#include <abi/asmtool.h>
+#include <libarch/fibril_context.h>
+
 .text
-
-.global context_save
-.global context_restore
-
-#include <libarch/fibril_context.h>
 
 ## Save current CPU context
@@ -39,5 +37,5 @@
 # pointed by the 1st argument. Returns 1 in EAX.
 #
-context_save:
+FUNCTION_BEGIN(context_save)
 	movq (%rsp), %rdx     # the caller's return %eip
 	
@@ -60,4 +58,5 @@
 	incl %eax
 	ret
+FUNCTION_END(context_save)
 
 ## Restore current CPU context
@@ -66,6 +65,5 @@
 # pointed by the 1st argument. Returns 0 in EAX.
 #
-context_restore:
-	
+FUNCTION_BEGIN(context_restore)
 	movq CONTEXT_OFFSET_R15(%rdi), %r15
 	movq CONTEXT_OFFSET_R14(%rdi), %r14
@@ -88,3 +86,4 @@
 	xorl %eax, %eax                      # context_restore returns 0
 	ret
+FUNCTION_END(context_restore)
 
Index: uspace/lib/c/arch/amd64/src/stacktrace_asm.S
===================================================================
--- uspace/lib/c/arch/amd64/src/stacktrace_asm.S	(revision 8844e7075a44097c359d1ef79350efa377c39ec5)
+++ uspace/lib/c/arch/amd64/src/stacktrace_asm.S	(revision 96521f2f62397b11b7b23251e5a66693fb739e47)
@@ -27,18 +27,20 @@
 #
 
+#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)
 	movq %rbp, %rax
 	ret
+FUNCTION_END(stacktrace_fp_get)
 
-stacktrace_pc_get:
+FUNCTION_BEGIN(stacktrace_pc_get)
 	movq (%rsp), %rax
 	ret
+FUNCTION_END(stacktrace_pc_get)
+
Index: uspace/lib/c/arch/amd64/src/syscall.S
===================================================================
--- uspace/lib/c/arch/amd64/src/syscall.S	(revision 8844e7075a44097c359d1ef79350efa377c39ec5)
+++ uspace/lib/c/arch/amd64/src/syscall.S	(revision 96521f2f62397b11b7b23251e5a66693fb739e47)
@@ -27,7 +27,7 @@
 #
 
+#include <abi/asmtool.h>
+
 .text
-	
-.global __syscall
 	
 ## Make a system call.
@@ -43,5 +43,5 @@
 # @return		The return value will be stored in RAX.
 #
-__syscall:
+FUNCTION_BEGIN(__syscall)
 	#
 	# Move the syscall number into RAX.
@@ -55,3 +55,4 @@
 	syscall
 	ret
+FUNCTION_END(__syscall)
 
Index: uspace/lib/c/arch/amd64/src/thread_entry.S
===================================================================
--- uspace/lib/c/arch/amd64/src/thread_entry.S	(revision 96521f2f62397b11b7b23251e5a66693fb739e47)
+++ uspace/lib/c/arch/amd64/src/thread_entry.S	(revision 96521f2f62397b11b7b23251e5a66693fb739e47)
@@ -0,0 +1,49 @@
+#
+# 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)
+	#
+	# Create the first stack frame.
+	#
+	pushq $0
+	pushq $0
+	movq %rsp, %rbp
+	
+	#
+	# RAX contains address of uarg
+	#
+	movq %rax, %rdi
+	call __thread_main
+SYMBOL_END(__thread_entry)
Index: uspace/lib/c/arch/amd64/src/thread_entry.s
===================================================================
--- uspace/lib/c/arch/amd64/src/thread_entry.s	(revision 8844e7075a44097c359d1ef79350efa377c39ec5)
+++ 	(revision )
@@ -1,50 +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:
-	#
-	# Create the first stack frame.
-	#
-	pushq $0
-	pushq $0
-	movq %rsp, %rbp
-	
-	#
-	# RAX contains address of uarg
-	#
-	movq %rax, %rdi
-	call __thread_main
-	
-.end __thread_entry
Index: uspace/lib/math/arch/amd64/src/cos.S
===================================================================
--- uspace/lib/math/arch/amd64/src/cos.S	(revision 8844e7075a44097c359d1ef79350efa377c39ec5)
+++ uspace/lib/math/arch/amd64/src/cos.S	(revision 96521f2f62397b11b7b23251e5a66693fb739e47)
@@ -27,11 +27,10 @@
 #
 
+#include <abi/asmtool.h>
 #include <libarch/x87.h>
 
 .text
 
-.global cos_f64
-
-cos_f64:
+FUNCTION_BEGIN(cos_f64)
 	pushq %rbp
 	movq %rsp, %rbp
@@ -77,2 +76,3 @@
 	leave
 	retq
+FUNCTION_END(cos_f64)
Index: uspace/lib/math/arch/amd64/src/sin.S
===================================================================
--- uspace/lib/math/arch/amd64/src/sin.S	(revision 8844e7075a44097c359d1ef79350efa377c39ec5)
+++ uspace/lib/math/arch/amd64/src/sin.S	(revision 96521f2f62397b11b7b23251e5a66693fb739e47)
@@ -27,11 +27,10 @@
 #
 
+#include <abi/asmtool.h>
 #include <libarch/x87.h>
 
 .text
 
-.global sin_f64
-
-sin_f64:
+FUNCTION_BEGIN(sin_f64)
 	pushq %rbp
 	movq %rsp, %rbp
@@ -77,2 +76,4 @@
 	leave
 	retq
+FUNCTION_END(sin_f64)
+
Index: uspace/lib/math/arch/amd64/src/trunc.S
===================================================================
--- uspace/lib/math/arch/amd64/src/trunc.S	(revision 8844e7075a44097c359d1ef79350efa377c39ec5)
+++ uspace/lib/math/arch/amd64/src/trunc.S	(revision 96521f2f62397b11b7b23251e5a66693fb739e47)
@@ -27,11 +27,10 @@
 #
 
+#include <abi/asmtool.h>
 #include <libarch/x87.h>
 
 .text
 
-.global trunc_f64
-
-trunc_f64:
+FUNCTION_BEGIN(trunc_f64)
 	pushq %rbp
 	movq %rsp, %rbp
@@ -63,2 +62,3 @@
 	leave
 	retq
+FUNCTION_END(trunc_f64)
