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

Collapse All | Expand All

(-)b/devel/llvm13/files/patch-backport-version-fixes (+355 lines)
Added Link Here
1
diff --git llvm/tools/lto/CMakeLists.txt llvm/tools/lto/CMakeLists.txt
2
index 0af29ad762c5..055ce247e4e3 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
 if(CMAKE_SYSTEM_NAME STREQUAL AIX)
17
     set(LTO_LIBRARY_TYPE MODULE)
18
diff --git llvm/tools/lto/lto.dylib.exports llvm/tools/lto/lto.dylib.exports
19
new file mode 100644
20
index 000000000000..8fdbd3522b9b
21
--- /dev/null
22
+++ llvm/tools/lto/lto.dylib.exports
23
@@ -0,0 +1,76 @@
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
+lto_set_debug_options
70
+thinlto_create_codegen
71
+thinlto_codegen_dispose
72
+thinlto_codegen_add_module
73
+thinlto_codegen_process
74
+thinlto_module_get_num_objects
75
+thinlto_module_get_object
76
+thinlto_codegen_set_pic_model
77
+thinlto_codegen_set_cache_dir
78
+thinlto_codegen_set_cache_pruning_interval
79
+thinlto_codegen_set_cache_entry_expiration
80
+thinlto_codegen_set_final_cache_size_relative_to_available_space
81
+thinlto_codegen_set_cache_size_bytes
82
+thinlto_codegen_set_cache_size_megabytes
83
+thinlto_codegen_set_cache_size_files
84
+thinlto_codegen_set_savetemps_dir
85
+thinlto_codegen_set_cpu
86
+thinlto_debug_options
87
+lto_module_is_thinlto
88
+thinlto_codegen_add_must_preserve_symbol
89
+thinlto_codegen_add_cross_referenced_symbol
90
+thinlto_codegen_set_codegen_only
91
+thinlto_codegen_disable_codegen
92
+thinlto_module_get_num_object_files
93
+thinlto_module_get_object_file
94
+thinlto_set_generated_objects_dir
95
+lto_input_create
96
+lto_input_dispose
97
+lto_input_get_num_dependent_libraries
98
+lto_input_get_dependent_library
99
+lto_runtime_lib_symbols_list
100
diff --git llvm/tools/lto/lto.exports llvm/tools/lto/lto.exports
101
index 1948bba29b67..8fdbd3522b9b 100644
102
--- llvm/tools/lto/lto.exports
103
+++ llvm/tools/lto/lto.exports
104
@@ -44,12 +44,6 @@ lto_codegen_compile_optimized
105
 lto_codegen_set_should_internalize
106
 lto_codegen_set_should_embed_uselists
107
 lto_set_debug_options
108
-LLVMCreateDisasm
109
-LLVMCreateDisasmCPU
110
-LLVMDisasmDispose
111
-LLVMDisasmInstruction
112
-LLVMSetDisasmOptions
113
-LLVMCreateDisasmCPUFeatures
114
 thinlto_create_codegen
115
 thinlto_codegen_dispose
116
 thinlto_codegen_add_module
117
diff --git llvm/tools/remarks-shlib/CMakeLists.txt llvm/tools/remarks-shlib/CMakeLists.txt
118
index 865436247270..81a1d75964f0 100644
119
--- llvm/tools/remarks-shlib/CMakeLists.txt
120
+++ llvm/tools/remarks-shlib/CMakeLists.txt
121
@@ -9,7 +9,11 @@ if(LLVM_ENABLE_PIC)
122
     libremarks.cpp
123
     )
124
 
125
-  set(LLVM_EXPORTED_SYMBOL_FILE ${CMAKE_CURRENT_SOURCE_DIR}/Remarks.exports)
126
+  if (LLVM_LINK_LLVM_DYLIB)
127
+    set(LLVM_EXPORTED_SYMBOL_FILE ${CMAKE_CURRENT_SOURCE_DIR}/Remarks.dylib.exports)
128
+  else()
129
+    set(LLVM_EXPORTED_SYMBOL_FILE ${CMAKE_CURRENT_SOURCE_DIR}/Remarks.exports)
130
+  endif()
131
 
