summaryrefslogtreecommitdiff
path: root/devel/llvm12/files/patch-backport-version-fixes
blob: dab049adb188354a7dcaee8b83a7be865b3e0940 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
diff --git llvm/tools/lto/CMakeLists.txt llvm/tools/lto/CMakeLists.txt
index 2963f97cad88..ae1ae6f48886 100644
--- llvm/tools/lto/CMakeLists.txt
+++ llvm/tools/lto/CMakeLists.txt
@@ -19,7 +19,11 @@ set(SOURCES
   lto.cpp
   )
 
-set(LLVM_EXPORTED_SYMBOL_FILE ${CMAKE_CURRENT_SOURCE_DIR}/lto.exports)
+if (LLVM_LINK_LLVM_DYLIB)
+  set(LLVM_EXPORTED_SYMBOL_FILE ${CMAKE_CURRENT_SOURCE_DIR}/lto.dylib.exports)
+else()
+  set(LLVM_EXPORTED_SYMBOL_FILE ${CMAKE_CURRENT_SOURCE_DIR}/lto.exports)
+endif()
 
 add_llvm_library(LTO SHARED INSTALL_WITH_TOOLCHAIN ${SOURCES} DEPENDS
     intrinsics_gen)
diff --git llvm/tools/lto/lto.dylib.exports llvm/tools/lto/lto.dylib.exports
new file mode 100644
index 000000000000..2871abd34e40
--- /dev/null
+++ llvm/tools/lto/lto.dylib.exports
@@ -0,0 +1,75 @@
+lto_get_error_message
+lto_get_version
+lto_initialize_disassembler
+lto_module_create
+lto_module_create_from_fd
+lto_module_create_from_fd_at_offset
+lto_module_create_from_memory
+lto_module_create_from_memory_with_path
+lto_module_create_in_local_context
+lto_module_create_in_codegen_context
+lto_module_get_linkeropts
+lto_module_get_macho_cputype
+lto_module_get_num_symbols
+lto_module_get_symbol_attribute
+lto_module_get_symbol_name
+lto_module_get_target_triple
+lto_module_set_target_triple
+lto_module_is_object_file
+lto_module_is_object_file_for_target
+lto_module_is_object_file_in_memory
+lto_module_is_object_file_in_memory_for_target
+lto_module_has_objc_category
+lto_module_dispose
+lto_api_version
+lto_codegen_set_diagnostic_handler
+lto_codegen_add_module
+lto_codegen_set_module
+lto_codegen_add_must_preserve_symbol
+lto_codegen_compile
+lto_codegen_create
+lto_codegen_create_in_local_context
+lto_codegen_dispose
+lto_codegen_set_debug_model
+lto_codegen_set_pic_model
+lto_codegen_write_merged_modules
+lto_codegen_debug_options
+lto_codegen_debug_options_array
+lto_codegen_set_assembler_args
+lto_codegen_set_assembler_path
+lto_codegen_set_cpu
+lto_codegen_compile_to_file
+lto_codegen_optimize
+lto_codegen_compile_optimized
+lto_codegen_set_should_internalize
+lto_codegen_set_should_embed_uselists
+thinlto_create_codegen
+thinlto_codegen_dispose
+thinlto_codegen_add_module
+thinlto_codegen_process
+thinlto_module_get_num_objects
+thinlto_module_get_object
+thinlto_codegen_set_pic_model
+thinlto_codegen_set_cache_dir
+thinlto_codegen_set_cache_pruning_interval
+thinlto_codegen_set_cache_entry_expiration
+thinlto_codegen_set_final_cache_size_relative_to_available_space
+thinlto_codegen_set_cache_size_bytes
+thinlto_codegen_set_cache_size_megabytes
+thinlto_codegen_set_cache_size_files
+thinlto_codegen_set_savetemps_dir
+thinlto_codegen_set_cpu
+thinlto_debug_options
+lto_module_is_thinlto
+thinlto_codegen_add_must_preserve_symbol
+thinlto_codegen_add_cross_referenced_symbol
+thinlto_codegen_set_codegen_only
+thinlto_codegen_disable_codegen
+thinlto_module_get_num_object_files
+thinlto_module_get_object_file
+thinlto_set_generated_objects_dir
+lto_input_create
+lto_input_dispose
+lto_input_get_num_dependent_libraries
+lto_input_get_dependent_library
+lto_runtime_lib_symbols_list
diff --git llvm/tools/lto/lto.exports llvm/tools/lto/lto.exports
index 1f0a6b23d3fd..2871abd34e40 100644
--- llvm/tools/lto/lto.exports
+++ llvm/tools/lto/lto.exports
@@ -43,12 +43,6 @@ lto_codegen_optimize
 lto_codegen_compile_optimized
 lto_codegen_set_should_internalize
 lto_codegen_set_should_embed_uselists
