devel/llvm10: actually fix build with llvm17

I failed to apply the actual patch and committed the ports patch
instead.  It applies because it just creates files.

PR:		273959
Fixes:		50e51d2680 devel/llvm10: fix build with llvm17
This commit is contained in:
Brooks Davis 2023-09-21 11:01:29 +01:00
parent 94be0b2fc2
commit adfdd1a786
4 changed files with 687 additions and 356 deletions

View file

@ -1,358 +1,202 @@
commit bba9c39a53588d4cdf0d033e02fc0b630678affa diff --git projects/openmp/libomptarget/plugins/exports projects/openmp/libomptarget/plugins/exports
Author: Dimitry Andric <dim@FreeBSD.org> index a14bedf0791a..cc7beda183af 100644
Date: 2023-09-20T09:14:29+02:00 --- projects/openmp/libomptarget/plugins/exports
+++ projects/openmp/libomptarget/plugins/exports
devel/llvm10: fix build with lld 17 @@ -1,16 +1,6 @@
VERS1.0 {
diff --git a/devel/llvm10/files/openmp/patch-backport-version-fixes b/devel/llvm10/files/openmp/patch-backport-version-fixes global:
- __tgt_rtl_is_valid_binary;
- __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_retrieve;
- __tgt_rtl_data_delete;
- __tgt_rtl_run_target_team_region;
- __tgt_rtl_run_target_region;
+ __tgt_rtl*;
local:
*;
};
diff --git projects/openmp/runtime/cmake/LibompHandleFlags.cmake projects/openmp/runtime/cmake/LibompHandleFlags.cmake
index 0b8e3a35c888..cacc192eb378 100644
--- projects/openmp/runtime/cmake/LibompHandleFlags.cmake
+++ projects/openmp/runtime/cmake/LibompHandleFlags.cmake
@@ -94,7 +94,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 projects/openmp/runtime/cmake/config-ix.cmake projects/openmp/runtime/cmake/config-ix.cmake
index 3419dd8cd788..fb7a644155e2 100644
--- projects/openmp/runtime/cmake/config-ix.cmake
+++ projects/openmp/runtime/cmake/config-ix.cmake
@@ -100,9 +100,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 projects/openmp/runtime/src/exports_so.txt projects/openmp/runtime/src/exports_so.txt
index f7de5fd6474f..07a5424595bb 100644
--- projects/openmp/runtime/src/exports_so.txt
+++ projects/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 projects/openmp/runtime/src/exports_test_so.txt projects/openmp/runtime/src/exports_test_so.txt
new file mode 100644 new file mode 100644
index 000000000000..ab3129432bbc index 000000000000..912d160e7c06
--- /dev/null --- /dev/null
+++ b/devel/llvm10/files/openmp/patch-backport-version-fixes +++ projects/openmp/runtime/src/exports_test_so.txt
@@ -0,0 +1,202 @@ @@ -0,0 +1,60 @@
+diff --git projects/openmp/libomptarget/plugins/exports projects/openmp/libomptarget/plugins/exports +# exports_test_so.txt #
+index a14bedf0791a..cc7beda183af 100644 +
+--- projects/openmp/libomptarget/plugins/exports +#
++++ projects/openmp/libomptarget/plugins/exports +#//===----------------------------------------------------------------------===//
+@@ -1,16 +1,6 @@ +#//
+ VERS1.0 { +#// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+ global: +#// See https://llvm.org/LICENSE.txt for license information.
+- __tgt_rtl_is_valid_binary; +#// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+- __tgt_rtl_number_of_devices; +#//
+- __tgt_rtl_init_requires; +#//===----------------------------------------------------------------------===//
+- __tgt_rtl_init_device; +#
+- __tgt_rtl_load_binary; +
+- __tgt_rtl_data_alloc; +# This is used only to test if the linker supports version scripts. If the full
+- __tgt_rtl_data_submit; +# version script it used we may error on undefined symbols and erroneously fail.
+- __tgt_rtl_data_retrieve; +
+- __tgt_rtl_data_delete; +VERSION {
+- __tgt_rtl_run_target_team_region; +
+- __tgt_rtl_run_target_region; + global: # Exported symbols.
++ __tgt_rtl*; +
+ local: + *; # All symbols as exported for testing.
+ *; +
+ }; + local: # Non-exported symbols.
+diff --git projects/openmp/runtime/cmake/LibompHandleFlags.cmake projects/openmp/runtime/cmake/LibompHandleFlags.cmake +
+index 0b8e3a35c888..cacc192eb378 100644 + *; # All other symbols are not exported.
+--- projects/openmp/runtime/cmake/LibompHandleFlags.cmake +
++++ projects/openmp/runtime/cmake/LibompHandleFlags.cmake +}; # VERSION
+@@ -94,7 +94,6 @@ function(libomp_get_ldflags ldflags) +
+ IF_DEFINED CMAKE_C_OSX_CURRENT_VERSION_FLAG) +# sets up GCC OMP_ version dependency chain
+ libomp_append(ldflags_local "${CMAKE_C_OSX_COMPATIBILITY_VERSION_FLAG}${LIBOMP_VERSION_MAJOR}.${LIBOMP_VERSION_MINOR}" +OMP_1.0 {
+ IF_DEFINED CMAKE_C_OSX_COMPATIBILITY_VERSION_FLAG) +};
+- libomp_append(ldflags_local -Wl,--warn-shared-textrel LIBOMP_HAVE_WARN_SHARED_TEXTREL_FLAG) +OMP_2.0 {
+ libomp_append(ldflags_local -Wl,--as-needed LIBOMP_HAVE_AS_NEEDED_FLAG) +} OMP_1.0;
+ libomp_append(ldflags_local "-Wl,--version-script=${LIBOMP_SRC_DIR}/exports_so.txt" LIBOMP_HAVE_VERSION_SCRIPT_FLAG) +OMP_3.0 {
+ libomp_append(ldflags_local -static-libgcc LIBOMP_HAVE_STATIC_LIBGCC_FLAG) +} OMP_2.0;
+diff --git projects/openmp/runtime/cmake/config-ix.cmake projects/openmp/runtime/cmake/config-ix.cmake +OMP_3.1 {
+index 3419dd8cd788..fb7a644155e2 100644 +} OMP_3.0;
+--- projects/openmp/runtime/cmake/config-ix.cmake +OMP_4.0 {
++++ projects/openmp/runtime/cmake/config-ix.cmake +} OMP_3.1;
+@@ -100,9 +100,8 @@ if(WIN32) +OMP_4.5 {
+ libomp_check_linker_flag(/SAFESEH LIBOMP_HAVE_SAFESEH_FLAG) +} OMP_4.0;
+ elseif(NOT APPLE) +OMP_5.0 {
+ libomp_check_linker_flag(-Wl,-x LIBOMP_HAVE_X_FLAG) +} OMP_4.5;
+- 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) +# sets up GCC GOMP_ version dependency chain
+- libomp_check_linker_flag("-Wl,--version-script=${LIBOMP_SRC_DIR}/exports_so.txt" LIBOMP_HAVE_VERSION_SCRIPT_FLAG) +GOMP_1.0 {
++ 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) +GOMP_2.0 {
+ libomp_check_linker_flag(-Wl,-z,noexecstack LIBOMP_HAVE_Z_NOEXECSTACK_FLAG) +} GOMP_1.0;
+ endif() +GOMP_3.0 {
+diff --git projects/openmp/runtime/src/exports_so.txt projects/openmp/runtime/src/exports_so.txt +} GOMP_2.0;
+index f7de5fd6474f..07a5424595bb 100644 +GOMP_4.0 {
+--- projects/openmp/runtime/src/exports_so.txt +} GOMP_3.0;
++++ projects/openmp/runtime/src/exports_so.txt +GOMP_4.5 {
+@@ -74,10 +74,8 @@ VERSION { +} GOMP_4.0;
+ __kmp_fork_call; +GOMP_5.0 {
+ __kmp_invoke_microtask; +} GOMP_4.5;
+ #if KMP_USE_MONITOR +GOMP_5.0.1 {
+- __kmp_launch_monitor; +} GOMP_5.0;
+ __kmp_reap_monitor; +
+ #endif +# end of file #
+- __kmp_launch_worker; diff --git projects/openmp/runtime/src/kmp_runtime.cpp projects/openmp/runtime/src/kmp_runtime.cpp
+ __kmp_reap_worker; index acd157db8e52..acc431ea0d7e 100644
+ __kmp_release_64; --- projects/openmp/runtime/src/kmp_runtime.cpp
+ __kmp_wait_64; +++ projects/openmp/runtime/src/kmp_runtime.cpp
+diff --git projects/openmp/runtime/src/exports_test_so.txt projects/openmp/runtime/src/exports_test_so.txt @@ -8297,3 +8297,20 @@ int __kmp_pause_resource(kmp_pause_status_t level) {
+new file mode 100644 return 1;
+index 000000000000..912d160e7c06 }
+--- /dev/null }
++++ projects/openmp/runtime/src/exports_test_so.txt +
+@@ -0,0 +1,60 @@ +// Empty symbols to export (see exports_so.txt) when feature is disabled
++# exports_test_so.txt # +extern "C" {
++ +#if !KMP_STATS_ENABLED
++# +void __kmp_reset_stats() {}
++#//===----------------------------------------------------------------------===// +#endif
++#// +#if !USE_DEBUGGER
++#// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +int __kmp_omp_debug_struct_info = FALSE;
++#// See https://llvm.org/LICENSE.txt for license information. +int __kmp_debugging = FALSE;
++#// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +#endif
++#// +#if !USE_ITT_BUILD || !USE_ITT_NOTIFY
++#//===----------------------------------------------------------------------===// +void __kmp_itt_fini_ittlib() {}
++# +void __kmp_itt_init_ittlib() {}
++ +#endif
++# 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. +
++ +// end of file
++VERSION { diff --git projects/openmp/runtime/src/kmp_utility.cpp projects/openmp/runtime/src/kmp_utility.cpp
++ index 44a99d0455b3..e04c9cbf4537 100644
++ global: # Exported symbols. --- projects/openmp/runtime/src/kmp_utility.cpp
++ +++ projects/openmp/runtime/src/kmp_utility.cpp
++ *; # All symbols as exported for testing. @@ -407,3 +407,16 @@ void __kmp_expand_file_name(char *result, size_t rlen, char *pattern) {
++
++ local: # Non-exported symbols. *pos = '\0';
++ }
++ *; # All other symbols are not exported. +
++ +#if !OMPT_SUPPORT
++}; # VERSION +extern "C" {
++ +typedef struct ompt_start_tool_result_t ompt_start_tool_result_t;
++# sets up GCC OMP_ version dependency chain +// Define symbols expected by VERSION script
++OMP_1.0 { +ompt_start_tool_result_t *ompt_start_tool(unsigned int omp_version,
++}; + const char *runtime_version) {
++OMP_2.0 { + return nullptr;
++} OMP_1.0; +}
++OMP_3.0 { +
++} OMP_2.0; +void ompt_libomp_connect(ompt_start_tool_result_t *result) { result = nullptr; }
++OMP_3.1 { +}
++} OMP_3.0; +#endif
++OMP_4.0 { diff --git projects/openmp/runtime/src/z_Linux_util.cpp projects/openmp/runtime/src/z_Linux_util.cpp
++} OMP_3.1; index 1daa3d31047e..174ef2145205 100644
++OMP_4.5 { --- projects/openmp/runtime/src/z_Linux_util.cpp
++} OMP_4.0; +++ projects/openmp/runtime/src/z_Linux_util.cpp
++OMP_5.0 { @@ -1049,7 +1049,7 @@ void __kmp_exit_thread(int exit_status) {
++} OMP_4.5; #if KMP_USE_MONITOR
++ void __kmp_resume_monitor();
++# sets up GCC GOMP_ version dependency chain
++GOMP_1.0 { -void __kmp_reap_monitor(kmp_info_t *th) {
++}; +extern "C" void __kmp_reap_monitor(kmp_info_t *th) {
++GOMP_2.0 { int status;
++} GOMP_1.0; void *exit_val;
++GOMP_3.0 {
++} GOMP_2.0; @@ -1091,6 +1091,12 @@ void __kmp_reap_monitor(kmp_info_t *th) {
++GOMP_4.0 {
++} GOMP_3.0; KMP_MB(); /* Flush all pending memory write invalidates. */
++GOMP_4.5 { }
++} GOMP_4.0; +#else
++GOMP_5.0 { +// Empty symbol to export (see exports_so.txt) when
++} GOMP_4.5; +// monitor thread feature is disabled
++GOMP_5.0.1 { +extern "C" void __kmp_reap_monitor(kmp_info_t *th) {
++} GOMP_5.0; + (void)th;
++ +}
++# end of file # #endif // KMP_USE_MONITOR
+diff --git projects/openmp/runtime/src/kmp_runtime.cpp projects/openmp/runtime/src/kmp_runtime.cpp
+index acd157db8e52..acc431ea0d7e 100644 void __kmp_reap_worker(kmp_info_t *th) {
+--- projects/openmp/runtime/src/kmp_runtime.cpp
++++ projects/openmp/runtime/src/kmp_runtime.cpp
+@@ -8297,3 +8297,20 @@ int __kmp_pause_resource(kmp_pause_status_t level) {
+ return 1;
+ }
+ }
++
++// 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 projects/openmp/runtime/src/kmp_utility.cpp projects/openmp/runtime/src/kmp_utility.cpp
+index 44a99d0455b3..e04c9cbf4537 100644
+--- projects/openmp/runtime/src/kmp_utility.cpp
++++ projects/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 projects/openmp/runtime/src/z_Linux_util.cpp projects/openmp/runtime/src/z_Linux_util.cpp
+index 1daa3d31047e..174ef2145205 100644
+--- projects/openmp/runtime/src/z_Linux_util.cpp
++++ projects/openmp/runtime/src/z_Linux_util.cpp
+@@ -1049,7 +1049,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;
+
+@@ -1091,6 +1091,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) {
diff --git a/devel/llvm10/files/patch-backport-version-fixes b/devel/llvm10/files/patch-backport-version-fixes
new file mode 100644
index 000000000000..0faee193caec
--- /dev/null
+++ b/devel/llvm10/files/patch-backport-version-fixes
@@ -0,0 +1,138 @@
+diff --git tools/lto/CMakeLists.txt tools/lto/CMakeLists.txt
+index b86e4abd01a7..d814df767b65 100644
+--- tools/lto/CMakeLists.txt
++++ tools/lto/CMakeLists.txt
+@@ -18,7 +18,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 tools/lto/lto.dylib.exports tools/lto/lto.dylib.exports
+new file mode 100644
+index 000000000000..4a1fff8f93ca
+--- /dev/null
++++ tools/lto/lto.dylib.exports
+@@ -0,0 +1,74 @@
++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_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 tools/lto/lto.exports tools/lto/lto.exports
+index fd2212cb5f33..4a1fff8f93ca 100644
+--- tools/lto/lto.exports
++++ tools/lto/lto.exports
+@@ -42,12 +42,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 tools/remarks-shlib/CMakeLists.txt tools/remarks-shlib/CMakeLists.txt
+index e948496c603a..4c66ad487070 100644
+--- tools/remarks-shlib/CMakeLists.txt
++++ tools/remarks-shlib/CMakeLists.txt
+@@ -6,7 +6,11 @@ set(SOURCES
+ 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 tools/remarks-shlib/Remarks.dylib.exports tools/remarks-shlib/Remarks.dylib.exports
+new file mode 100644
+index 000000000000..0c2a3c38c78c
+--- /dev/null
++++ tools/remarks-shlib/Remarks.dylib.exports
+@@ -0,0 +1 @@
++LLVMRemarkVersion

View file

@ -0,0 +1,138 @@
diff --git tools/lto/CMakeLists.txt tools/lto/CMakeLists.txt
index b86e4abd01a7..d814df767b65 100644
--- tools/lto/CMakeLists.txt
+++ tools/lto/CMakeLists.txt
@@ -18,7 +18,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 tools/lto/lto.dylib.exports tools/lto/lto.dylib.exports
new file mode 100644
index 000000000000..4a1fff8f93ca
--- /dev/null
+++ tools/lto/lto.dylib.exports
@@ -0,0 +1,74 @@
+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_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 tools/lto/lto.exports tools/lto/lto.exports
index fd2212cb5f33..4a1fff8f93ca 100644
--- tools/lto/lto.exports
+++ tools/lto/lto.exports
@@ -42,12 +42,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 tools/remarks-shlib/CMakeLists.txt tools/remarks-shlib/CMakeLists.txt
index e948496c603a..4c66ad487070 100644
--- tools/remarks-shlib/CMakeLists.txt
+++ tools/remarks-shlib/CMakeLists.txt
@@ -6,7 +6,11 @@ set(SOURCES
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 tools/remarks-shlib/Remarks.dylib.exports tools/remarks-shlib/Remarks.dylib.exports
new file mode 100644
index 000000000000..0c2a3c38c78c
--- /dev/null
+++ tools/remarks-shlib/Remarks.dylib.exports
@@ -0,0 +1 @@
+LLVMRemarkVersion

View file

@ -0,0 +1,210 @@
diff --git projects/openmp/libomptarget/plugins/exports projects/openmp/libomptarget/plugins/exports
index 62bfc6e24d90..cc7beda183af 100644
--- projects/openmp/libomptarget/plugins/exports
+++ projects/openmp/libomptarget/plugins/exports
@@ -1,24 +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*;
local:
*;
};
diff --git projects/openmp/runtime/cmake/LibompHandleFlags.cmake projects/openmp/runtime/cmake/LibompHandleFlags.cmake
index 0b8e3a35c888..cacc192eb378 100644
--- projects/openmp/runtime/cmake/LibompHandleFlags.cmake
+++ projects/openmp/runtime/cmake/LibompHandleFlags.cmake
@@ -94,7 +94,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 projects/openmp/runtime/cmake/config-ix.cmake projects/openmp/runtime/cmake/config-ix.cmake
index 3419dd8cd788..fb7a644155e2 100644
--- projects/openmp/runtime/cmake/config-ix.cmake
+++ projects/openmp/runtime/cmake/config-ix.cmake
@@ -100,9 +100,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 projects/openmp/runtime/src/exports_so.txt projects/openmp/runtime/src/exports_so.txt
index 30222418163d..4e159a1abf29 100644
--- projects/openmp/runtime/src/exports_so.txt
+++ projects/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 projects/openmp/runtime/src/exports_test_so.txt projects/openmp/runtime/src/exports_test_so.txt
new file mode 100644
index 000000000000..912d160e7c06
--- /dev/null
+++ projects/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 projects/openmp/runtime/src/kmp_runtime.cpp projects/openmp/runtime/src/kmp_runtime.cpp
index e0c8cf241044..772942079b1b 100644
--- projects/openmp/runtime/src/kmp_runtime.cpp
+++ projects/openmp/runtime/src/kmp_runtime.cpp
@@ -8305,3 +8305,20 @@ void __kmp_omp_display_env(int verbose) {
__kmp_display_env_impl(!verbose, verbose);
__kmp_release_bootstrap_lock(&__kmp_initz_lock);
}
+
+// 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 projects/openmp/runtime/src/kmp_utility.cpp projects/openmp/runtime/src/kmp_utility.cpp
index 6e6785deb445..5f66e2509d33 100644
--- projects/openmp/runtime/src/kmp_utility.cpp
+++ projects/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 projects/openmp/runtime/src/z_Linux_util.cpp projects/openmp/runtime/src/z_Linux_util.cpp
index 3b5910fc95e8..e36952f30982 100644
--- projects/openmp/runtime/src/z_Linux_util.cpp
+++ projects/openmp/runtime/src/z_Linux_util.cpp
@@ -1049,7 +1049,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;
@@ -1091,6 +1091,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) {

View file

@ -0,0 +1,139 @@
diff --git tools/lto/CMakeLists.txt tools/lto/CMakeLists.txt
index 2963f97cad88..ae1ae6f48886 100644
--- tools/lto/CMakeLists.txt
+++ 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 tools/lto/lto.dylib.exports tools/lto/lto.dylib.exports
new file mode 100644
index 000000000000..2871abd34e40
--- /dev/null
+++ 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 tools/lto/lto.exports tools/lto/lto.exports
index 1f0a6b23d3fd..2871abd34e40 100644
--- tools/lto/lto.exports
+++ 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 tools/remarks-shlib/CMakeLists.txt tools/remarks-shlib/CMakeLists.txt
index e948496c603a..4c66ad487070 100644
--- tools/remarks-shlib/CMakeLists.txt
+++ tools/remarks-shlib/CMakeLists.txt
@@ -6,7 +6,11 @@ set(SOURCES
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 tools/remarks-shlib/Remarks.dylib.exports tools/remarks-shlib/Remarks.dylib.exports
new file mode 100644
index 000000000000..0c2a3c38c78c
--- /dev/null
+++ tools/remarks-shlib/Remarks.dylib.exports
@@ -0,0 +1 @@
+LLVMRemarkVersion