[llvm] 61311f3 - Use different export file when linking with dylib

via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 13 12:34:15 PST 2022


Author: serge-sans-paille
Date: 2022-12-13T21:33:58+01:00
New Revision: 61311f3c9363534eda3bc9b8a5edbab80048cdd4

URL: https://github.com/llvm/llvm-project/commit/61311f3c9363534eda3bc9b8a5edbab80048cdd4
DIFF: https://github.com/llvm/llvm-project/commit/61311f3c9363534eda3bc9b8a5edbab80048cdd4.diff

LOG: Use different export file when linking with dylib

This fixes compilation of clang with lld, as reported in
https://reviews.llvm.org/D135402.

Basically some symbols are not available when not linking statically.

Differential Revision: https://reviews.llvm.org/D139932

Added: 
    llvm/tools/lto/lto.dylib.exports
    llvm/tools/remarks-shlib/Remarks.dylib.exports

Modified: 
    llvm/tools/lto/CMakeLists.txt
    llvm/tools/remarks-shlib/CMakeLists.txt

Removed: 
    


################################################################################
diff  --git a/llvm/tools/lto/CMakeLists.txt b/llvm/tools/lto/CMakeLists.txt
index 67f6d3af40e05..9382ee9588b37 100644
--- a/llvm/tools/lto/CMakeLists.txt
+++ b/llvm/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()
 
 if(CMAKE_SYSTEM_NAME STREQUAL AIX)
     set(LTO_LIBRARY_TYPE MODULE)

diff  --git a/llvm/tools/lto/lto.dylib.exports b/llvm/tools/lto/lto.dylib.exports
new file mode 100644
index 0000000000000..4164c3919a97f
--- /dev/null
+++ b/llvm/tools/lto/lto.dylib.exports
@@ -0,0 +1,77 @@
+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_has_ctor_dtor
+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
+lto_set_debug_options
+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 a/llvm/tools/remarks-shlib/CMakeLists.txt b/llvm/tools/remarks-shlib/CMakeLists.txt
index f22cedd9ead78..2f108a42c9aab 100644
--- a/llvm/tools/remarks-shlib/CMakeLists.txt
+++ b/llvm/tools/remarks-shlib/CMakeLists.txt
@@ -9,7 +9,11 @@ if(LLVM_ENABLE_PIC)
     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 a/llvm/tools/remarks-shlib/Remarks.dylib.exports b/llvm/tools/remarks-shlib/Remarks.dylib.exports
new file mode 100644
index 0000000000000..0c2a3c38c78ce
--- /dev/null
+++ b/llvm/tools/remarks-shlib/Remarks.dylib.exports
@@ -0,0 +1 @@
+LLVMRemarkVersion


        


More information about the llvm-commits mailing list