]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Merge r9600 (separate VG_ and ML_ definitions for C and asm files) from the
authorNicholas Nethercote <njn@valgrind.org>
Fri, 24 Apr 2009 04:57:07 +0000 (04:57 +0000)
committerNicholas Nethercote <njn@valgrind.org>
Fri, 24 Apr 2009 04:57:07 +0000 (04:57 +0000)
DARWIN branch.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@9601

cachegrind/tests/x86/fpu-28-108.S
coregrind/m_cpuid.S
coregrind/pub_core_basics.h
coregrind/pub_core_basics_asm.h
include/pub_tool_basics.h
include/pub_tool_basics_asm.h
massif/tests/ignored.c
tests/asm.h

index f655c00f79f336fbf090e1387680cfb3d50eb7bd..54b2da6500c4d1c5116914ada8706c592dc1e46a 100644 (file)
@@ -4,6 +4,8 @@
 /* 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
@@ -12,8 +14,8 @@ fooble:
 bar:
         
 .text
-.globl main
-main:
+.globl VG_SYM_ASM(main)
+VG_SYM_ASM(main):
         fstsw   fooble
         fsave   fooble
         frstor  fooble
index 37e609f0144ab0b2d793256baa19d57949a811d0..d7dcff3253a48d8583b1506874d260ff752475d7 100644 (file)
         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
index 99053f58948dedc987ca7a30a69a1ac61e629db0..eb38f6b8f6b46ac24b99a3a1a2766e300658cfec 100644 (file)
@@ -37,7 +37,6 @@
 // everywhere.
 //--------------------------------------------------------------------
 
-#include "pub_core_basics_asm.h"
 #include "pub_tool_basics.h"
 
 /* ---------------------------------------------------------------------
index d413f45244d408a8e3ff3b754366aa8ec86715e9..a71e8ffeccbae0cdd9833c5a16b0b86a03ebb4bb 100644 (file)
@@ -1,7 +1,6 @@
 
 /*--------------------------------------------------------------------*/
-/*--- 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 ---*/
 /*--------------------------------------------------------------------*/
 
@@ -34,9 +33,8 @@
 #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"
index a21b0b604ae538f19546353ac33adc2b1f373dba..9bff837fcbbbea7f83106bb40054b572929193c9 100644 (file)
@@ -46,9 +46,6 @@
 // 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
    ------------------------------------------------------------------ */
index 426ce82b35f9a41ce399068e3de7d33557256e35..201c1b5afa2d7301945b75cc27700dadf39dc490 100644 (file)
@@ -1,7 +1,6 @@
 
 /*--------------------------------------------------------------------*/
-/*--- 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)
 
index be16f69c5d30f9819aaf4d4a2717acba71108180..8b1bf08ca5bd2310c52f28bf0107c20ba51d9dd7 100644 (file)
@@ -45,5 +45,7 @@ int main(void)
    ignore2(x, ignored_x);
 
    x = realloc(ignored_x, 0);    // equivalent to 'free(ignored_x)'.
+
+   return 0;
 }
 
index 0fd5cb3bacd9213d0677d685bd57c08d53485500..99f9cc5a54e53ab4c7058bbc076583e804a43d2c 100644 (file)
@@ -8,4 +8,4 @@
 #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