-LLVMCreateDisasm
-LLVMCreateDisasmCPU
-LLVMDisasmDispose
-LLVMDisasmInstruction
-LLVMSetDisasmOptions
-LLVMCreateDisasmCPUFeatures
 thinlto_create_codegen
 thinlto_codegen_dispose
 thinlto_codegen_add_module
diff --git llvm/tools/remarks-shlib/CMakeLists.txt llvm/tools/remarks-shlib/CMakeLists.txt
index 865436247270..81a1d75964f0 100644
--- llvm/tools/remarks-shlib/CMakeLists.txt
+++ llvm/tools/remarks-shlib/CMakeLists.txt
@@ -9,7 +9,11 @@ if(LLVM_ENABLE_PIC)
     libremarks.cpp
     )
 
-  set(LLVM_EXPORTED_SYMBOL_FILE ${CMAKE_CURRENT_SOURCE_DIR}/Remarks.exports)
+  if (LLVM_LINK_LLVM_DYLIB)
+    set(LLVM_EXPORTED_SYMBOL_FILE ${CMAKE_CURRENT_SOURCE_DIR}/Remarks.dylib.exports)
+  else()
+    set(LLVM_EXPORTED_SYMBOL_FILE ${CMAKE_CURRENT_SOURCE_DIR}/Remarks.exports)
+  endif()
 
   add_llvm_library(Remarks SHARED INSTALL_WITH_TOOLCHAIN ${SOURCES})
 
diff --git llvm/tools/remarks-shlib/Remarks.dylib.exports llvm/tools/remarks-shlib/Remarks.dylib.exports
new file mode 100644
index 000000000000..0c2a3c38c78c
--- /dev/null
+++ llvm/tools/remarks-shlib/Remarks.dylib.exports
@@ -0,0 +1 @@
+LLVMRemarkVersion
diff --git openmp/libomptarget/plugins/exports openmp/libomptarget/plugins/exports
index 48f81c088200..cc7beda183af 100644
--- openmp/libomptarget/plugins/exports
+++ openmp/libomptarget/plugins/exports
@@ -1,26 +1,6 @@
 VERS1.0 {
   global:
-    __tgt_rtl_is_valid_binary;
-    __tgt_rtl_is_data_exchangable;
-    __tgt_rtl_number_of_devices;
-    __tgt_rtl_init_requires;
-    __tgt_rtl_init_device;
-    __tgt_rtl_load_binary;
-    __tgt_rtl_data_alloc;
-    __tgt_rtl_data_submit;
-    __tgt_rtl_data_submit_async;
-    __tgt_rtl_data_retrieve;
-    __tgt_rtl_data_retrieve_async;
-    __tgt_rtl_data_exchange;
-    __tgt_rtl_data_exchange_async;
-    __tgt_rtl_data_delete;
-    __tgt_rtl_run_target_team_region;
-    __tgt_rtl_run_target_team_region_async;
-    __tgt_rtl_run_target_region;
-    __tgt_rtl_run_target_region_async;
-    __tgt_rtl_synchronize;
-    __tgt_rtl_register_lib;
-    __tgt_rtl_unregister_lib;
+    __tgt_rtl*;
   local:
     *;
 };
