Skip to content

Commit

Permalink
i#58 MacOS: nasm requires _ on everything
Browse files Browse the repository at this point in the history
Add GLOBAL_REF() macro and use it on all extern refs in x86.asm.
Add leading _ on all the label defines for nasm in asm_defines.asm.

SVN-Revision: 2319
  • Loading branch information
derekbruening committed Oct 8, 2013
1 parent ee7d990 commit d4f8fe1
Show file tree
Hide file tree
Showing 2 changed files with 72 additions and 68 deletions.
22 changes: 13 additions & 9 deletions core/x86/asm_defines.asm
@@ -1,5 +1,5 @@
/* **********************************************************
* Copyright (c) 2011-2012 Google, Inc. All rights reserved.
* Copyright (c) 2011-2013 Google, Inc. All rights reserved.
* Copyright (c) 2008-2009 VMware, Inc. All rights reserved.
* ********************************************************** */

Expand Down Expand Up @@ -64,6 +64,7 @@
.hidden symbol
# define GLOBAL_LABEL(label) label
# define ADDRTAKEN_LABEL(label) label
# define GLOBAL_REF(label) label
# define BYTE byte ptr
# define WORD word ptr
# define DWORD dword ptr
Expand Down Expand Up @@ -113,6 +114,7 @@ ASSUME fs:_DATA @N@\
# define GLOBAL_LABEL(label)
/* use double colon (param always has its own colon) to make label visible outside proc */
# define ADDRTAKEN_LABEL(label) label:
# define GLOBAL_REF(label) label
# define BYTE byte ptr
# define WORD word ptr
# define DWORD dword ptr
Expand Down Expand Up @@ -143,24 +145,26 @@ ASSUME fs:_DATA @N@\
#elif defined(ASSEMBLE_WITH_NASM)
# define START_FILE SECTION .text
# define END_FILE /* nothing */
# define DECLARE_FUNC(symbol) global symbol
# define DECLARE_EXPORTED_FUNC(symbol) global symbol
/* for MacOS, at least, we have to add _ ourselves */
# define DECLARE_FUNC(symbol) global _##symbol
# define DECLARE_EXPORTED_FUNC(symbol) global _##symbol
# define END_FUNC(symbol) /* nothing */
# define DECLARE_GLOBAL(symbol) global symbol
# define GLOBAL_LABEL(label) label
# define ADDRTAKEN_LABEL(label) label
# define DECLARE_GLOBAL(symbol) global _##symbol
# define GLOBAL_LABEL(label) _##label
# define ADDRTAKEN_LABEL(label) _##label
# define GLOBAL_REF(label) _##label
# define BYTE byte
# define WORD word
# define DWORD dword
# define QWORD qword
# ifdef X64
# define SYMREF(sym) [rel sym]
# define SYMREF(sym) [rel GLOBAL_REF(sym)]
# else
# define SYMREF(sym) [sym]
# define SYMREF(sym) [GLOBAL_REF(sym)]
# endif
# define HEX(n) 0x##n
# define SEGMEM(seg,mem) [seg:mem]
# define DECL_EXTERN(symbol) EXTERN symbol
# define DECL_EXTERN(symbol) EXTERN GLOBAL_REF(symbol)
# define RAW(n) DB HEX(n) @N@
# define DECLARE_FUNC_SEH(symbol) DECLARE_FUNC(symbol)
# define PUSH_SEH(reg) push reg
Expand Down

0 comments on commit d4f8fe1

Please sign in to comment.