SHA256
1
0
forked from pool/llvm14
llvm14/llvm_build_tablegen_component_as_shared_library.patch
Aaron Puchert 3b54262c5d Accepting request 979583 from home:aaronpuchert:branches:devel:tools:compiler
- Update to version 14.0.4.
  * This release contains bug-fixes for the LLVM 14.0.0 release.
    This release is API and ABI compatible with 14.0.0.
- Don't use gold for linking anymore: on s390x we use ld.bfd with
  LLVMgold.so, on ppc64 we disable ThinLTO for now.
- Using ld.bfd on s390x exposed an issue with the existing
  llvm_build_tablegen_component_as_shared_library.patch: linking
  llvm-tblgen with libLLVM.so means we also have to link libraries
  used for that (like LLVMTableGenGlobalISel) with libLLVM.so.
- Rewrite summary and description for llvm-gold to point out that
  it can also be used with ld.bfd, recommend with binutils.
- Prefer RPM macros over shell scripting, so that we can better
  inspect the build script with substitutions in place.
- More memory for stage 1 build jobs due to recent OOMs.
- Add %_libclang_sonum RPM macro to llvm-devel, since that might
  now diverge from %_llvm_sonum.
- Rebase llvm-do-not-install-static-libraries.patch.

OBS-URL: https://build.opensuse.org/request/show/979583
OBS-URL: https://build.opensuse.org/package/show/devel:tools:compiler/llvm14?expand=0&rev=16
2022-05-28 12:45:59 +00:00

71 lines
2.7 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-8.0.0rc3.src/cmake/modules/TableGen.cmake
===================================================================
--- llvm-8.0.0rc3.src.orig/cmake/modules/TableGen.cmake
+++ llvm-8.0.0rc3.src/cmake/modules/TableGen.cmake
@@ -115,7 +115,8 @@ macro(add_tablegen target project)
set(LLVM_ENABLE_OBJLIB ON)
endif()
- add_llvm_executable(${target} DISABLE_LLVM_LINK_LLVM_DYLIB ${ARGN})
+ add_llvm_executable(${target} ${ARGN})
+ target_link_libraries(${target} PRIVATE LLVMTableGen)
set(LLVM_LINK_COMPONENTS ${${target}_OLD_LLVM_LINK_COMPONENTS})
set(${project}_TABLEGEN "${target}" CACHE
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
Index: llvm-14.0.3.src/utils/TableGen/GlobalISel/CMakeLists.txt
===================================================================
--- llvm-14.0.3.src.orig/utils/TableGen/GlobalISel/CMakeLists.txt
+++ llvm-14.0.3.src/utils/TableGen/GlobalISel/CMakeLists.txt
@@ -3,7 +3,7 @@ set(LLVM_LINK_COMPONENTS
TableGen
)
-add_llvm_library(LLVMTableGenGlobalISel STATIC DISABLE_LLVM_LINK_LLVM_DYLIB
+add_llvm_library(LLVMTableGenGlobalISel STATIC
CodeExpander.cpp
GIMatchDag.cpp
GIMatchDagEdge.cpp