mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-22 18:54:02 +01:00
c884b23a0a
MCTargetOptionsCommandFlags.inc and CommandFlags.inc are headers which contain cl::opt with static storage. These headers are meant to be incuded by tools to make it easier to parametrize codegen/mc. However, these headers are also included in at least two libraries: lldCommon and handle-llvm. As a result, when creating DYLIB, clang-cpp holds a reference to the options, and lldCommon holds another reference. Linking the two in a single executable, as zig does[0], results in a double registration. This patch explores an other approach: the .inc files are moved to regular files, and the registration happens on-demand through static declaration of options in the constructor of a static object. [0] https://bugzilla.redhat.com/show_bug.cgi?id=1756977#c5 Differential Revision: https://reviews.llvm.org/D75579
40 lines
896 B
CMake
40 lines
896 B
CMake
set(LLVM_LINK_COMPONENTS
|
|
AllTargetsAsmParsers
|
|
AllTargetsCodeGens
|
|
AllTargetsDescs
|
|
AllTargetsDisassemblers
|
|
AllTargetsInfos
|
|
BitReader
|
|
Core
|
|
CodeGen
|
|
LTO
|
|
MC
|
|
MCDisassembler
|
|
Support
|
|
Target
|
|
)
|
|
|
|
set(SOURCES
|
|
LTODisassembler.cpp
|
|
lto.cpp
|
|
)
|
|
|
|
set(LLVM_EXPORTED_SYMBOL_FILE ${CMAKE_CURRENT_SOURCE_DIR}/lto.exports)
|
|
|
|
add_llvm_library(LTO SHARED INSTALL_WITH_TOOLCHAIN ${SOURCES} DEPENDS
|
|
intrinsics_gen)
|
|
|
|
install(FILES ${LLVM_MAIN_INCLUDE_DIR}/llvm-c/lto.h
|
|
DESTINATION include/llvm-c
|
|
COMPONENT LTO)
|
|
|
|
if (APPLE)
|
|
set(LTO_VERSION ${LLVM_VERSION_MAJOR})
|
|
if(LLVM_LTO_VERSION_OFFSET)
|
|
math(EXPR LTO_VERSION "${LLVM_VERSION_MAJOR} + ${LLVM_LTO_VERSION_OFFSET}")
|
|
endif()
|
|
set_property(TARGET LTO APPEND_STRING PROPERTY
|
|
LINK_FLAGS
|
|
" -compatibility_version 1 -current_version ${LTO_VERSION}.${LLVM_VERSION_MINOR}.${LLVM_VERSION_PATCH}")
|
|
endif()
|