|
From: <sv...@va...> - 2009-04-24 04:37:39
|
Author: njn
Date: 2009-04-24 05:37:30 +0100 (Fri, 24 Apr 2009)
New Revision: 9600
Log:
Separate VG_ and ML_ definitions for asm files vs. C files. This lets us
paper over the fact that C names in Darwin get an underscore prepended to
them, and get rid of the _VG_ and _ML_ macros that were being used on
Darwin.
As part of this, pub_{core,tool}_basics_asm.h only now are included in asm
files, not C files. This is no great loss as they only included the VG_ and
ML_ definitions.
This allowed m_cpuid-{x86,amd64}-darwin.S to be removed; m_cpuid.S can now
be used as is on Darwin.
Also removed an unnecessary bit of conditional compilation in fpu-28-108.S
and fixed VG_SYM_ASM in tests/asm.h.
Removed:
branches/DARWIN/coregrind/m_cpuid-amd64-darwin.S
branches/DARWIN/coregrind/m_cpuid-x86-darwin.S
Modified:
branches/DARWIN/cachegrind/tests/x86/fpu-28-108.S
branches/DARWIN/coregrind/Makefile.am
branches/DARWIN/coregrind/m_cpuid.S
branches/DARWIN/coregrind/m_dispatch/dispatch-amd64-darwin.S
branches/DARWIN/coregrind/m_dispatch/dispatch-x86-darwin.S
branches/DARWIN/coregrind/m_start-amd64-darwin.S
branches/DARWIN/coregrind/m_start-x86-darwin.S
branches/DARWIN/coregrind/m_syswrap/syscall-amd64-darwin.S
branches/DARWIN/coregrind/m_syswrap/syscall-x86-darwin.S
branches/DARWIN/coregrind/m_trampoline.S
branches/DARWIN/coregrind/pub_core_basics.h
branches/DARWIN/coregrind/pub_core_basics_asm.h
branches/DARWIN/include/pub_tool_basics.h
branches/DARWIN/include/pub_tool_basics_asm.h
branches/DARWIN/tests/asm.h
Modified: branches/DARWIN/cachegrind/tests/x86/fpu-28-108.S
===================================================================
--- branches/DARWIN/cachegrind/tests/x86/fpu-28-108.S 2009-04-24 04:28:15 UTC (rev 9599)
+++ branches/DARWIN/cachegrind/tests/x86/fpu-28-108.S 2009-04-24 04:37:30 UTC (rev 9600)
@@ -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,13 +14,8 @@
bar:
.text
-#if defined(__APPLE__)
-.globl _main
-_main:
-#else
-.globl main
-main:
-#endif
+.globl VG_SYM_ASM(main)
+VG_SYM_ASM(main):
fstsw fooble
fsave fooble
frstor fooble
Modified: branches/DARWIN/coregrind/Makefile.am
===================================================================
--- branches/DARWIN/coregrind/Makefile.am 2009-04-24 04:28:15 UTC (rev 9599)
+++ branches/DARWIN/coregrind/Makefile.am 2009-04-24 04:37:30 UTC (rev 9600)
@@ -455,19 +455,17 @@
libcoregrind_ppc64_aix5_a_CCASFLAGS = $(AM_CCASFLAGS_PPC64_AIX5)
libcoregrind_ppc64_aix5_a_AR = $(AR) -X64 cru
-# DDD: m_cpuid-x86-darwin.S should be merged into m_cpuid.S, they're very
-# similar. Likewise for m_cpuid-amd64-darwin.S.
libcoregrind_x86_darwin_a_SOURCES = \
$(COREGRIND_SOURCES_COMMON) \
$(COREGRIND_DARWIN_SOURCE) \
m_coredump/coredump-x86-darwin.c \
+ m_cpuid.S \
m_dispatch/dispatch-x86-darwin.S \
- m_sigframe/sigframe-x86-darwin.c \
- m_syswrap/syscall-x86-darwin.S \
- m_syswrap/syswrap-x86-darwin.c \
m_mach/mach_traps-x86-darwin.S \
+ m_sigframe/sigframe-x86-darwin.c \
m_start-x86-darwin.S \
- m_cpuid-x86-darwin.S
+ m_syswrap/syscall-x86-darwin.S \
+ m_syswrap/syswrap-x86-darwin.c
libcoregrind_x86_darwin_a_CPPFLAGS = $(AM_CPPFLAGS_X86_DARWIN)
libcoregrind_x86_darwin_a_CFLAGS = $(AM_CFLAGS_X86_DARWIN)
libcoregrind_x86_darwin_a_CCASFLAGS = $(AM_CCASFLAGS_X86_DARWIN)
@@ -477,13 +475,13 @@
$(COREGRIND_SOURCES_COMMON) \
$(COREGRIND_DARWIN_SOURCE) \
m_coredump/coredump-amd64-darwin.c \
+ m_cpuid.S \
m_dispatch/dispatch-amd64-darwin.S \
- m_sigframe/sigframe-amd64-darwin.c \
- m_syswrap/syscall-amd64-darwin.S \
- m_syswrap/syswrap-amd64-darwin.c \
m_mach/mach_traps-amd64-darwin.S \
+ m_sigframe/sigframe-amd64-darwin.c \
m_start-amd64-darwin.S \
- m_cpuid-amd64-darwin.S
+ m_syswrap/syscall-amd64-darwin.S \
+ m_syswrap/syswrap-amd64-darwin.c
libcoregrind_amd64_darwin_a_CPPFLAGS = $(AM_CPPFLAGS_AMD64_DARWIN)
libcoregrind_amd64_darwin_a_CFLAGS = $(AM_CFLAGS_AMD64_DARWIN)
libcoregrind_amd64_darwin_a_CCASFLAGS = $(AM_CCASFLAGS_AMD64_DARWIN)
Deleted: branches/DARWIN/coregrind/m_cpuid-amd64-darwin.S
===================================================================
--- branches/DARWIN/coregrind/m_cpuid-amd64-darwin.S 2009-04-24 04:28:15 UTC (rev 9599)
+++ branches/DARWIN/coregrind/m_cpuid-amd64-darwin.S 2009-04-24 04:37:30 UTC (rev 9600)
@@ -1,84 +0,0 @@
-
-/*--------------------------------------------------------------------*/
-/*--- CPUID interface. m_cpuid-amd64-darwin.S ---*/
-/*--------------------------------------------------------------------*/
-
-/*
- This file is part of Valgrind, a dynamic binary instrumentation
- framework.
-
- Copyright (C) 2000-2007 Julian Seward
- js...@ac...
-
- This program is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- This program is distributed in the hope that it will be useful, but
- WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307, USA.
-
- The GNU General Public License is contained in the file COPYING.
-*/
-
-#include "pub_core_basics_asm.h"
-
-/*
- Bool VG_(has_cpuid)(void)
- */
-.globl _VG_(has_cpuid)
-_VG_(has_cpuid):
- movq $1, %rax
- ret
-
-/*
- void VG_(cpuid)(UInt eax,
- UInt* eax_ret, UInt* ebx_ret, UInt* ecx_ret, UInt* edx_ret)
- */
-.globl _VG_(cpuid)
-_VG_(cpuid):
- pushq %rbp
- movq %rsp, %rbp
- pushq %rbx
- movl %edi, %eax
- movq %rdx, %rdi
- movq %rcx, %r9
- /*
- eax_ret now in %rsi
- ebx_ret now in %rdi
- ecx_ret now in %r9
- edx_ret now in %r8
- */
- cpuid
- testq %rsi, %rsi
- jz 1f
- movl %eax, (%rsi)
- 1:
- testq %rdi, %rdi
- jz 2f
- movl %ebx, (%rdi)
- 2:
- testq %r9, %r9
- jz 3f
- movl %ecx, (%r9)
- 3:
- testq %r8, %r8
- jz 4f
- movl %edx, (%r8)
- 4:
- popq %rbx
- movq %rbp, %rsp
- popq %rbp
- ret
-
-
-/*--------------------------------------------------------------------*/
-/*--- end ---*/
-/*--------------------------------------------------------------------*/
Deleted: branches/DARWIN/coregrind/m_cpuid-x86-darwin.S
===================================================================
--- branches/DARWIN/coregrind/m_cpuid-x86-darwin.S 2009-04-24 04:28:15 UTC (rev 9599)
+++ branches/DARWIN/coregrind/m_cpuid-x86-darwin.S 2009-04-24 04:37:30 UTC (rev 9600)
@@ -1,88 +0,0 @@
-
-/*--------------------------------------------------------------------*/
-/*--- CPUID interface. m_cpuid-x86-darwin.S ---*/
-/*--------------------------------------------------------------------*/
-
-/*
- This file is part of Valgrind, a dynamic binary instrumentation
- framework.
-
- Copyright (C) 2000-2006 Julian Seward
- js...@ac...
-
- This program is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- This program is distributed in the hope that it will be useful, but
- WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307, USA.
-
- The GNU General Public License is contained in the file COPYING.
-*/
-
-#include "pub_tool_basics_asm.h"
-
-/*
- Bool VG_(has_cpuid)(void)
- Assume everything Darwin runs on has cpuid.
- */
-.globl _VG_(has_cpuid)
-_VG_(has_cpuid):
- movl $1, %eax
- ret
-
-/*
- void VG_(cpuid)(UInt eax,
- UInt* eax_ret, UInt* ebx_ret, UInt* ecx_ret, UInt* edx_ret)
- */
-.globl _VG_(cpuid)
-_VG_(cpuid):
- pushl %ebp
- movl %esp, %ebp
- pushl %eax
- pushl %ebx
- pushl %ecx
- pushl %edx
- pushl %esi
- movl 8(%ebp), %eax
- cpuid
- movl 12(%ebp), %esi
- testl %esi, %esi
- jz 1f
- movl %eax, (%esi)
- 1:
- movl 16(%ebp), %esi
- testl %esi, %esi
- jz 2f
- movl %ebx, (%esi)
- 2:
- movl 20(%ebp), %esi
- testl %esi, %esi
- jz 3f
- movl %ecx, (%esi)
- 3:
- movl 24(%ebp), %esi
- testl %esi, %esi
- jz 4f
- movl %edx, (%esi)
- 4:
- popl %esi
- popl %edx
- popl %ecx
- popl %ebx
- popl %eax
- movl %ebp, %esp
- popl %ebp
- ret
-
-/*--------------------------------------------------------------------*/
-/*--- end ---*/
-/*--------------------------------------------------------------------*/
Modified: branches/DARWIN/coregrind/m_cpuid.S
===================================================================
--- branches/DARWIN/coregrind/m_cpuid.S 2009-04-24 04:28:15 UTC (rev 9599)
+++ branches/DARWIN/coregrind/m_cpuid.S 2009-04-24 04:37:30 UTC (rev 9600)
@@ -143,7 +143,7 @@
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
Modified: branches/DARWIN/coregrind/m_dispatch/dispatch-amd64-darwin.S
===================================================================
--- branches/DARWIN/coregrind/m_dispatch/dispatch-amd64-darwin.S 2009-04-24 04:28:15 UTC (rev 9599)
+++ branches/DARWIN/coregrind/m_dispatch/dispatch-amd64-darwin.S 2009-04-24 04:37:30 UTC (rev 9600)
@@ -51,8 +51,8 @@
*/
.text
-.globl _VG_(run_innerloop)
-_VG_(run_innerloop):
+.globl VG_(run_innerloop)
+VG_(run_innerloop):
/* %rdi holds guest_state */
/* %rsi holds do_profiling */
@@ -72,7 +72,7 @@
pushq %r15
pushq %rdi /* guest_state */
- movq _VG_(dispatch_ctr)@GOTPCREL(%rip), %r15
+ movq VG_(dispatch_ctr)@GOTPCREL(%rip), %r15
movl (%r15), %r15d
pushq %r15
@@ -104,8 +104,8 @@
/* fall into main loop (the right one) */
cmpq $0, %rsi
- je _VG_(run_innerloop__dispatch_unprofiled)
- jmp _VG_(run_innerloop__dispatch_profiled)
+ je VG_(run_innerloop__dispatch_unprofiled)
+ jmp VG_(run_innerloop__dispatch_profiled)
/*NOTREACHED*/
/*----------------------------------------------------*/
@@ -113,14 +113,14 @@
/*----------------------------------------------------*/
.align 4
-.globl _VG_(run_innerloop__dispatch_unprofiled)
-_VG_(run_innerloop__dispatch_unprofiled):
+.globl VG_(run_innerloop__dispatch_unprofiled)
+VG_(run_innerloop__dispatch_unprofiled):
/* AT ENTRY: %rax is next guest addr, %rbp is possibly
modified guest state ptr */
/* Has the guest state pointer been messed with? If yes, exit. */
cmpq 8(%rsp), %rbp
- movq _VG_(tt_fast)@GOTPCREL(%rip), %rcx
+ movq VG_(tt_fast)@GOTPCREL(%rip), %rcx
jnz gsp_changed
/* save the jump address in the guest state */
@@ -151,14 +151,14 @@
/*----------------------------------------------------*/
.align 4
-.globl _VG_(run_innerloop__dispatch_profiled)
-_VG_(run_innerloop__dispatch_profiled):
+.globl VG_(run_innerloop__dispatch_profiled)
+VG_(run_innerloop__dispatch_profiled):
/* AT ENTRY: %rax is next guest addr, %rbp is possibly
modified guest state ptr */
/* Has the guest state pointer been messed with? If yes, exit. */
cmpq 8(%rsp), %rbp
- movq _VG_(tt_fast)@GOTPCREL(%rip), %rcx
+ movq VG_(tt_fast)@GOTPCREL(%rip), %rcx
jnz gsp_changed
/* save the jump address in the guest state */
@@ -178,7 +178,7 @@
jnz fast_lookup_failed
/* increment bb profile counter */
- movq _VG_(tt_fastN)@GOTPCREL(%rip), %rdx
+ movq VG_(tt_fastN)@GOTPCREL(%rip), %rdx
shrq $1, %rbx /* entry# * sizeof(UInt*) */
movq (%rdx,%rbx,1), %rdx
addl $1, (%rdx)
@@ -256,7 +256,7 @@
/* restore VG_(dispatch_ctr) */
popq %r14
- movq _VG_(dispatch_ctr)@GOTPCREL(%rip), %r15
+ movq VG_(dispatch_ctr)@GOTPCREL(%rip), %r15
movl %r14d, (%r15)
popq %rdi
@@ -295,8 +295,8 @@
3: output: guest state pointer afterwards (== thread return code)
*/
.align 4
-.globl _VG_(run_a_noredir_translation)
-_VG_(run_a_noredir_translation):
+.globl VG_(run_a_noredir_translation)
+VG_(run_a_noredir_translation):
/* Save callee-saves regs */
pushq %rbx
pushq %rbp
@@ -312,8 +312,8 @@
ud2
/* If the translation has been correctly constructed, we
should resume at the the following label. */
-.globl _VG_(run_a_noredir_translation__return_point)
-_VG_(run_a_noredir_translation__return_point):
+.globl VG_(run_a_noredir_translation__return_point)
+VG_(run_a_noredir_translation__return_point):
popq %rdi
movq %rax, 16(%rdi)
movq %rbp, 24(%rdi)
Modified: branches/DARWIN/coregrind/m_dispatch/dispatch-x86-darwin.S
===================================================================
--- branches/DARWIN/coregrind/m_dispatch/dispatch-x86-darwin.S 2009-04-24 04:28:15 UTC (rev 9599)
+++ branches/DARWIN/coregrind/m_dispatch/dispatch-x86-darwin.S 2009-04-24 04:37:30 UTC (rev 9600)
@@ -42,15 +42,15 @@
.align 2
/* m_transtab.c */
-.globl _VG_(tt_fast)
+.globl VG_(tt_fast)
.align 4
-_VG_(tt_fast): .space VG_TT_FAST_SIZE*8, 0 /* (2*Addr) [VG_TT_FAST_SIZE] */
-.globl _VG_(tt_fastN)
-_VG_(tt_fastN): .space VG_TT_FAST_SIZE*4, 0 /* (UInt *) [VG_TT_FAST_SIZE] */
+VG_(tt_fast): .space VG_TT_FAST_SIZE*8, 0 /* (2*Addr) [VG_TT_FAST_SIZE] */
+.globl VG_(tt_fastN)
+VG_(tt_fastN): .space VG_TT_FAST_SIZE*4, 0 /* (UInt *) [VG_TT_FAST_SIZE] */
/* scheduler.c */
-.globl _VG_(dispatch_ctr)
-_VG_(dispatch_ctr): .long 0
+.globl VG_(dispatch_ctr)
+VG_(dispatch_ctr): .long 0
/*------------------------------------------------------------*/
@@ -65,15 +65,15 @@
/*----------------------------------------------------*/
/* signature:
-UWord _VG_(run_innerloop) ( void* guest_state, UWord do_profiling );
+UWord VG_(run_innerloop) ( void* guest_state, UWord do_profiling );
*/
.text
-.globl _VG_(run_innerloop)
-_VG_(run_innerloop):
+.globl VG_(run_innerloop)
+VG_(run_innerloop):
/* 4(%esp) holds guest_state */
/* 8(%esp) holds do_profiling */
- /* ----- entry point to _VG_(run_innerloop) ----- */
+ /* ----- entry point to VG_(run_innerloop) ----- */
pushl %ebx
pushl %ecx
pushl %edx
@@ -100,7 +100,7 @@
/* set host SSE control word to the default mode expected
by VEX-generated code. */
- cmpl $0, _VG_(machine_x86_have_mxcsr)
+ cmpl $0, VG_(machine_x86_have_mxcsr)
jz L1
pushl $0x1F80
ldmxcsr (%esp)
@@ -111,16 +111,16 @@
/* fall into main loop (the right one) */
cmpl $0, 32(%esp) /* do_profiling */
- je _VG_(run_innerloop__dispatch_unprofiled)
- jmp _VG_(run_innerloop__dispatch_profiled)
+ je VG_(run_innerloop__dispatch_unprofiled)
+ jmp VG_(run_innerloop__dispatch_profiled)
/*NOTREACHED*/
/*----------------------------------------------------*/
/*--- NO-PROFILING (standard) dispatcher ---*/
/*----------------------------------------------------*/
-.globl _VG_(run_innerloop__dispatch_unprofiled)
-_VG_(run_innerloop__dispatch_unprofiled):
+.globl VG_(run_innerloop__dispatch_unprofiled)
+VG_(run_innerloop__dispatch_unprofiled):
/* AT ENTRY: %eax is next guest addr, %ebp is possibly
modified guest state ptr */
@@ -132,14 +132,14 @@
movl %eax, OFFSET_x86_EIP(%ebp)
/* Are we out of timeslice? If yes, defer to scheduler. */
- subl $1, _VG_(dispatch_ctr)
+ subl $1, VG_(dispatch_ctr)
jz counter_is_zero
/* try a fast lookup in the translation cache */
movl %eax, %ebx
andl $VG_TT_FAST_MASK, %ebx
- movl 0+_VG_(tt_fast)(,%ebx,8), %esi /* .guest */
- movl 4+_VG_(tt_fast)(,%ebx,8), %edi /* .host */
+ movl 0+VG_(tt_fast)(,%ebx,8), %esi /* .guest */
+ movl 4+VG_(tt_fast)(,%ebx,8), %edi /* .host */
cmpl %eax, %esi
jnz fast_lookup_failed
@@ -147,15 +147,15 @@
jmp *%edi
ud2 /* persuade insn decoders not to speculate past here */
/* generated code should run, then jump back to
- _VG_(run_innerloop__dispatch_unprofiled). */
+ VG_(run_innerloop__dispatch_unprofiled). */
/*NOTREACHED*/
/*----------------------------------------------------*/
/*--- PROFILING dispatcher (can be much slower) ---*/
/*----------------------------------------------------*/
-.globl _VG_(run_innerloop__dispatch_profiled)
-_VG_(run_innerloop__dispatch_profiled):
+.globl VG_(run_innerloop__dispatch_profiled)
+VG_(run_innerloop__dispatch_profiled):
/* AT ENTRY: %eax is next guest addr, %ebp is possibly
modified guest state ptr */
@@ -167,20 +167,20 @@
movl %eax, OFFSET_x86_EIP(%ebp)
/* Are we out of timeslice? If yes, defer to scheduler. */
- subl $1, _VG_(dispatch_ctr)
+ subl $1, VG_(dispatch_ctr)
jz counter_is_zero
/* try a fast lookup in the translation cache */
movl %eax, %ebx
andl $VG_TT_FAST_MASK, %ebx
- movl 0+_VG_(tt_fast)(,%ebx,8), %esi /* .guest */
- movl 4+_VG_(tt_fast)(,%ebx,8), %edi /* .host */
+ movl 0+VG_(tt_fast)(,%ebx,8), %esi /* .guest */
+ movl 4+VG_(tt_fast)(,%ebx,8), %edi /* .host */
cmpl %eax, %esi
jnz fast_lookup_failed
/* increment bb profile counter */
/* note: innocuous as this sounds, it causes a huge amount more
stress on D1 and significantly slows everything down. */
- movl _VG_(tt_fastN)(,%ebx,4), %edx
+ movl VG_(tt_fastN)(,%ebx,4), %edx
/* Use "addl $1", not "incl", to avoid partial-flags stall on P4 */
addl $1, (%edx)
@@ -188,7 +188,7 @@
jmp *%edi
ud2 /* persuade insn decoders not to speculate past here */
/* generated code should run, then jump back to
- _VG_(run_innerloop__dispatch_profiled). */
+ VG_(run_innerloop__dispatch_profiled). */
/*NOTREACHED*/
/*----------------------------------------------------*/
@@ -212,7 +212,7 @@
counter_is_zero:
/* %EIP is up to date here */
/* back out decrement of the dispatch counter */
- addl $1, _VG_(dispatch_ctr)
+ addl $1, VG_(dispatch_ctr)
movl $VG_TRC_INNER_COUNTERZERO, %eax
jmp run_innerloop_exit
/*NOTREACHED*/
@@ -220,7 +220,7 @@
fast_lookup_failed:
/* %EIP is up to date here */
/* back out decrement of the dispatch counter */
- addl $1, _VG_(dispatch_ctr)
+ addl $1, VG_(dispatch_ctr)
movl $VG_TRC_INNER_FASTMISS, %eax
jmp run_innerloop_exit
/*NOTREACHED*/
@@ -242,7 +242,7 @@
popl %esi /* get rid of the word without trashing %eflags */
jnz invariant_violation
#endif
- cmpl $0, _VG_(machine_x86_have_mxcsr)
+ cmpl $0, VG_(machine_x86_have_mxcsr)
jz L2
pushl $0
stmxcsr (%esp)
@@ -275,7 +275,7 @@
/*------------------------------------------------------------*/
/* signature:
-void _VG_(run_a_noredir_translation) ( UWord* argblock );
+void VG_(run_a_noredir_translation) ( UWord* argblock );
*/
/* Run a no-redir translation. argblock points to 4 UWords, 2 to carry args
@@ -285,8 +285,8 @@
2: output: next guest PC
3: output: guest state pointer afterwards (== thread return code)
*/
-.globl _VG_(run_a_noredir_translation)
-_VG_(run_a_noredir_translation):
+.globl VG_(run_a_noredir_translation)
+VG_(run_a_noredir_translation):
/* Save callee-saves regs */
pushl %esi
pushl %edi
@@ -300,8 +300,8 @@
ud2
/* If the translation has been correctly constructed, we
should resume at the the following label. */
-.globl _VG_(run_a_noredir_translation__return_point)
-_VG_(run_a_noredir_translation__return_point):
+.globl VG_(run_a_noredir_translation__return_point)
+VG_(run_a_noredir_translation__return_point):
movl 20(%esp), %edi
movl %eax, 8(%edi) /* argblock[2] */
movl %ebp, 12(%edi) /* argblock[3] */
Modified: branches/DARWIN/coregrind/m_start-amd64-darwin.S
===================================================================
--- branches/DARWIN/coregrind/m_start-amd64-darwin.S 2009-04-24 04:28:15 UTC (rev 9599)
+++ branches/DARWIN/coregrind/m_start-amd64-darwin.S 2009-04-24 04:37:30 UTC (rev 9600)
@@ -28,6 +28,8 @@
The GNU General Public License is contained in the file COPYING.
*/
+#include "pub_core_basics_asm.h"
+
.text
.align 3,0x90
Ldyld_stub_binding_helper:
Modified: branches/DARWIN/coregrind/m_start-x86-darwin.S
===================================================================
--- branches/DARWIN/coregrind/m_start-x86-darwin.S 2009-04-24 04:28:15 UTC (rev 9599)
+++ branches/DARWIN/coregrind/m_start-x86-darwin.S 2009-04-24 04:37:30 UTC (rev 9600)
@@ -28,6 +28,8 @@
The GNU General Public License is contained in the file COPYING.
*/
+#include "pub_core_basics_asm.h"
+
.text
.align 2,0x90
Ldyld_stub_binding_helper:
Modified: branches/DARWIN/coregrind/m_syswrap/syscall-amd64-darwin.S
===================================================================
--- branches/DARWIN/coregrind/m_syswrap/syscall-amd64-darwin.S 2009-04-24 04:28:15 UTC (rev 9599)
+++ branches/DARWIN/coregrind/m_syswrap/syscall-amd64-darwin.S 2009-04-24 04:37:30 UTC (rev 9600)
@@ -192,16 +192,16 @@
.endmacro
-.globl _ML_(do_syscall_for_client_unix_WRK)
-_ML_(do_syscall_for_client_unix_WRK):
+.globl ML_(do_syscall_for_client_unix_WRK)
+ML_(do_syscall_for_client_unix_WRK):
DO_SYSCALL UNIX
-.globl _ML_(do_syscall_for_client_mach_WRK)
-_ML_(do_syscall_for_client_mach_WRK):
+.globl ML_(do_syscall_for_client_mach_WRK)
+ML_(do_syscall_for_client_mach_WRK):
DO_SYSCALL MACH
-.globl _ML_(do_syscall_for_client_mdep_WRK)
-_ML_(do_syscall_for_client_mdep_WRK):
+.globl ML_(do_syscall_for_client_mdep_WRK)
+ML_(do_syscall_for_client_mdep_WRK):
DO_SYSCALL MDEP
.data
@@ -214,38 +214,38 @@
#define FOO(scclass,labelno) L_##scclass##_##labelno
#define MK_L_SCCLASS_N(scclass,labelno) FOO(scclass,labelno)
-.globl _ML_(blksys_setup_MACH)
-.globl _ML_(blksys_restart_MACH)
-.globl _ML_(blksys_complete_MACH)
-.globl _ML_(blksys_committed_MACH)
-.globl _ML_(blksys_finished_MACH)
-_ML_(blksys_setup_MACH): .quad MK_L_SCCLASS_N(MACH,1)
-_ML_(blksys_restart_MACH): .quad MK_L_SCCLASS_N(MACH,2)
-_ML_(blksys_complete_MACH): .quad MK_L_SCCLASS_N(MACH,3)
-_ML_(blksys_committed_MACH): .quad MK_L_SCCLASS_N(MACH,4)
-_ML_(blksys_finished_MACH): .quad MK_L_SCCLASS_N(MACH,5)
+.globl ML_(blksys_setup_MACH)
+.globl ML_(blksys_restart_MACH)
+.globl ML_(blksys_complete_MACH)
+.globl ML_(blksys_committed_MACH)
+.globl ML_(blksys_finished_MACH)
+ML_(blksys_setup_MACH): .quad MK_L_SCCLASS_N(MACH,1)
+ML_(blksys_restart_MACH): .quad MK_L_SCCLASS_N(MACH,2)
+ML_(blksys_complete_MACH): .quad MK_L_SCCLASS_N(MACH,3)
+ML_(blksys_committed_MACH): .quad MK_L_SCCLASS_N(MACH,4)
+ML_(blksys_finished_MACH): .quad MK_L_SCCLASS_N(MACH,5)
-.globl _ML_(blksys_setup_MDEP)
-.globl _ML_(blksys_restart_MDEP)
-.globl _ML_(blksys_complete_MDEP)
-.globl _ML_(blksys_committed_MDEP)
-.globl _ML_(blksys_finished_MDEP)
-_ML_(blksys_setup_MDEP): .quad MK_L_SCCLASS_N(MDEP,1)
-_ML_(blksys_restart_MDEP): .quad MK_L_SCCLASS_N(MDEP,2)
-_ML_(blksys_complete_MDEP): .quad MK_L_SCCLASS_N(MDEP,3)
-_ML_(blksys_committed_MDEP): .quad MK_L_SCCLASS_N(MDEP,4)
-_ML_(blksys_finished_MDEP): .quad MK_L_SCCLASS_N(MDEP,5)
+.globl ML_(blksys_setup_MDEP)
+.globl ML_(blksys_restart_MDEP)
+.globl ML_(blksys_complete_MDEP)
+.globl ML_(blksys_committed_MDEP)
+.globl ML_(blksys_finished_MDEP)
+ML_(blksys_setup_MDEP): .quad MK_L_SCCLASS_N(MDEP,1)
+ML_(blksys_restart_MDEP): .quad MK_L_SCCLASS_N(MDEP,2)
+ML_(blksys_complete_MDEP): .quad MK_L_SCCLASS_N(MDEP,3)
+ML_(blksys_committed_MDEP): .quad MK_L_SCCLASS_N(MDEP,4)
+ML_(blksys_finished_MDEP): .quad MK_L_SCCLASS_N(MDEP,5)
-.globl _ML_(blksys_setup_UNIX)
-.globl _ML_(blksys_restart_UNIX)
-.globl _ML_(blksys_complete_UNIX)
-.globl _ML_(blksys_committed_UNIX)
-.globl _ML_(blksys_finished_UNIX)
-_ML_(blksys_setup_UNIX): .quad MK_L_SCCLASS_N(UNIX,1)
-_ML_(blksys_restart_UNIX): .quad MK_L_SCCLASS_N(UNIX,2)
-_ML_(blksys_complete_UNIX): .quad MK_L_SCCLASS_N(UNIX,3)
-_ML_(blksys_committed_UNIX): .quad MK_L_SCCLASS_N(UNIX,4)
-_ML_(blksys_finished_UNIX): .quad MK_L_SCCLASS_N(UNIX,5)
+.globl ML_(blksys_setup_UNIX)
+.globl ML_(blksys_restart_UNIX)
+.globl ML_(blksys_complete_UNIX)
+.globl ML_(blksys_committed_UNIX)
+.globl ML_(blksys_finished_UNIX)
+ML_(blksys_setup_UNIX): .quad MK_L_SCCLASS_N(UNIX,1)
+ML_(blksys_restart_UNIX): .quad MK_L_SCCLASS_N(UNIX,2)
+ML_(blksys_complete_UNIX): .quad MK_L_SCCLASS_N(UNIX,3)
+ML_(blksys_committed_UNIX): .quad MK_L_SCCLASS_N(UNIX,4)
+ML_(blksys_finished_UNIX): .quad MK_L_SCCLASS_N(UNIX,5)
/*--------------------------------------------------------------------*/
Modified: branches/DARWIN/coregrind/m_syswrap/syscall-x86-darwin.S
===================================================================
--- branches/DARWIN/coregrind/m_syswrap/syscall-x86-darwin.S 2009-04-24 04:28:15 UTC (rev 9599)
+++ branches/DARWIN/coregrind/m_syswrap/syscall-x86-darwin.S 2009-04-24 04:37:30 UTC (rev 9600)
@@ -61,7 +61,7 @@
Prototype:
- Int _ML_(do_syscall_for_client_WRK)(
+ Int ML_(do_syscall_for_client_WRK)(
Int syscallno, // ebp+8
void* guest_state, // ebp+12
const vki_sigset_t *sysmask, // ebp+16
@@ -190,16 +190,16 @@
.endmacro
-.globl _ML_(do_syscall_for_client_unix_WRK)
-_ML_(do_syscall_for_client_unix_WRK):
+.globl ML_(do_syscall_for_client_unix_WRK)
+ML_(do_syscall_for_client_unix_WRK):
DO_SYSCALL UNIX
-.globl _ML_(do_syscall_for_client_mach_WRK)
-_ML_(do_syscall_for_client_mach_WRK):
+.globl ML_(do_syscall_for_client_mach_WRK)
+ML_(do_syscall_for_client_mach_WRK):
DO_SYSCALL MACH
-.globl _ML_(do_syscall_for_client_mdep_WRK)
-_ML_(do_syscall_for_client_mdep_WRK):
+.globl ML_(do_syscall_for_client_mdep_WRK)
+ML_(do_syscall_for_client_mdep_WRK):
DO_SYSCALL MDEP
.data
@@ -212,38 +212,38 @@
#define FOO(scclass,labelno) L_##scclass##_##labelno
#define MK_L_SCCLASS_N(scclass,labelno) FOO(scclass,labelno)
-.globl _ML_(blksys_setup_MACH)
-.globl _ML_(blksys_restart_MACH)
-.globl _ML_(blksys_complete_MACH)
-.globl _ML_(blksys_committed_MACH)
-.globl _ML_(blksys_finished_MACH)
-_ML_(blksys_setup_MACH): .long MK_L_SCCLASS_N(MACH,1)
-_ML_(blksys_restart_MACH): .long MK_L_SCCLASS_N(MACH,2)
-_ML_(blksys_complete_MACH): .long MK_L_SCCLASS_N(MACH,3)
-_ML_(blksys_committed_MACH): .long MK_L_SCCLASS_N(MACH,4)
-_ML_(blksys_finished_MACH): .long MK_L_SCCLASS_N(MACH,5)
+.globl ML_(blksys_setup_MACH)
+.globl ML_(blksys_restart_MACH)
+.globl ML_(blksys_complete_MACH)
+.globl ML_(blksys_committed_MACH)
+.globl ML_(blksys_finished_MACH)
+ML_(blksys_setup_MACH): .long MK_L_SCCLASS_N(MACH,1)
+ML_(blksys_restart_MACH): .long MK_L_SCCLASS_N(MACH,2)
+ML_(blksys_complete_MACH): .long MK_L_SCCLASS_N(MACH,3)
+ML_(blksys_committed_MACH): .long MK_L_SCCLASS_N(MACH,4)
+ML_(blksys_finished_MACH): .long MK_L_SCCLASS_N(MACH,5)
-.globl _ML_(blksys_setup_MDEP)
-.globl _ML_(blksys_restart_MDEP)
-.globl _ML_(blksys_complete_MDEP)
-.globl _ML_(blksys_committed_MDEP)
-.globl _ML_(blksys_finished_MDEP)
-_ML_(blksys_setup_MDEP): .long MK_L_SCCLASS_N(MDEP,1)
-_ML_(blksys_restart_MDEP): .long MK_L_SCCLASS_N(MDEP,2)
-_ML_(blksys_complete_MDEP): .long MK_L_SCCLASS_N(MDEP,3)
-_ML_(blksys_committed_MDEP): .long MK_L_SCCLASS_N(MDEP,4)
-_ML_(blksys_finished_MDEP): .long MK_L_SCCLASS_N(MDEP,5)
+.globl ML_(blksys_setup_MDEP)
+.globl ML_(blksys_restart_MDEP)
+.globl ML_(blksys_complete_MDEP)
+.globl ML_(blksys_committed_MDEP)
+.globl ML_(blksys_finished_MDEP)
+ML_(blksys_setup_MDEP): .long MK_L_SCCLASS_N(MDEP,1)
+ML_(blksys_restart_MDEP): .long MK_L_SCCLASS_N(MDEP,2)
+ML_(blksys_complete_MDEP): .long MK_L_SCCLASS_N(MDEP,3)
+ML_(blksys_committed_MDEP): .long MK_L_SCCLASS_N(MDEP,4)
+ML_(blksys_finished_MDEP): .long MK_L_SCCLASS_N(MDEP,5)
-.globl _ML_(blksys_setup_UNIX)
-.globl _ML_(blksys_restart_UNIX)
-.globl _ML_(blksys_complete_UNIX)
-.globl _ML_(blksys_committed_UNIX)
-.globl _ML_(blksys_finished_UNIX)
-_ML_(blksys_setup_UNIX): .long MK_L_SCCLASS_N(UNIX,1)
-_ML_(blksys_restart_UNIX): .long MK_L_SCCLASS_N(UNIX,2)
-_ML_(blksys_complete_UNIX): .long MK_L_SCCLASS_N(UNIX,3)
-_ML_(blksys_committed_UNIX): .long MK_L_SCCLASS_N(UNIX,4)
-_ML_(blksys_finished_UNIX): .long MK_L_SCCLASS_N(UNIX,5)
+.globl ML_(blksys_setup_UNIX)
+.globl ML_(blksys_restart_UNIX)
+.globl ML_(blksys_complete_UNIX)
+.globl ML_(blksys_committed_UNIX)
+.globl ML_(blksys_finished_UNIX)
+ML_(blksys_setup_UNIX): .long MK_L_SCCLASS_N(UNIX,1)
+ML_(blksys_restart_UNIX): .long MK_L_SCCLASS_N(UNIX,2)
+ML_(blksys_complete_UNIX): .long MK_L_SCCLASS_N(UNIX,3)
+ML_(blksys_committed_UNIX): .long MK_L_SCCLASS_N(UNIX,4)
+ML_(blksys_finished_UNIX): .long MK_L_SCCLASS_N(UNIX,5)
Modified: branches/DARWIN/coregrind/m_trampoline.S
===================================================================
--- branches/DARWIN/coregrind/m_trampoline.S 2009-04-24 04:28:15 UTC (rev 9599)
+++ branches/DARWIN/coregrind/m_trampoline.S 2009-04-24 04:37:30 UTC (rev 9600)
@@ -743,19 +743,19 @@
/* a leading page of unexecutable code */
.fill 2048, 2, 0x0b0f /* `ud2` */
-.globl _VG_(trampoline_stuff_start)
-_VG_(trampoline_stuff_start):
+.globl VG_(trampoline_stuff_start)
+VG_(trampoline_stuff_start):
-.globl _VG_(x86_darwin_SUBST_FOR_sigreturn)
-_VG_(x86_darwin_SUBST_FOR_sigreturn):
+.globl VG_(x86_darwin_SUBST_FOR_sigreturn)
+VG_(x86_darwin_SUBST_FOR_sigreturn):
/* XXX does this need to have any special form? (cf x86-linux
version) */
movl $ __NR_DARWIN_FAKE_SIGRETURN, %eax
int $0x80
ud2
-.globl _VG_(darwin_REDIR_FOR_strlen)
-_VG_(darwin_REDIR_FOR_strlen):
+.globl VG_(darwin_REDIR_FOR_strlen)
+VG_(darwin_REDIR_FOR_strlen):
movl 4(%esp), %edx
movl %edx, %eax
jmp 1f
@@ -767,8 +767,8 @@
subl %edx, %eax
ret
-.globl _VG_(darwin_REDIR_FOR_strcat)
-_VG_(darwin_REDIR_FOR_strcat):
+.globl VG_(darwin_REDIR_FOR_strcat)
+VG_(darwin_REDIR_FOR_strcat):
pushl %esi
movl 8(%esp), %esi
movl 12(%esp), %ecx
@@ -791,8 +791,8 @@
ret
-.globl _VG_(darwin_REDIR_FOR_strcmp)
-_VG_(darwin_REDIR_FOR_strcmp):
+.globl VG_(darwin_REDIR_FOR_strcmp)
+VG_(darwin_REDIR_FOR_strcmp):
movl 4(%esp), %edx
movl 8(%esp), %ecx
jmp 1f
@@ -812,8 +812,8 @@
ret
-.globl _VG_(darwin_REDIR_FOR_strcpy)
-_VG_(darwin_REDIR_FOR_strcpy):
+.globl VG_(darwin_REDIR_FOR_strcpy)
+VG_(darwin_REDIR_FOR_strcpy):
pushl %ebp
movl %esp, %ebp
pushl %esi
@@ -834,8 +834,8 @@
leave
ret
-.globl _VG_(darwin_REDIR_FOR_strlcat)
-_VG_(darwin_REDIR_FOR_strlcat):
+.globl VG_(darwin_REDIR_FOR_strlcat)
+VG_(darwin_REDIR_FOR_strlcat):
pushl %ebp
movl %esp, %ebp
pushl %edi
@@ -864,7 +864,7 @@
3:
movl 12(%ebp), %eax
movl %eax, (%esp)
- call _VG_(darwin_REDIR_FOR_strlen)
+ call VG_(darwin_REDIR_FOR_strlen)
jmp 7f
4:
cmpl $1, %esi
@@ -889,8 +889,8 @@
ret
-.globl _VG_(trampoline_stuff_end)
-_VG_(trampoline_stuff_end):
+.globl VG_(trampoline_stuff_end)
+VG_(trampoline_stuff_end):
/* a trailing page of unexecutable code */
.fill 2048, 2, 0x0b0f /* `ud2` */
@@ -903,11 +903,11 @@
/* a leading page of unexecutable code */
.fill 2048, 2, 0x0b0f /* `ud2` */
-.globl _VG_(trampoline_stuff_start)
-_VG_(trampoline_stuff_start):
+.globl VG_(trampoline_stuff_start)
+VG_(trampoline_stuff_start):
-.globl _VG_(darwin_REDIR_FOR_strlen)
-_VG_(darwin_REDIR_FOR_strlen):
+.globl VG_(darwin_REDIR_FOR_strlen)
+VG_(darwin_REDIR_FOR_strlen):
movq %rdi, %rax
jmp 1f
0:
@@ -918,8 +918,8 @@
subq %rdi, %rax
ret
-.globl _VG_(darwin_REDIR_FOR_strcat)
-_VG_(darwin_REDIR_FOR_strcat):
+.globl VG_(darwin_REDIR_FOR_strcat)
+VG_(darwin_REDIR_FOR_strcat):
movq %rdi, %rdx
jmp 1f
0:
@@ -938,8 +938,8 @@
ret
-.globl _VG_(darwin_REDIR_FOR_strcmp)
-_VG_(darwin_REDIR_FOR_strcmp):
+.globl VG_(darwin_REDIR_FOR_strcmp)
+VG_(darwin_REDIR_FOR_strcmp):
jmp 1f
0:
incq %rdi
@@ -956,8 +956,8 @@
subl %edx, %eax
ret
-.globl _VG_(darwin_REDIR_FOR_strcpy)
-_VG_(darwin_REDIR_FOR_strcpy):
+.globl VG_(darwin_REDIR_FOR_strcpy)
+VG_(darwin_REDIR_FOR_strcpy):
pushq %rbp
movq %rdi, %rdx
movq %rsp, %rbp
@@ -974,8 +974,8 @@
movq %rdi, %rax
ret
-.globl _VG_(darwin_REDIR_FOR_strlcat)
-_VG_(darwin_REDIR_FOR_strlcat):
+.globl VG_(darwin_REDIR_FOR_strlcat)
+VG_(darwin_REDIR_FOR_strlcat):
pushq %rbp
leaq (%rdx,%rdi), %rax
movq %rdi, %rcx
@@ -1000,7 +1000,7 @@
jmp 6f
3:
movq %rsi, %rdi
- call _VG_(darwin_REDIR_FOR_strlen)
+ call VG_(darwin_REDIR_FOR_strlen)
jmp 7f
4:
cmpq $1, %rdi
@@ -1023,14 +1023,14 @@
leave
ret
-.globl _VG_(darwin_REDIR_FOR_arc4random)
-_VG_(darwin_REDIR_FOR_arc4random):
+.globl VG_(darwin_REDIR_FOR_arc4random)
+VG_(darwin_REDIR_FOR_arc4random):
/* not very random, hope dyld won't mind */
movq $0x76616c6772696e64, %rax
ret
-.globl _VG_(trampoline_stuff_end)
-_VG_(trampoline_stuff_end):
+.globl VG_(trampoline_stuff_end)
+VG_(trampoline_stuff_end):
/* a trailing page of unexecutable code */
.fill 2048, 2, 0x0b0f /* `ud2` */
Modified: branches/DARWIN/coregrind/pub_core_basics.h
===================================================================
--- branches/DARWIN/coregrind/pub_core_basics.h 2009-04-24 04:28:15 UTC (rev 9599)
+++ branches/DARWIN/coregrind/pub_core_basics.h 2009-04-24 04:37:30 UTC (rev 9600)
@@ -37,7 +37,6 @@
// everywhere.
//--------------------------------------------------------------------
-#include "pub_core_basics_asm.h"
#include "pub_tool_basics.h"
/* ---------------------------------------------------------------------
Modified: branches/DARWIN/coregrind/pub_core_basics_asm.h
===================================================================
--- branches/DARWIN/coregrind/pub_core_basics_asm.h 2009-04-24 04:28:15 UTC (rev 9599)
+++ branches/DARWIN/coregrind/pub_core_basics_asm.h 2009-04-24 04:37:30 UTC (rev 9600)
@@ -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"
Modified: branches/DARWIN/include/pub_tool_basics.h
===================================================================
--- branches/DARWIN/include/pub_tool_basics.h 2009-04-24 04:28:15 UTC (rev 9599)
+++ branches/DARWIN/include/pub_tool_basics.h 2009-04-24 04:37:30 UTC (rev 9600)
@@ -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>
@@ -57,6 +54,27 @@
/* ---------------------------------------------------------------------
+ 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
------------------------------------------------------------------ */
Modified: branches/DARWIN/include/pub_tool_basics_asm.h
===================================================================
--- branches/DARWIN/include/pub_tool_basics_asm.h 2009-04-24 04:28:15 UTC (rev 9599)
+++ branches/DARWIN/include/pub_tool_basics_asm.h 2009-04-24 04:37:30 UTC (rev 9600)
@@ -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 ---*/
/*--------------------------------------------------------------------*/
@@ -33,29 +32,32 @@
#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
+
+#if defined(VGO_linux) || defined(VGO_aix5)
+# define VG_(str) VGAPPEND( vgPlain_, str)
+# define ML_(str) VGAPPEND( vgModuleLocal_, str)
+#elif defined(VGO_darwin)
+# define VG_(str) VGAPPEND(_vgPlain_, str)
+# define ML_(str) VGAPPEND(_vgModuleLocal_, str)
+#else
+# error Unknown OS
+#endif
-/* 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)
-
-/* _VG_(foo) is the same as VG_(foo), except with a leading underscore.
- This is needed for assembly definitions on some platforms, and
- should not be used in C files.
-*/
-#define _VG_(str) VGAPPEND(_vgPlain_, str)
-#define _ML_(str) VGAPPEND(_vgModuleLocal_, str)
-
#endif /* __PUB_TOOL_BASICS_ASM_H */
/*--------------------------------------------------------------------*/
Modified: branches/DARWIN/tests/asm.h
===================================================================
--- branches/DARWIN/tests/asm.h 2009-04-24 04:28:15 UTC (rev 9599)
+++ branches/DARWIN/tests/asm.h 2009-04-24 04:37:30 UTC (rev 9600)
@@ -13,7 +13,7 @@
// This one is for use in asm files.
#if defined(VGO_darwin)
-#define VG_SYM_ASM(x) _#x
+#define VG_SYM_ASM(x) _##x
#else
#define VG_SYM_ASM(x) x
#endif
|