llvm19/llvm_build_tablegen_component_as_shared_library.patch
Aaron Puchert cdde20622b - New release based on version 19.1.0.
* For details, see the release notes:
    - https://releases.llvm.org/19.1.0/docs/ReleaseNotes.html
    - https://releases.llvm.org/19.1.0/tools/clang/docs/ReleaseNotes.html
    - https://releases.llvm.org/19.1.0/tools/clang/tools/extra/docs/ReleaseNotes.html
    - https://releases.llvm.org/19.1.0/projects/libcxx/docs/ReleaseNotes.html
    - https://releases.llvm.org/19.1.0/tools/lld/docs/ReleaseNotes.html
  * New LLVM tool: reduce-chunk-list to help find bugs using debug
    counters. See the Programmer's Manual for usage.
  * New Clang tools: clang-installapi for Apple-related package
    management, clang-nvlink-wrapper as a wrapper around `nvlink`.
- No longer include OpenMP offload libraries.
- Rebase patches:
  * clang-fix-openmp-test.patch
  * libcxx-test-library-path.patch
  * llvm-do-not-install-static-libraries.patch
  * llvm_build_tablegen_component_as_shared_library.patch
- Remove obsolete patches:
  * lld-default-sha1.patch because upstream switched to sha1.
  * llvm-remove-clang-only-flags.patch because warning flags are no
    longer autodetected.
  * openmp-dont-run-gpu-arch.patch because we're excluding the
    offload project for now.
- Add llvm-fix-build-failure-on-ppc64le.patch to fix ppc64le build.
- Require Python 3.11 on Leap because we need Python >= 3.8 now.

OBS-URL: https://build.opensuse.org/package/show/devel:tools:compiler/llvm19?expand=0&rev=1
2024-09-22 21:02:27 +00:00

59 lines
2.4 KiB
Diff

The LLVMTableGen component is a special case that is excluded from libLLVM and
normally is only built as static library and linked into llvm-tblgen.
We need to have it as a shared library to be available for other projects such
as ldc.
This patch makes it even more special and forces it to be build and installed
as separate shared library.
Index: llvm-8.0.0rc3.src/cmake/modules/AddLLVM.cmake
===================================================================
--- llvm-8.0.0rc3.src.orig/cmake/modules/AddLLVM.cmake
+++ llvm-8.0.0rc3.src/cmake/modules/AddLLVM.cmake
@@ -541,7 +541,7 @@ function(llvm_add_library name)
if(ARG_MODULE AND LLVM_EXPORT_SYMBOLS_FOR_PLUGINS AND ARG_PLUGIN_TOOL AND (WIN32 OR CYGWIN))
# On DLL platforms symbols are imported from the tool by linking against it.
set(llvm_libs ${ARG_PLUGIN_TOOL})
- elseif (NOT ARG_COMPONENT_LIB)
+ elseif (NOT ARG_COMPONENT_LIB OR (${name} STREQUAL "LLVMTableGen" AND LLVM_BUILD_LLVM_DYLIB))
if (LLVM_LINK_LLVM_DYLIB AND NOT ARG_DISABLE_LLVM_LINK_LLVM_DYLIB)
set(llvm_libs LLVM)
else()
Index: llvm-17.0.0rc1.src/cmake/modules/TableGen.cmake
===================================================================
--- llvm-17.0.0rc1.src.orig/cmake/modules/TableGen.cmake
+++ llvm-17.0.0rc1.src/cmake/modules/TableGen.cmake
@@ -143,8 +143,8 @@ macro(add_tablegen target project)
set(${target}_OLD_LLVM_LINK_COMPONENTS ${LLVM_LINK_COMPONENTS})
set(LLVM_LINK_COMPONENTS ${LLVM_LINK_COMPONENTS} TableGen)
- add_llvm_executable(${target} DISABLE_LLVM_LINK_LLVM_DYLIB
- ${ADD_TABLEGEN_UNPARSED_ARGUMENTS})
+ add_llvm_executable(${target} ${ADD_TABLEGEN_UNPARSED_ARGUMENTS})
+ target_link_libraries(${target} PRIVATE LLVMTableGen)
set(LLVM_LINK_COMPONENTS ${${target}_OLD_LLVM_LINK_COMPONENTS})
set(${project}_TABLEGEN_DEFAULT "${target}")
Index: llvm-8.0.0rc3.src/lib/TableGen/CMakeLists.txt
===================================================================
--- llvm-8.0.0rc3.src.orig/lib/TableGen/CMakeLists.txt
+++ llvm-8.0.0rc3.src/lib/TableGen/CMakeLists.txt
@@ -1,3 +1,7 @@
+if (LLVM_BUILD_LLVM_DYLIB)
+ set(MAYBE_SHARED SHARED)
+endif()
+
add_llvm_component_library(LLVMTableGen
DetailedRecordsBackend.cpp
Error.cpp
@@ -9,6 +13,8 @@ add_llvm_library(LLVMTableGen
TGLexer.cpp
TGParser.cpp
+ ${MAYBE_SHARED}
+
ADDITIONAL_HEADER_DIRS
${LLVM_MAIN_INCLUDE_DIR}/llvm/TableGen