132
   add_llvm_library(Remarks SHARED INSTALL_WITH_TOOLCHAIN ${SOURCES})
133
 
134
diff --git llvm/tools/remarks-shlib/Remarks.dylib.exports llvm/tools/remarks-shlib/Remarks.dylib.exports
135
new file mode 100644
136
index 000000000000..0c2a3c38c78c
137
--- /dev/null
138
+++ llvm/tools/remarks-shlib/Remarks.dylib.exports
139
@@ -0,0 +1 @@
140
+LLVMRemarkVersion
141
diff --git openmp/libomptarget/plugins/exports openmp/libomptarget/plugins/exports
142
index 61cc6746defd..cc7beda183af 100644
143
--- openmp/libomptarget/plugins/exports
144
+++ openmp/libomptarget/plugins/exports
145
@@ -1,29 +1,6 @@
146
 VERS1.0 {
147
   global:
148
-    __tgt_rtl_is_valid_binary;
149
-    __tgt_rtl_is_data_exchangable;
150
-    __tgt_rtl_number_of_devices;
151
-    __tgt_rtl_init_requires;
152
-    __tgt_rtl_init_device;
153
-    __tgt_rtl_load_binary;
154
-    __tgt_rtl_data_alloc;
155
-    __tgt_rtl_data_submit;
156
-    __tgt_rtl_data_submit_async;
157
-    __tgt_rtl_data_retrieve;
158
-    __tgt_rtl_data_retrieve_async;
159
-    __tgt_rtl_data_exchange;
160
-    __tgt_rtl_data_exchange_async;
161
-    __tgt_rtl_data_delete;
162
-    __tgt_rtl_run_target_team_region;
163
-    __tgt_rtl_run_target_team_region_async;
164
-    __tgt_rtl_run_target_region;
165
-    __tgt_rtl_run_target_region_async;
166
-    __tgt_rtl_synchronize;
167
-    __tgt_rtl_register_lib;
168
-    __tgt_rtl_unregister_lib;
169
-    __tgt_rtl_supports_empty_images;
170
-    __tgt_rtl_set_info_flag;
171
-    __tgt_rtl_print_device_info;
172
+    __tgt_rtl*;
173
   local:
174
     *;
175
 };
176
diff --git openmp/runtime/cmake/LibompHandleFlags.cmake openmp/runtime/cmake/LibompHandleFlags.cmake
177
index 9e19e59ba17d..1ddbc870e0f1 100644
178
--- openmp/runtime/cmake/LibompHandleFlags.cmake
179
+++ openmp/runtime/cmake/LibompHandleFlags.cmake
180
@@ -98,7 +98,6 @@ function(libomp_get_ldflags ldflags)
181
     IF_DEFINED CMAKE_C_OSX_CURRENT_VERSION_FLAG)
182
   libomp_append(ldflags_local "${CMAKE_C_OSX_COMPATIBILITY_VERSION_FLAG}${LIBOMP_VERSION_MAJOR}.${LIBOMP_VERSION_MINOR}"
183
     IF_DEFINED CMAKE_C_OSX_COMPATIBILITY_VERSION_FLAG)
184
-  libomp_append(ldflags_local -Wl,--warn-shared-textrel LIBOMP_HAVE_WARN_SHARED_TEXTREL_FLAG)
185
   libomp_append(ldflags_local -Wl,--as-needed LIBOMP_HAVE_AS_NEEDED_FLAG)
186
   libomp_append(ldflags_local "-Wl,--version-script=${LIBOMP_SRC_DIR}/exports_so.txt" LIBOMP_HAVE_VERSION_SCRIPT_FLAG)
187
   libomp_append(ldflags_local -static-libgcc LIBOMP_HAVE_STATIC_LIBGCC_FLAG)
