Skip to content

Commit

Permalink
[NFC] Add SUPPORT_PLUGINS to add_llvm_executable()
Browse files Browse the repository at this point in the history
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
  • Loading branch information
daltenty committed Nov 6, 2019
1 parent 52af7ae commit 6740a88
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 13 deletions.
6 changes: 3 additions & 3 deletions clang/tools/driver/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,9 @@ set( LLVM_LINK_COMPONENTS

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

# Support plugins. This must be before add_clang_executable as it reads
# LLVM_NO_DEAD_STRIP.
# Support plugins.
if(CLANG_PLUGIN_SUPPORT)
set(LLVM_NO_DEAD_STRIP 1)
set(support_plugins SUPPORT_PLUGINS)
endif()

if(NOT CLANG_BUILT_STANDALONE)
Expand All @@ -37,6 +36,7 @@ add_clang_tool(clang

DEPENDS
${tablegen_deps}
${support_plugins}
)

clang_target_link_libraries(clang
Expand Down
7 changes: 6 additions & 1 deletion llvm/cmake/modules/AddLLVM.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -732,7 +732,7 @@ endmacro(add_llvm_library name)

macro(add_llvm_executable name)
cmake_parse_arguments(ARG
"DISABLE_LLVM_LINK_LLVM_DYLIB;IGNORE_EXTERNALIZE_DEBUGINFO;NO_INSTALL_RPATH"
"DISABLE_LLVM_LINK_LLVM_DYLIB;IGNORE_EXTERNALIZE_DEBUGINFO;NO_INSTALL_RPATH;SUPPORT_PLUGINS"
"ENTITLEMENTS;BUNDLE_PATH"
"DEPENDS"
${ARGN})
Expand Down Expand Up @@ -782,6 +782,11 @@ macro(add_llvm_executable name)
if(NOT LLVM_ENABLE_OBJLIB)
llvm_update_compile_flags(${name})
endif()

if (ARG_SUPPORT_PLUGINS)
set(LLVM_NO_DEAD_STRIP On)
endif()

add_link_opts( ${name} )

# Do not add -Dname_EXPORTS to the command-line when building files in this
Expand Down
4 changes: 1 addition & 3 deletions llvm/tools/bugpoint/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,6 @@ set(LLVM_LINK_COMPONENTS
Vectorize
)

# Support plugins.
set(LLVM_NO_DEAD_STRIP 1)

add_llvm_tool(bugpoint
BugDriver.cpp
CrashDebugger.cpp
Expand All @@ -37,6 +34,7 @@ add_llvm_tool(bugpoint

DEPENDS
intrinsics_gen
SUPPORT_PLUGINS
)
export_executable_symbols(bugpoint)

Expand Down
4 changes: 1 addition & 3 deletions llvm/tools/llc/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,11 @@ set(LLVM_LINK_COMPONENTS
Vectorize
)

# Support plugins.
set(LLVM_NO_DEAD_STRIP 1)

add_llvm_tool(llc
llc.cpp

DEPENDS
intrinsics_gen
SUPPORT_PLUGINS
)
export_executable_symbols(llc)
4 changes: 1 addition & 3 deletions llvm/tools/opt/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,6 @@ set(LLVM_LINK_COMPONENTS
Passes
)

# Support plugins.
set(LLVM_NO_DEAD_STRIP 1)

add_llvm_tool(opt
AnalysisWrappers.cpp
BreakpointPrinter.cpp
Expand All @@ -39,6 +36,7 @@ add_llvm_tool(opt

DEPENDS
intrinsics_gen
SUPPORT_PLUGINS
)
export_executable_symbols(opt)

Expand Down

0 comments on commit 6740a88

Please sign in to comment.