diff --git openmp/runtime/cmake/LibompHandleFlags.cmake openmp/runtime/cmake/LibompHandleFlags.cmake
index 4a25359a788c..3c63da905d35 100644
--- openmp/runtime/cmake/LibompHandleFlags.cmake
+++ openmp/runtime/cmake/LibompHandleFlags.cmake
@@ -95,7 +95,6 @@ function(libomp_get_ldflags ldflags)
     IF_DEFINED CMAKE_C_OSX_CURRENT_VERSION_FLAG)
   libomp_append(ldflags_local "${CMAKE_C_OSX_COMPATIBILITY_VERSION_FLAG}${LIBOMP_VERSION_MAJOR}.${LIBOMP_VERSION_MINOR}"
     IF_DEFINED CMAKE_C_OSX_COMPATIBILITY_VERSION_FLAG)
-  libomp_append(ldflags_local -Wl,--warn-shared-textrel LIBOMP_HAVE_WARN_SHARED_TEXTREL_FLAG)
   libomp_append(ldflags_local -Wl,--as-needed LIBOMP_HAVE_AS_NEEDED_FLAG)
   libomp_append(ldflags_local "-Wl,--version-script=${LIBOMP_SRC_DIR}/exports_so.txt" LIBOMP_HAVE_VERSION_SCRIPT_FLAG)
   libomp_append(ldflags_local -static-libgcc LIBOMP_HAVE_STATIC_LIBGCC_FLAG)
diff --git openmp/runtime/cmake/config-ix.cmake openmp/runtime/cmake/config-ix.cmake
index ed62aefccd14..8e38759d7253 100644
--- openmp/runtime/cmake/config-ix.cmake
+++ openmp/runtime/cmake/config-ix.cmake
@@ -111,9 +111,8 @@ if(WIN32)
   libomp_check_linker_flag(/SAFESEH LIBOMP_HAVE_SAFESEH_FLAG)
 elseif(NOT APPLE)
   libomp_check_linker_flag(-Wl,-x LIBOMP_HAVE_X_FLAG)
-  libomp_check_linker_flag(-Wl,--warn-shared-textrel LIBOMP_HAVE_WARN_SHARED_TEXTREL_FLAG)
   libomp_check_linker_flag(-Wl,--as-needed LIBOMP_HAVE_AS_NEEDED_FLAG)
-  libomp_check_linker_flag("-Wl,--version-script=${LIBOMP_SRC_DIR}/exports_so.txt" LIBOMP_HAVE_VERSION_SCRIPT_FLAG)
+  libomp_check_linker_flag("-Wl,--version-script=${LIBOMP_SRC_DIR}/exports_test_so.txt" LIBOMP_HAVE_VERSION_SCRIPT_FLAG)
   libomp_check_linker_flag(-static-libgcc LIBOMP_HAVE_STATIC_LIBGCC_FLAG)
   libomp_check_linker_flag(-Wl,-z,noexecstack LIBOMP_HAVE_Z_NOEXECSTACK_FLAG)
 endif()
