View | Details | Raw Unified | Return to bug 273959 | Differences between
and this patch

Collapse All | Expand All

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

Return to bug 273959