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

Collapse All | Expand All

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

Return to bug 273959