@@ -102,9 +102,52 @@ def check_symbols(ref_path, target_path):
102
102
readobj_out = subprocess .check_output ([get_llvm_bin_path ()+ "llvm-readobj" ,
103
103
readobj_opts , target_path ])
104
104
symbols = parse_readobj_output (readobj_out )
105
+
105
106
# Presence of _dl_relocate_static_pie depends on whether ld.gold or ld.lld
106
107
# is used. Ignore it for the purpose of the library ABI check.
107
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" ]
108
151
symbols = [s for s in symbols if s not in ignore_symbols ]
109
152
110
153
missing_symbols , new_symbols = compare_results (ref_symbols , symbols )
0 commit comments