Skip to content

Commit 6740a88

Browse files
committed
[NFC] Add SUPPORT_PLUGINS to add_llvm_executable()
Summary: this allows us to move logic about when it is appropriate set LLVM_NO_DEAD_STRIP out of each tool and into add_llvm_executable, which will enable future platform specific handling. This is a follow on to the reverted D69356 Reviewers: hubert.reinterpretcast, beanz, lhames Reviewed By: beanz Subscribers: mgorny, cfe-commits, llvm-commits Tags: #clang, #llvm Differential Revision: https://reviews.llvm.org/D69638
1 parent 52af7ae commit 6740a88

File tree

5 files changed

+12
-13
lines changed

5 files changed

+12
-13
lines changed

clang/tools/driver/CMakeLists.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,9 @@ set( LLVM_LINK_COMPONENTS
1919

2020
option(CLANG_PLUGIN_SUPPORT "Build clang with plugin support" ON)
2121

22-
# Support plugins. This must be before add_clang_executable as it reads
23-
# LLVM_NO_DEAD_STRIP.
22+
# Support plugins.
2423
if(CLANG_PLUGIN_SUPPORT)
25-
set(LLVM_NO_DEAD_STRIP 1)
24+
set(support_plugins SUPPORT_PLUGINS)
2625
endif()
2726

2827
if(NOT CLANG_BUILT_STANDALONE)
@@ -37,6 +36,7 @@ add_clang_tool(clang
3736

3837
DEPENDS
3938
${tablegen_deps}
39+
${support_plugins}
4040
)
4141

4242
clang_target_link_libraries(clang

llvm/cmake/modules/AddLLVM.cmake

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -732,7 +732,7 @@ endmacro(add_llvm_library name)
732732

733733
macro(add_llvm_executable name)
734734
cmake_parse_arguments(ARG
735-
"DISABLE_LLVM_LINK_LLVM_DYLIB;IGNORE_EXTERNALIZE_DEBUGINFO;NO_INSTALL_RPATH"
735+
"DISABLE_LLVM_LINK_LLVM_DYLIB;IGNORE_EXTERNALIZE_DEBUGINFO;NO_INSTALL_RPATH;SUPPORT_PLUGINS"
736736
"ENTITLEMENTS;BUNDLE_PATH"
737737
"DEPENDS"
738738
${ARGN})
@@ -782,6 +782,11 @@ macro(add_llvm_executable name)
782782
if(NOT LLVM_ENABLE_OBJLIB)
783783
llvm_update_compile_flags(${name})
784784
endif()
785+
786+
if (ARG_SUPPORT_PLUGINS)
787+
set(LLVM_NO_DEAD_STRIP On)
788+
endif()
789+
785790
add_link_opts( ${name} )
786791

787792
# Do not add -Dname_EXPORTS to the command-line when building files in this

llvm/tools/bugpoint/CMakeLists.txt

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,6 @@ set(LLVM_LINK_COMPONENTS
2121
Vectorize
2222
)
2323

24-
# Support plugins.
25-
set(LLVM_NO_DEAD_STRIP 1)
26-
2724
add_llvm_tool(bugpoint
2825
BugDriver.cpp
2926
CrashDebugger.cpp
@@ -37,6 +34,7 @@ add_llvm_tool(bugpoint
3734

3835
DEPENDS
3936
intrinsics_gen
37+
SUPPORT_PLUGINS
4038
)
4139
export_executable_symbols(bugpoint)
4240

llvm/tools/llc/CMakeLists.txt

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,11 @@ set(LLVM_LINK_COMPONENTS
1919
Vectorize
2020
)
2121

22-
# Support plugins.
23-
set(LLVM_NO_DEAD_STRIP 1)
24-
2522
add_llvm_tool(llc
2623
llc.cpp
2724

2825
DEPENDS
2926
intrinsics_gen
27+
SUPPORT_PLUGINS
3028
)
3129
export_executable_symbols(llc)

llvm/tools/opt/CMakeLists.txt

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,6 @@ set(LLVM_LINK_COMPONENTS
2424
Passes
2525
)
2626

27-
# Support plugins.
28-
set(LLVM_NO_DEAD_STRIP 1)
29-
3027
add_llvm_tool(opt
3128
AnalysisWrappers.cpp
3229
BreakpointPrinter.cpp
@@ -39,6 +36,7 @@ add_llvm_tool(opt
3936

4037
DEPENDS
4138
intrinsics_gen
39+
SUPPORT_PLUGINS
4240
)
4341
export_executable_symbols(opt)
4442

0 commit comments

Comments
 (0)