Merge pull request #1278 from eerhardt/master
[platform/upstream/coreclr.git] / src / pal / inc / unixasmmacros.inc
1 //
2 // Copyright (c) Microsoft. All rights reserved.
3 // Licensed under the MIT license. See LICENSE file in the project root for full license information.
4 //
5
6 #define INVALIDGCVALUE -0x33333333 // 0CCCCCCCDh - the assembler considers it to be a signed integer constant
7
8 #if defined(__APPLE__)
9 #define C_FUNC(name) _##name
10 #define EXTERNAL_C_FUNC(name) C_FUNC(name)
11 #define LOCAL_LABEL(name) L##name
12 #else
13 #define C_FUNC(name) name
14 #define EXTERNAL_C_FUNC(name) C_FUNC(name)@plt
15 #define LOCAL_LABEL(name) .L##name
16 #endif
17
18 #if defined(__APPLE__)
19 #define C_PLTFUNC(name) _##name
20 #else
21 #define C_PLTFUNC(name) name@PLT
22 #endif
23
24 .macro LEAF_END Name, Section
25         LEAF_END_MARKED \Name, \Section
26 .endm
27
28 .macro NESTED_ENTRY Name, Section, Handler
29         LEAF_ENTRY \Name, \Section
30         .ifnc \Handler, NoHandler
31 #if defined(__APPLE__)
32         .cfi_personality 0x9b, C_FUNC(\Handler) // 0x9b == DW_EH_PE_indirect | DW_EH_PE_pcrel | DW_EH_PE_sdata4
33 #else
34         .cfi_personality 0, C_FUNC(\Handler) // 0 == DW_EH_PE_absptr
35 #endif
36         .endif
37 .endm
38
39 .macro NESTED_END Name, Section
40         LEAF_END \Name, \Section
41 #if defined(__APPLE__)
42         .section __LD,__compact_unwind,regular,debug
43         .quad C_FUNC(\Name)
44         .set C_FUNC(\Name\()_Size), C_FUNC(\Name\()_End) - C_FUNC(\Name)
45         .long C_FUNC(\Name\()_Size)
46         .long 0x04000000 # DWARF
47         .quad 0
48         .quad 0
49 #endif
50 .endm
51
52 .macro END_PROLOGUE
53 .endm
54
55 .macro SETALIAS New, Old
56         .equiv \New, \Old
57 .endm
58
59 #if defined(_AMD64_)
60 #include "unixasmmacrosamd64.inc"
61 #elif defined(_ARM_)
62 #include "unixasmmacrosarm.inc"
63 #endif