2 /*--------------------------------------------------------------------*/
3 /*--- Header imported directly by every tool asm file. ---*/
4 /*--- pub_tool_basics_asm.h ---*/
5 /*--------------------------------------------------------------------*/
8 This file is part of Valgrind, a dynamic binary instrumentation
11 Copyright (C) 2000-2017 Julian Seward
14 This program is free software; you can redistribute it and/or
15 modify it under the terms of the GNU General Public License as
16 published by the Free Software Foundation; either version 2 of the
17 License, or (at your option) any later version.
19 This program is distributed in the hope that it will be useful, but
20 WITHOUT ANY WARRANTY; without even the implied warranty of
21 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
22 General Public License for more details.
24 You should have received a copy of the GNU General Public License
25 along with this program; if not, see <http://www.gnu.org/licenses/>.
27 The GNU General Public License is contained in the file COPYING.
30 #ifndef __PUB_TOOL_BASICS_ASM_H
31 #define __PUB_TOOL_BASICS_ASM_H
33 // See pub_tool_basics.h for the purpose of these macros.
35 // Note that although the macros here (which are used in asm files) have the
36 // same name as those in pub_tool_basics.h (which are used in C files), they
37 // have different definitions. Actually, on Linux the definitions are the
38 // same, but on Darwin they are different. The reason is that C names on
39 // Darwin always get a '_' prepended to them by the compiler. But in order to
40 // refer to them from asm code, we have to add the '_' ourselves. Having two
41 // versions of these macros makes that difference transparent, so we can use
42 // VG_/ML_ in both asm and C files.
44 // Note also that the exact prefixes used have to match those used in
47 #define VGAPPEND(str1,str2) str1##str2
49 #if defined(VGO_linux) || defined(VGO_solaris) || defined(VGO_freebsd)
50 # define VG_(str) VGAPPEND( vgPlain_, str)
51 # define ML_(str) VGAPPEND( vgModuleLocal_, str)
52 #elif defined(VGO_darwin)
53 # define VG_(str) VGAPPEND(_vgPlain_, str)
54 # define ML_(str) VGAPPEND(_vgModuleLocal_, str)
59 /* Let the linker know we don't need an executable stack.
60 The call to MARK_STACK_NO_EXEC should be put unconditionally
61 at the end of all asm source files.
63 #if defined(VGO_linux) || defined(VGO_freebsd)
65 # define MARK_STACK_NO_EXEC .section .note.GNU-stack,"",%progbits
67 # define MARK_STACK_NO_EXEC .section .note.GNU-stack,"",@progbits
70 # define MARK_STACK_NO_EXEC
73 #endif /* __PUB_TOOL_BASICS_ASM_H */
75 /*--------------------------------------------------------------------*/
77 /*--------------------------------------------------------------------*/