@@ -51,6 +51,53 @@ def parse_readobj_output(output):
51
51
sym_section = re .search (r"(?<=Section:\s)[\.\w]+" , sym )
52
52
if match_symbol (sym_binding , sym_type , sym_section ):
53
53
parsed_symbols .append (name .group ())
54
+
55
+ # Presence of _dl_relocate_static_pie depends on whether ld.gold or ld.lld
56
+ # is used. Ignore it for the purpose of the library ABI check.
57
+ ignore_symbols = ["_dl_relocate_static_pie" ]
58
+
59
+ # In some scenarios MSVC and clang-cl exhibit differences in regards to the exported symbols they generate.
60
+ # Some of them happen in the SYCL RT library and we think clang-cl's behavior is more reasonable.
61
+ #
62
+ # Case 1:
63
+ # pi.hpp:
64
+ # template <backend BE> __SYCL_EXPORT const plugin &getPlugin();
65
+ #
66
+ # pi.cpp:
67
+ # template <backend BE> const plugin &getPlugin() {
68
+ # static const plugin *Plugin = nullptr;
69
+ # ...
70
+ # }
71
+ # // explicit dllexport instantiations.
72
+ #
73
+ # clang-cl generates exported symbols for the static variables Plugin. These are never referenced
74
+ # in the user's headers so cannot be used outside DLL and not exporting them should not affect any
75
+ # usage scenario.
76
+ #
77
+ # In general, the compiler doesn't know if the definition is in the DLL or in the header and inline
78
+ # dllexport/dllimport functions have to be supported, hence clang-cl's behavior.
79
+ #
80
+ # See also https://devblogs.microsoft.com/oldnewthing/20140109-00/?p=2123.
81
+ ignore_symbols += ["?Plugin@?1???$getPlugin@$01@pi@detail@_V1@sycl@@YAAEBVplugin@234@XZ@4PEBV5234@EB" ,
82
+ "?Plugin@?1???$getPlugin@$00@pi@detail@_V1@sycl@@YAAEBVplugin@234@XZ@4PEBV5234@EB" ,
83
+ "?Plugin@?1???$getPlugin@$04@pi@detail@_V1@sycl@@YAAEBVplugin@234@XZ@4PEBV5234@EB" ,
84
+ "?Plugin@?1???$getPlugin@$02@pi@detail@_V1@sycl@@YAAEBVplugin@234@XZ@4PEBV5234@EB" ]
85
+ # Case 2:
86
+ # half_type.hpp:
87
+ # class __SYCL_EXPORT half {
88
+ # ...
89
+ # constexpr half(const half &) = default;
90
+ # constexpr half(half &&) = default;
91
+ # ...
92
+ # };
93
+ #
94
+ # For some reason MSVC creates exported symbols for the constexpr versions of those defaulted ctors
95
+ # although it never calls them at use point. Instead, those trivially copyable/moveable objects are
96
+ # memcpy/memmove'ed. We don't expect these symbols are ever referenced directly so having or not
97
+ # having them won't cause ABI issues.
98
+ ignore_symbols += ["??0half@host_half_impl@detail@_V1@sycl@@QEAA@AEBV01234@@Z" ,
99
+ "??0half@host_half_impl@detail@_V1@sycl@@QEAA@$$QEAV01234@@Z" ]
100
+ parsed_symbols = [s for s in parsed_symbols if s not in ignore_symbols ]
54
101
return parsed_symbols
55
102
56
103
@@ -103,53 +150,6 @@ def check_symbols(ref_path, target_path):
103
150
readobj_opts , target_path ])
104
151
symbols = parse_readobj_output (readobj_out )
105
152
106
- # Presence of _dl_relocate_static_pie depends on whether ld.gold or ld.lld
107
- # is used. Ignore it for the purpose of the library ABI check.
108
- ignore_symbols = ["_dl_relocate_static_pie" ]
109
-
110
- # In some scenarios MSVC and clang-cl exhibit differences in regards to the exported symbols they generate.
111
- # Some of them happen in the SYCL RT library and we think clang-cl's behavior is more reasonable.
112
- #
113
- # Case 1:
114
- # pi.hpp:
115
- # template <backend BE> __SYCL_EXPORT const plugin &getPlugin();
116
- #
117
- # pi.cpp:
118
- # template <backend BE> const plugin &getPlugin() {
119
- # static const plugin *Plugin = nullptr;
120
- # ...
121
- # }
122
- # // explicit dllexport instantiations.
123
- #
124
- # clang-cl generates exported symbols for the static variables Plugin. These are never referenced
125
- # in the user's headers so cannot be used outside DLL and not exporting them should not affect any
126
- # usage scenario.
127
- #
128
- # In general, the compiler doesn't know if the definition is in the DLL or in the header and inline
129
- # dllexport/dllimport functions have to be supported, hence clang-cl's behavior.
130
- #
131
- # See also https://devblogs.microsoft.com/oldnewthing/20140109-00/?p=2123.
132
- ignore_symbols += ["?Plugin@?1???$getPlugin@$01@pi@detail@_V1@sycl@@YAAEBVplugin@234@XZ@4PEBV5234@EB" ,
133
- "?Plugin@?1???$getPlugin@$00@pi@detail@_V1@sycl@@YAAEBVplugin@234@XZ@4PEBV5234@EB" ,
134
- "?Plugin@?1???$getPlugin@$04@pi@detail@_V1@sycl@@YAAEBVplugin@234@XZ@4PEBV5234@EB" ,
135
- "?Plugin@?1???$getPlugin@$02@pi@detail@_V1@sycl@@YAAEBVplugin@234@XZ@4PEBV5234@EB" ]
136
- # Case 2:
137
- # half_type.hpp:
138
- # class __SYCL_EXPORT half {
139
- # ...
140
- # constexpr half(const half &) = default;
141
- # constexpr half(half &&) = default;
142
- # ...
143
- # };
144
- #
145
- # For some reason MSVC creates exported symbols for the constexpr versions of those defaulted ctors
146
- # although it never calls them at use point. Instead, those trivially copyable/moveable objects are
147
- # memcpy/memmove'ed. We don't expect these symbols are ever referenced directly so having or not
148
- # having them won't cause ABI issues.
149
- ignore_symbols += ["??0half@host_half_impl@detail@_V1@sycl@@QEAA@AEBV01234@@Z" ,
150
- "??0half@host_half_impl@detail@_V1@sycl@@QEAA@$$QEAV01234@@Z" ]
151
- symbols = [s for s in symbols if s not in ignore_symbols ]
152
-
153
153
missing_symbols , new_symbols = compare_results (ref_symbols , symbols )
154
154
155
155
correct_return = True
0 commit comments