Debian Codegraph @

clang/tools/clang-repl/CMakeLists.txt

raw
1 set( LLVM_LINK_COMPONENTS
2 ${LLVM_TARGETS_TO_BUILD}
3 Core
4 LineEditor
5 Option
6 OrcJIT
7 OrcShared
8 Support
9 TargetParser
10 )
11
12 add_clang_tool(clang-repl
13 ClangRepl.cpp
14
15 EXPORT_SYMBOLS
16 )
17
18 if(MSVC)
19 set_target_properties(clang-repl PROPERTIES WINDOWS_EXPORT_ALL_SYMBOLS 1)
20
21 # RTTI/C++ symbols
22 set(clang_repl_exports ${clang_repl_exports} ??_7type_info@@6B@,DATA
23 ?__type_info_root_node@@3U__type_info_node@@A,DATA
24 ?nothrow@std@@3Unothrow_t@1@B,DATA
25 )
26
27 # Compiler added symbols for static variables. NOT for VStudio < 2015
28 set(clang_repl_exports ${clang_repl_exports} _Init_thread_abort _Init_thread_epoch,DATA
29 _Init_thread_footer _Init_thread_header _tls_index,DATA
30 )
31
32 if(CMAKE_SIZEOF_VOID_P EQUAL 8)
33 # new/delete variants needed when linking to static msvc runtime (esp. Debug)
34 set(clang_repl_exports ${clang_repl_exports}
35 ??2@YAPEAX_K@Z
36 ??3@YAXPEAX@Z
37 ??_U@YAPEAX_K@Z
38 ??_V@YAXPEAX@Z
39 ??3@YAXPEAX_K@Z
40 )
41 else()
42 set(clang_repl_exports ${clang_repl_exports}
43 ??2@YAPAXI@Z
44 ??3@YAXPAX@Z
45 ??3@YAXPAXI@Z
46 ??_U@YAPAXI@Z
47 ??_V@YAXPAX@Z
48 ??_V@YAXPAXI@Z
49 )
50 endif()
51
52 # List to '/EXPORT:sym0 /EXPORT:sym1 /EXPORT:sym2 ...'
53 # The 'SHELL' prefix tells CMake to use a space instead of comma as the
54 # separator between the driver and linker options, which we need since MSVC's
55 # linker uses `,DATA` as a suffix to indicate that data is being exported.
56 list(TRANSFORM clang_repl_exports PREPEND "LINKER:SHELL:/EXPORT:")
57
58 set_property(TARGET clang-repl APPEND PROPERTY LINK_OPTIONS ${clang_repl_exports})
59
60 endif(MSVC)
61
62 clang_target_link_libraries(clang-repl PRIVATE
63 clangAST
64 clangBasic
65 clangFrontend
66 clangInterpreter
67 )
68
69 # The clang-repl binary can get huge with static linking in debug mode.
70 # Some 32-bit targets use PLT slots with limited branch range by default and we
71 # start to exceed this limit, e.g. when linking for arm-linux-gnueabihf with
72 # gold. This flag tells the linker to build a PLT for the full address range.
73 # Linkers without this flag are assumed to support proper PLTs by default.
74 set(flag_long_plt "LINKER:--long-plt")
75 check_linker_flag(CXX ${flag_long_plt} HAVE_LINKER_FLAG_LONG_PLT)
76 if(HAVE_LINKER_FLAG_LONG_PLT)
77 target_link_options(clang-repl PRIVATE ${flag_long_plt})
78 endif()