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

Collapse All | Expand All

(-)b/devel/llvm14/files/patch-backport-version-fixes (+375 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 8664a2e493ee..cc7beda183af 100644
144
--- openmp/libomptarget/plugins/exports
145
+++ openmp/libomptarget/plugins/exports
146
@@ -1,36 +1,6 @@
147
 VERS1.0 {
148
   global:
149
-    __tgt_rtl_is_valid_binary;
150
-    __tgt_rtl_is_data_exchangable;
151
-    __tgt_rtl_number_of_devices;
152
-    __tgt_rtl_init_requires;
153
-    __tgt_rtl_init_device;
154
-    __tgt_rtl_load_binary;
155
-    __tgt_rtl_data_alloc;
156
-    __tgt_rtl_data_submit;
157
-    __tgt_rtl_data_submit_async;
158
-    __tgt_rtl_data_retrieve;
159
-    __tgt_rtl_data_retrieve_async;
160
-    __tgt_rtl_data_exchange;
161
-    __tgt_rtl_data_exchange_async;
162
-    __tgt_rtl_data_delete;
163
-    __tgt_rtl_run_target_team_region;
164
-    __tgt_rtl_run_target_team_region_async;
165
-    __tgt_rtl_run_target_region;
166
-    __tgt_rtl_run_target_region_async;
167
-    __tgt_rtl_synchronize;
168
-    __tgt_rtl_register_lib;
169
-    __tgt_rtl_unregister_lib;
170
-    __tgt_rtl_supports_empty_images;
171
-    __tgt_rtl_set_info_flag;
172
-    __tgt_rtl_print_device_info;
173
-    __tgt_rtl_create_event;
174
-    __tgt_rtl_record_event;
175
-    __tgt_rtl_wait_event;
176
-    __tgt_rtl_sync_event;
177
-    __tgt_rtl_destroy_event;
178
-    __tgt_rtl_init_device_info;
179
-    __tgt_rtl_init_async_info;
180
+    __tgt_rtl*;
181
   local:
182
     *;
183
 };
184
diff --git openmp/libomptarget/src/exports openmp/libomptarget/src/exports
185
index 0ef4c8cce521..425a6fad49cf 100644
186
--- openmp/libomptarget/src/exports
187
+++ openmp/libomptarget/src/exports
188
@@ -48,7 +48,6 @@ VERS1.0 {
189
     omp_get_interop_int;
190
     omp_get_interop_name;
191
     omp_get_interop_type_desc;
192
-    omp_get_interop_rc_desc;
193
     __tgt_interop_init;
194
     __tgt_interop_use;
195
     __tgt_interop_destroy;
196
diff --git openmp/runtime/cmake/LibompHandleFlags.cmake openmp/runtime/cmake/LibompHandleFlags.cmake
197
index 9e19e59ba17d..1ddbc870e0f1 100644
198
--- openmp/runtime/cmake/LibompHandleFlags.cmake
199
+++ openmp/runtime/cmake/LibompHandleFlags.cmake
200
@@ -98,7 +98,6 @@ function(libomp_get_ldflags ldflags)
201
     IF_DEFINED CMAKE_C_OSX_CURRENT_VERSION_FLAG)
202
   libomp_append(ldflags_local "${CMAKE_C_OSX_COMPATIBILITY_VERSION_FLAG}${LIBOMP_VERSION_MAJOR}.${LIBOMP_VERSION_MINOR}"
203
     IF_DEFINED CMAKE_C_OSX_COMPATIBILITY_VERSION_FLAG)
204
-  libomp_append(ldflags_local -Wl,--warn-shared-textrel LIBOMP_HAVE_WARN_SHARED_TEXTREL_FLAG)
205
   libomp_append(ldflags_local -Wl,--as-needed LIBOMP_HAVE_AS_NEEDED_FLAG)
206
   libomp_append(ldflags_local "-Wl,--version-script=${LIBOMP_SRC_DIR}/exports_so.txt" LIBOMP_HAVE_VERSION_SCRIPT_FLAG)
207
   libomp_append(ldflags_local -static-libgcc LIBOMP_HAVE_STATIC_LIBGCC_FLAG)
208
diff --git openmp/runtime/cmake/config-ix.cmake openmp/runtime/cmake/config-ix.cmake
209
index 0fe1266b0067..d3806a446743 100644
210
--- openmp/runtime/cmake/config-ix.cmake
211
+++ openmp/runtime/cmake/config-ix.cmake
212
@@ -131,9 +131,8 @@ if(WIN32)
213
   libomp_check_linker_flag(/SAFESEH LIBOMP_HAVE_SAFESEH_FLAG)
214
 elseif(NOT APPLE)
215
   libomp_check_linker_flag(-Wl,-x LIBOMP_HAVE_X_FLAG)
216
-  libomp_check_linker_flag(-Wl,--warn-shared-textrel LIBOMP_HAVE_WARN_SHARED_TEXTREL_FLAG)
217
   libomp_check_linker_flag(-Wl,--as-needed LIBOMP_HAVE_AS_NEEDED_FLAG)
218
-  libomp_check_linker_flag("-Wl,--version-script=${LIBOMP_SRC_DIR}/exports_so.txt" LIBOMP_HAVE_VERSION_SCRIPT_FLAG)
219
+  libomp_check_linker_flag("-Wl,--version-script=${LIBOMP_SRC_DIR}/exports_test_so.txt" LIBOMP_HAVE_VERSION_SCRIPT_FLAG)
220
   libomp_check_linker_flag(-static-libgcc LIBOMP_HAVE_STATIC_LIBGCC_FLAG)
221
   libomp_check_linker_flag(-Wl,-z,noexecstack LIBOMP_HAVE_Z_NOEXECSTACK_FLAG)
222
 endif()
223
diff --git openmp/runtime/src/exports_so.txt openmp/runtime/src/exports_so.txt
224
index ac188af31055..834c6118d820 100644
225
--- openmp/runtime/src/exports_so.txt
226
+++ openmp/runtime/src/exports_so.txt
227
@@ -71,10 +71,8 @@ VERSION {
228
         __kmp_fork_call;
229
         __kmp_invoke_microtask;
230
 #if KMP_USE_MONITOR
231
-        __kmp_launch_monitor;
232
         __kmp_reap_monitor;
233
 #endif
234
-        __kmp_launch_worker;
235
         __kmp_reap_worker;
236
         __kmp_release_64;
237
         __kmp_wait_64;
238
diff --git openmp/runtime/src/exports_test_so.txt openmp/runtime/src/exports_test_so.txt
239
new file mode 100644
240
index 000000000000..912d160e7c06
241
--- /dev/null
242
+++ openmp/runtime/src/exports_test_so.txt
243
@@ -0,0 +1,60 @@
244
+# exports_test_so.txt #
245
+
246
+#
247
+#//===----------------------------------------------------------------------===//
248
+#//
249
+#// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
250
+#// See https://llvm.org/LICENSE.txt for license information.
251
+#// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
252
+#//
253
+#//===----------------------------------------------------------------------===//
254
+#
255
+
256
+# This is used only to test if the linker supports version scripts. If the full
257
+# version script it used we may error on undefined symbols and erroneously fail.
258
+
259
+VERSION {
260
+
261
+    global: # Exported symbols.
262
+
263
+        *;         # All symbols as exported for testing.
264
+
265
+    local: # Non-exported symbols.
266
+
267
+        *;         # All other symbols are not exported.
268
+
269
+}; # VERSION
270
+
271
+# sets up GCC OMP_ version dependency chain
272
+OMP_1.0 {
273
+};
274
+OMP_2.0 {
275
+} OMP_1.0;
276
+OMP_3.0 {
277
+} OMP_2.0;
278
+OMP_3.1 {
279
+} OMP_3.0;
280
+OMP_4.0 {
281
+} OMP_3.1;
282
+OMP_4.5 {
283
+} OMP_4.0;
284
+OMP_5.0 {
285
+} OMP_4.5;
286
+
287
+# sets up GCC GOMP_ version dependency chain
288
+GOMP_1.0 {
289
+};
290
+GOMP_2.0 {
291
+} GOMP_1.0;
292
+GOMP_3.0 {
293
+} GOMP_2.0;
294
+GOMP_4.0 {
295
+} GOMP_3.0;
296
+GOMP_4.5 {
297
+} GOMP_4.0;
298
+GOMP_5.0 {
299
+} GOMP_4.5;
300
+GOMP_5.0.1 {
301
+} GOMP_5.0;
302
+
303
+# end of file #
304
diff --git openmp/runtime/src/kmp_runtime.cpp openmp/runtime/src/kmp_runtime.cpp
305
index e1af2f43dae7..3db713e8c88b 100644
306
--- openmp/runtime/src/kmp_runtime.cpp
307
+++ openmp/runtime/src/kmp_runtime.cpp
308
@@ -9156,3 +9156,20 @@ void __kmp_set_nesting_mode_threads() {
309
   if (__kmp_nesting_mode == 1) // turn on nesting for this case only
310
     set__max_active_levels(thread, __kmp_nesting_mode_nlevels);
311
 }
312
+
313
+// Empty symbols to export (see exports_so.txt) when feature is disabled
314
+extern "C" {
315
+#if !KMP_STATS_ENABLED
316
+void __kmp_reset_stats() {}
317
+#endif
318
+#if !USE_DEBUGGER
319
+int __kmp_omp_debug_struct_info = FALSE;
320
+int __kmp_debugging = FALSE;
321
+#endif
322
+#if !USE_ITT_BUILD || !USE_ITT_NOTIFY
323
+void __kmp_itt_fini_ittlib() {}
324
+void __kmp_itt_init_ittlib() {}
325
+#endif
326
+}
327
+
328
+// end of file
329
diff --git openmp/runtime/src/kmp_utility.cpp openmp/runtime/src/kmp_utility.cpp
330
index 48d31e5ee7b7..5937f8026e39 100644
331
--- openmp/runtime/src/kmp_utility.cpp
332
+++ openmp/runtime/src/kmp_utility.cpp
333
@@ -403,3 +403,16 @@ void __kmp_expand_file_name(char *result, size_t rlen, char *pattern) {
334
 
335
   *pos = '\0';
336
 }
337
+
338
+#if !OMPT_SUPPORT
339
+extern "C" {
340
+typedef struct ompt_start_tool_result_t ompt_start_tool_result_t;
341
+// Define symbols expected by VERSION script
342
+ompt_start_tool_result_t *ompt_start_tool(unsigned int omp_version,
343
+                                          const char *runtime_version) {
344
+  return nullptr;
345
+}
346
+
347
+void ompt_libomp_connect(ompt_start_tool_result_t *result) { result = nullptr; }
348
+}
349
+#endif
350
diff --git openmp/runtime/src/z_Linux_util.cpp openmp/runtime/src/z_Linux_util.cpp
351
index 5cd6ad6a0339..f6cad7b5320a 100644
352
--- openmp/runtime/src/z_Linux_util.cpp
353
+++ openmp/runtime/src/z_Linux_util.cpp
354
@@ -987,7 +987,7 @@ void __kmp_exit_thread(int exit_status) {
355
 #if KMP_USE_MONITOR
356
 void __kmp_resume_monitor();
357
 
358
-void __kmp_reap_monitor(kmp_info_t *th) {
359
+extern "C" void __kmp_reap_monitor(kmp_info_t *th) {
360
   int status;
361
   void *exit_val;
362
 
363
@@ -1029,6 +1029,12 @@ void __kmp_reap_monitor(kmp_info_t *th) {
364
 
365
   KMP_MB(); /* Flush all pending memory write invalidates.  */
366
 }
367
+#else
368
+// Empty symbol to export (see exports_so.txt) when
369
+// monitor thread feature is disabled
370
+extern "C" void __kmp_reap_monitor(kmp_info_t *th) {
371
+  (void)th;
372
+}
373
 #endif // KMP_USE_MONITOR
374
 
375
 void __kmp_reap_worker(kmp_info_t *th) {

Return to bug 273959