-
Notifications
You must be signed in to change notification settings - Fork 29
Expand file tree
/
Copy pathasmdata.h
More file actions
22 lines (19 loc) · 934 Bytes
/
Copy pathasmdata.h
File metadata and controls
22 lines (19 loc) · 934 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#ifndef ASMDATA_H
#define ASMDATA_H
// Portable inline-asm data layout directives. A few data blocks are emitted
// via inline asm to force exact symbol order and adjacency (relied on by the
// asm core and the save-state code). ELF and PE/COFF differ in section syntax
// and symbol naming (PE/COFF prefixes an underscore), so abstract it here.
// ASM_GSYM exports _sym and keeps a plain sym alias for intra-block references.
#if defined(__APPLE__) || defined(__MINGW32__)
#define ASM_SEC_DATA(name) ".section " name ",\"dw\"\n"
#define ASM_SEC_BSS(name) ".section " name ",\"bw\"\n"
#define ASM_SEC_END ".text\n"
#define ASM_GSYM(sym) ".global _" #sym "\n_" #sym ":\n" #sym ":\n"
#else
#define ASM_SEC_DATA(name) ".pushsection " name ",\"aw\",@progbits\n"
#define ASM_SEC_BSS(name) ".pushsection " name ",\"aw\",@nobits\n"
#define ASM_SEC_END ".popsection\n"
#define ASM_GSYM(sym) ".global " #sym "\n" #sym ":\n"
#endif
#endif