188
diff --git openmp/runtime/cmake/config-ix.cmake openmp/runtime/cmake/config-ix.cmake
189
index 56d0ddb321f6..6608d182692d 100644
190
--- openmp/runtime/cmake/config-ix.cmake
191
+++ openmp/runtime/cmake/config-ix.cmake
192
@@ -114,9 +114,8 @@ if(WIN32)
193
   libomp_check_linker_flag(/SAFESEH LIBOMP_HAVE_SAFESEH_FLAG)
194
 elseif(NOT APPLE)
195
   libomp_check_linker_flag(-Wl,-x LIBOMP_HAVE_X_FLAG)
196
-  libomp_check_linker_flag(-Wl,--warn-shared-textrel LIBOMP_HAVE_WARN_SHARED_TEXTREL_FLAG)
197
   libomp_check_linker_flag(-Wl,--as-needed LIBOMP_HAVE_AS_NEEDED_FLAG)
198
-  libomp_check_linker_flag("-Wl,--version-script=${LIBOMP_SRC_DIR}/exports_so.txt" LIBOMP_HAVE_VERSION_SCRIPT_FLAG)
199
+  libomp_check_linker_flag("-Wl,--version-script=${LIBOMP_SRC_DIR}/exports_test_so.txt" LIBOMP_HAVE_VERSION_SCRIPT_FLAG)
200
   libomp_check_linker_flag(-static-libgcc LIBOMP_HAVE_STATIC_LIBGCC_FLAG)
201
   libomp_check_linker_flag(-Wl,-z,noexecstack LIBOMP_HAVE_Z_NOEXECSTACK_FLAG)
202
 endif()
