111
|
1 /*
|
|
2 Copyright (c) 2014-2016 Intel Corporation. All Rights Reserved.
|
|
3
|
|
4 Redistribution and use in source and binary forms, with or without
|
|
5 modification, are permitted provided that the following conditions
|
|
6 are met:
|
|
7
|
|
8 * Redistributions of source code must retain the above copyright
|
|
9 notice, this list of conditions and the following disclaimer.
|
|
10 * Redistributions in binary form must reproduce the above copyright
|
|
11 notice, this list of conditions and the following disclaimer in the
|
|
12 documentation and/or other materials provided with the distribution.
|
|
13 * Neither the name of Intel Corporation nor the names of its
|
|
14 contributors may be used to endorse or promote products derived
|
|
15 from this software without specific prior written permission.
|
|
16
|
|
17 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
18 "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
19 LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
|
20 A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
21 HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
22 SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
23 LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
24 DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
25 THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
26 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
27 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
28 */
|
|
29
|
|
30
|
|
31 #if HOST_LIBRARY
|
|
32 #include "offload_table.h"
|
|
33 #ifdef MYO_SUPPORT
|
|
34 #include "offload_myo_host.h"
|
|
35 #endif // MYO_SUPPORT
|
|
36 #else
|
|
37 #include "offload_target.h"
|
|
38 #ifdef MYO_SUPPORT
|
|
39 #include "offload_myo_target.h"
|
|
40 #endif // MYO_SUPPORT
|
|
41 #endif // HOST_LIBRARY
|
|
42
|
|
43 #ifdef TARGET_WINNT
|
|
44 #define ALLOCATE(name) __declspec(allocate(name))
|
|
45 #else // TARGET_WINNT
|
|
46 #define ALLOCATE(name) __attribute__((section(name)))
|
|
47 #endif // TARGET_WINNT
|
|
48
|
|
49 // offload entry table
|
|
50 ALLOCATE(OFFLOAD_ENTRY_TABLE_SECTION_END)
|
|
51 #ifdef TARGET_WINNT
|
|
52 __declspec(align(sizeof(FuncTable::Entry)))
|
|
53 #endif // TARGET_WINNT
|
|
54 static FuncTable::Entry __offload_entry_table_end = { (const char*)-1 };
|
|
55
|
|
56 // offload function table
|
|
57 ALLOCATE(OFFLOAD_FUNC_TABLE_SECTION_END)
|
|
58 #ifdef TARGET_WINNT
|
|
59 __declspec(align(sizeof(FuncTable::Entry)))
|
|
60 #endif // TARGET_WINNT
|
|
61 static FuncTable::Entry __offload_func_table_end = { (const char*)-1 };
|
|
62
|
|
63 // data table
|
|
64 ALLOCATE(OFFLOAD_VAR_TABLE_SECTION_END)
|
|
65 #ifdef TARGET_WINNT
|
|
66 __declspec(align(sizeof(VarTable::Entry)))
|
|
67 #endif // TARGET_WINNT
|
|
68 static VarTable::Entry __offload_var_table_end = { (const char*)-1 };
|
|
69
|
|
70 #ifdef MYO_SUPPORT
|
|
71
|
|
72 // offload myo shared var section epilog
|
|
73 ALLOCATE(OFFLOAD_MYO_SHARED_TABLE_SECTION_END)
|
|
74 #ifdef TARGET_WINNT
|
|
75 __declspec(align(sizeof(SharedTableEntry)))
|
|
76 static MYOVarTable::Entry __offload_myo_shared_var_end =
|
|
77 { (const char*)-1, 0 };
|
|
78 #else // TARGET_WINNT
|
|
79 static MYOVarTable::Entry __offload_myo_shared_var_end = { 0 };
|
|
80 #endif // TARGET_WINNT
|
|
81
|
|
82 // offload myo shared vtable section epilog
|
|
83 ALLOCATE(OFFLOAD_MYO_SHARED_VTABLE_SECTION_END)
|
|
84 #ifdef TARGET_WINNT
|
|
85 __declspec(align(sizeof(SharedTableEntry)))
|
|
86 static MYOVarTable::Entry __offload_myo_shared_vtable_end =
|
|
87 { (const char*)-1, 0 };
|
|
88 #else // TARGET_WINNT
|
|
89 static MYOVarTable::Entry __offload_myo_shared_vtable_end = { 0 };
|
|
90 #endif // TARGET_WINNT
|
|
91
|
|
92 //#if HOST_LIBRARY
|
|
93 // offload myo shared var init section epilog
|
|
94 ALLOCATE(OFFLOAD_MYO_SHARED_INIT_TABLE_SECTION_END)
|
|
95 #ifdef TARGET_WINNT
|
|
96 __declspec(align(sizeof(InitTableEntry)))
|
|
97 static MYOInitTable::Entry __offload_myo_init_table_end =
|
|
98 { (const char*)-1, 0 };
|
|
99 #else // TARGET_WINNT
|
|
100 static MYOInitTable::Entry __offload_myo_init_table_end = { 0 };
|
|
101 #endif // TARGET_WINNT
|
|
102 //#endif // HOST_LIBRARY
|
|
103
|
|
104 // offload myo fptr section epilog
|
|
105 ALLOCATE(OFFLOAD_MYO_FPTR_TABLE_SECTION_END)
|
|
106 #ifdef TARGET_WINNT
|
|
107 __declspec(align(sizeof(FptrTableEntry)))
|
|
108 static MYOFuncTable::Entry __offload_myo_fptr_table_end =
|
|
109 { (const char*)-1, 0, 0 };
|
|
110 #else // TARGET_WINNT
|
|
111 static MYOFuncTable::Entry __offload_myo_fptr_table_end = { 0 };
|
|
112 #endif // TARGET_WINNT
|
|
113
|
|
114 #endif // MYO_SUPPORT
|