Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / compiler-rt / cmake / Modules / CompilerRTLink.cmake
blob05c535f623b339a456a6817f51ce9ccd89748ca8
1 # Link a shared library with COMPILER_RT_TEST_COMPILER.
2 # clang_link_shared(<output.so>
3 #                   OBJECTS <list of input objects>
4 #                   LINK_FLAGS <list of link flags>
5 #                   DEPS <list of dependencies>)
6 macro(clang_link_shared so_file)
7   cmake_parse_arguments(SOURCE "" "" "OBJECTS;LINK_FLAGS;DEPS" ${ARGN})
8   if(NOT COMPILER_RT_STANDALONE_BUILD)
9     list(APPEND SOURCE_DEPS clang)
10   endif()
11   add_custom_command(
12     OUTPUT ${so_file}
13     COMMAND ${COMPILER_RT_TEST_COMPILER} -o "${so_file}" -shared
14             ${SOURCE_LINK_FLAGS} ${SOURCE_OBJECTS}
15     DEPENDS ${SOURCE_DEPS})
16 endmacro()