203
diff --git openmp/runtime/src/exports_so.txt openmp/runtime/src/exports_so.txt
204
index cb79ae72e67b..16f2438647fe 100644
205
--- openmp/runtime/src/exports_so.txt
206
+++ openmp/runtime/src/exports_so.txt
207
@@ -71,10 +71,8 @@ VERSION {
208
         __kmp_fork_call;
209
         __kmp_invoke_microtask;
210
 #if KMP_USE_MONITOR
211
-        __kmp_launch_monitor;
212
         __kmp_reap_monitor;
213
 #endif
214
-        __kmp_launch_worker;
215
         __kmp_reap_worker;
216
         __kmp_release_64;
217
         __kmp_wait_64;
218
diff --git openmp/runtime/src/exports_test_so.txt openmp/runtime/src/exports_test_so.txt
219
new file mode 100644
220
index 000000000000..912d160e7c06
221
--- /dev/null
222
+++ openmp/runtime/src/exports_test_so.txt
223
@@ -0,0 +1,60 @@
224
+# exports_test_so.txt #
225
+
226
+#
227
+#//===----------------------------------------------------------------------===//
228
+#//
229
+#// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
230
+#// See https://llvm.org/LICENSE.txt for license information.
231
+#// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
232
+#//
233
+#//===----------------------------------------------------------------------===//
234
+#
235
+
236
+# This is used only to test if the linker supports version scripts. If the full
237
+# version script it used we may error on undefined symbols and erroneously fail.
238
+
239
+VERSION {
240
+
241
+    global: # Exported symbols.
242
+
243
+        *;         # All symbols as exported for testing.
244
+
245
+    local: # Non-exported symbols.
246
+
247
+        *;         # All other symbols are not exported.
248
+
249
+}; # VERSION
250
+
251
+# sets up GCC OMP_ version dependency chain
252
+OMP_1.0 {
253
+};
254
+OMP_2.0 {
255
+} OMP_1.0;
256
+OMP_3.0 {
257
+} OMP_2.0;
258
+OMP_3.1 {
259
+} OMP_3.0;
260
+OMP_4.0 {
261
+} OMP_3.1;
262
+OMP_4.5 {
263
+} OMP_4.0;
264
+OMP_5.0 {
265
+} OMP_4.5;
266
+
267
+# sets up GCC GOMP_ version dependency chain
268
+GOMP_1.0 {
269
+};
270
+GOMP_2.0 {
271
+} GOMP_1.0;
272
+GOMP_3.0 {
273
+} GOMP_2.0;
274
+GOMP_4.0 {
275
+} GOMP_3.0;
276
+GOMP_4.5 {
277
+} GOMP_4.0;
278
+GOMP_5.0 {
279
+} GOMP_4.5;
280
+GOMP_5.0.1 {
281
+} GOMP_5.0;
282
+
283
+# end of file #
284
diff --git openmp/runtime/src/kmp_runtime.cpp openmp/runtime/src/kmp_runtime.cpp
285
index 16d415dc8a74..1d873773bbc2 100644
286
--- openmp/runtime/src/kmp_runtime.cpp
287
+++ openmp/runtime/src/kmp_runtime.cpp
288
@@ -8844,3 +8844,20 @@ void __kmp_set_nesting_mode_threads() {
289
   if (__kmp_nesting_mode == 1) // turn on nesting for this case only
290
     set__max_active_levels(thread, __kmp_nesting_mode_nlevels);
291
 }
292
+
293
+// Empty symbols to export (see exports_so.txt) when feature is disabled
294
+extern "C" {
295
+#if !KMP_STATS_ENABLED
296
+void __kmp_reset_stats() {}
297
+#endif
298
+#if !USE_DEBUGGER
299
+int __kmp_omp_debug_struct_info = FALSE;
300
+int __kmp_debugging = FALSE;
301
+#endif
302
+#if !USE_ITT_BUILD || !USE_ITT_NOTIFY
303
+void __kmp_itt_fini_ittlib() {}
304
+void __kmp_itt_init_ittlib() {}
305
+#endif
306
+}
307
+
308
+// end of file
309
diff --git openmp/runtime/src/kmp_utility.cpp openmp/runtime/src/kmp_utility.cpp
310
index c4bfead9d0d6..5846a993619e 100644
311
--- openmp/runtime/src/kmp_utility.cpp
312
+++ openmp/runtime/src/kmp_utility.cpp
313
@@ -397,3 +397,16 @@ void __kmp_expand_file_name(char *result, size_t rlen, char *pattern) {
314
 
315
   *pos = '\0';
316
 }
317
+
318
+#if !OMPT_SUPPORT
319
+extern "C" {
320
+typedef struct ompt_start_tool_result_t ompt_start_tool_result_t;
321
+// Define symbols expected by VERSION script
322
+ompt_start_tool_result_t *ompt_start_tool(unsigned int omp_version,
323
+                                          const char *runtime_version) {
324
+  return nullptr;
325
+}
326
+
327
+void ompt_libomp_connect(ompt_start_tool_result_t *result) { result = nullptr; }
328
+}
329
+#endif
330
diff --git openmp/runtime/src/z_Linux_util.cpp openmp/runtime/src/z_Linux_util.cpp
331
index 42ad1d56f9ec..19fca31a2db0 100644
332
--- openmp/runtime/src/z_Linux_util.cpp
333
+++ openmp/runtime/src/z_Linux_util.cpp
334
@@ -987,7 +987,7 @@ void __kmp_exit_thread(int exit_status) {
335
 #if KMP_USE_MONITOR
336
 void __kmp_resume_monitor();
337
 
338
-void __kmp_reap_monitor(kmp_info_t *th) {
339
+extern "C" void __kmp_reap_monitor(kmp_info_t *th) {
340
   int status;
341
   void *exit_val;
342
 
343
@@ -1029,6 +1029,12 @@ void __kmp_reap_monitor(kmp_info_t *th) {
344
 
345
   KMP_MB(); /* Flush all pending memory write invalidates.  */
346
 }
347
+#else
348
+// Empty symbol to export (see exports_so.txt) when
349
+// monitor thread feature is disabled
350
+extern "C" void __kmp_reap_monitor(kmp_info_t *th) {
351
+  (void)th;
352
+}
353
 #endif // KMP_USE_MONITOR
354
 
355
 void __kmp_reap_worker(kmp_info_t *th) {

Return to bug 273959