diff --git openmp/runtime/src/exports_so.txt openmp/runtime/src/exports_so.txt
index 30222418163d..4e159a1abf29 100644
--- openmp/runtime/src/exports_so.txt
+++ openmp/runtime/src/exports_so.txt
@@ -74,10 +74,8 @@ VERSION {
         __kmp_fork_call;
         __kmp_invoke_microtask;
 #if KMP_USE_MONITOR
-        __kmp_launch_monitor;
         __kmp_reap_monitor;
 #endif
-        __kmp_launch_worker;
         __kmp_reap_worker;
         __kmp_release_64;
         __kmp_wait_64;
diff --git openmp/runtime/src/exports_test_so.txt openmp/runtime/src/exports_test_so.txt
new file mode 100644
index 000000000000..912d160e7c06
--- /dev/null
+++ openmp/runtime/src/exports_test_so.txt
@@ -0,0 +1,60 @@
+# exports_test_so.txt #
+
+#
+#//===----------------------------------------------------------------------===//
+#//
+#// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+#// See https://llvm.org/LICENSE.txt for license information.
+#// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+#//
+#//===----------------------------------------------------------------------===//
+#
+
+# This is used only to test if the linker supports version scripts. If the full
+# version script it used we may error on undefined symbols and erroneously fail.
+
+VERSION {
+
+    global: # Exported symbols.
+
+        *;         # All symbols as exported for testing.
+
+    local: # Non-exported symbols.
+
+        *;         # All other symbols are not exported.
+
+}; # VERSION
+
+# sets up GCC OMP_ version dependency chain
+OMP_1.0 {
+};
+OMP_2.0 {
+} OMP_1.0;
+OMP_3.0 {
+} OMP_2.0;
+OMP_3.1 {
+} OMP_3.0;
+OMP_4.0 {
+} OMP_3.1;
+OMP_4.5 {
+} OMP_4.0;
+OMP_5.0 {
+} OMP_4.5;
+
+# sets up GCC GOMP_ version dependency chain
+GOMP_1.0 {
+};
+GOMP_2.0 {
+} GOMP_1.0;
+GOMP_3.0 {
+} GOMP_2.0;
+GOMP_4.0 {
+} GOMP_3.0;
+GOMP_4.5 {
+} GOMP_4.0;
+GOMP_5.0 {
+} GOMP_4.5;
+GOMP_5.0.1 {
+} GOMP_5.0;
+
+# end of file #
diff --git openmp/runtime/src/kmp_runtime.cpp openmp/runtime/src/kmp_runtime.cpp
index b981f8740dbe..81a01622b462 100644
--- openmp/runtime/src/kmp_runtime.cpp
+++ openmp/runtime/src/kmp_runtime.cpp
@@ -8624,3 +8624,20 @@ void __kmp_hidden_helper_threads_initz_routine() {
 
   __kmp_hidden_helper_threads_deinitz_release();
 }
+
+// Empty symbols to export (see exports_so.txt) when feature is disabled
+extern "C" {
+#if !KMP_STATS_ENABLED
+void __kmp_reset_stats() {}
+#endif
+#if !USE_DEBUGGER
+int __kmp_omp_debug_struct_info = FALSE;
+int __kmp_debugging = FALSE;
+#endif
+#if !USE_ITT_BUILD || !USE_ITT_NOTIFY
+void __kmp_itt_fini_ittlib() {}
+void __kmp_itt_init_ittlib() {}
+#endif
+}
+
+// end of file
diff --git openmp/runtime/src/kmp_utility.cpp openmp/runtime/src/kmp_utility.cpp
index f163f0551aa5..8ad7c61324d7 100644
--- openmp/runtime/src/kmp_utility.cpp
+++ openmp/runtime/src/kmp_utility.cpp
@@ -407,3 +407,16 @@ void __kmp_expand_file_name(char *result, size_t rlen, char *pattern) {
 
   *pos = '\0';
 }
+
+#if !OMPT_SUPPORT
+extern "C" {
+typedef struct ompt_start_tool_result_t ompt_start_tool_result_t;
+// Define symbols expected by VERSION script
+ompt_start_tool_result_t *ompt_start_tool(unsigned int omp_version,
+                                          const char *runtime_version) {
+  return nullptr;
+}
+
+void ompt_libomp_connect(ompt_start_tool_result_t *result) { result = nullptr; }
+}
+#endif
diff --git openmp/runtime/src/z_Linux_util.cpp openmp/runtime/src/z_Linux_util.cpp
index 95feafbec8e5..b4a656d21b89 100644
--- openmp/runtime/src/z_Linux_util.cpp
+++ openmp/runtime/src/z_Linux_util.cpp
@@ -1051,7 +1051,7 @@ void __kmp_exit_thread(int exit_status) {
 #if KMP_USE_MONITOR
 void __kmp_resume_monitor();
 
-void __kmp_reap_monitor(kmp_info_t *th) {
+extern "C" void __kmp_reap_monitor(kmp_info_t *th) {
   int status;
   void *exit_val;
 
@@ -1093,6 +1093,12 @@ void __kmp_reap_monitor(kmp_info_t *th) {
 
   KMP_MB(); /* Flush all pending memory write invalidates.  */
 }
+#else
+// Empty symbol to export (see exports_so.txt) when
+// monitor thread feature is disabled
+extern "C" void __kmp_reap_monitor(kmp_info_t *th) {
+  (void)th;
+}
 #endif // KMP_USE_MONITOR
 
 void __kmp_reap_worker(kmp_info_t *th) {