DARWIN branch.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@9601
/* Useful listing:
gcc -o tests/fpu_28_108 tests/fpu_28_108.S -Wa,-a */
+#include "tests/asm.h"
+
.data
fooble:
.long 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
bar:
.text
-.globl main
-main:
+.globl VG_SYM_ASM(main)
+VG_SYM_ASM(main):
fstsw fooble
fsave fooble
frstor fooble
ret
#endif
-#if defined(VGA_x86) || defined(VGA_amd64)
+#if defined(VGO_linux)
/* Let the linker know we don't need an executable stack */
.section .note.GNU-stack,"",@progbits
#endif
// everywhere.
//--------------------------------------------------------------------
-#include "pub_core_basics_asm.h"
#include "pub_tool_basics.h"
/* ---------------------------------------------------------------------
/*--------------------------------------------------------------------*/
-/*--- Header imported directly by every core asm file, and ---*/
-/*--- (via pub_core_basics.h) by every core C file. ---*/
+/*--- Header imported directly by every core asm file. ---*/
/*--- pub_core_basics_asm.h ---*/
/*--------------------------------------------------------------------*/
#define __PUB_CORE_BASICS_ASM_H
//--------------------------------------------------------------------
-// PURPOSE: This header should be imported by every single asm and
-// (indirectly) by every C file in the core. It contains really basic
-// things needed everywhere.
+// PURPOSE: This header should be imported by every single asm file
+// in the core. It contains really basic things needed everywhere.
//--------------------------------------------------------------------
#include "pub_tool_basics_asm.h"
// Addr32, Addr64, HWord, HChar, Bool, False and True.
#include "libvex_basictypes.h"
-// For the VG_() macro
-#include "pub_tool_basics_asm.h"
-
// For varargs types
#include <stdarg.h>
#include "config.h"
+/* ---------------------------------------------------------------------
+ symbol prefixing
+ ------------------------------------------------------------------ */
+
+// All symbols externally visible from Valgrind are prefixed
+// as specified here to avoid namespace conflict problems.
+//
+// VG_ is for symbols exported from modules. ML_ (module-local) is
+// for symbols which are not intended to be visible outside modules,
+// but which cannot be declared as C 'static's since they need to be
+// visible across C files within a given module. It is a mistake for
+// a ML_ name to appear in a pub_core_*.h or pub_tool_*.h file.
+// Likewise it is a mistake for a VG_ name to appear in a priv_*.h
+// file.
+
+#define VGAPPEND(str1,str2) str1##str2
+
+#define VG_(str) VGAPPEND(vgPlain_, str)
+#define ML_(str) VGAPPEND(vgModuleLocal_, str)
+
+
/* ---------------------------------------------------------------------
builtin types
------------------------------------------------------------------ */
/*--------------------------------------------------------------------*/
-/*--- Header imported directly by every tool asm file, and ---*/
-/*--- (via pub_tool_basics.h) by every tool C file. ---*/
+/*--- Header imported directly by every tool asm file. ---*/
/*--- pub_tool_basics_asm.h ---*/
/*--------------------------------------------------------------------*/
#ifndef __PUB_TOOL_BASICS_ASM_H
#define __PUB_TOOL_BASICS_ASM_H
-/* All symbols externally visible from Valgrind are prefixed
- as specified here to avoid namespace conflict problems. */
+// See pub_tool_basics.h for the purpose of these macros.
+//
+// Note that although the macros here (which are used in asm files) have the
+// same name as those in pub_tool_basics.h (which are used in C files), they
+// have different definitions. Actually, on Linux the definitions are the
+// same, but on Darwin they are different. The reason is that C names on
+// Darwin always get a '_' prepended to them by the compiler. But in order to
+// refer to them from asm code, we have to add the '_' ourselves. Having two
+// versions of these macros makes that difference transparent, so we can use
+// VG_/ML_ in both asm and C files.
+//
+// Note also that the exact prefixes used have to match those used in
+// pub_tool_basics.h.
#define VGAPPEND(str1,str2) str1##str2
-
-/* VG_ is for symbols exported from modules. ML_ (module-local) is
- for symbols which are not intended to be visible outside modules,
- but which cannot be declared as C 'static's since they need to be
- visible across C files within a given module. It is a mistake for
- a ML_ name to appear in a pub_core_*.h or pub_tool_*.h file.
- Likewise it is a mistake for a VG_ name to appear in a priv_*.h
- file.
-*/
+
#define VG_(str) VGAPPEND(vgPlain_, str)
#define ML_(str) VGAPPEND(vgModuleLocal_, str)
ignore2(x, ignored_x);
x = realloc(ignored_x, 0); // equivalent to 'free(ignored_x)'.
+
+ return 0;
}
#define VG_SYM(x) #x
// This one is for use in asm files.
-#define VG_SYM_ASM(x) _#x
+#define VG_SYM_ASM(x) x