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