Skip to content

Commit c74118f

Browse files
weliveindetailarichardson
authored andcommitted
[clang-repl] Limit use of PLT offset flag to linkers that support it
Follow-up fix from llvm/llvm-project#78959
2 parents a581d70 + 2bb6d7b commit c74118f

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

clang/tools/clang-repl/CMakeLists.txt

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,11 @@ if(CLANG_PLUGIN_SUPPORT)
2424
endif()
2525

2626
string(TOUPPER ${CMAKE_SYSTEM_PROCESSOR} system_processor)
27-
if(${system_processor} MATCHES "ARM")
28-
target_link_options(clang-repl PRIVATE LINKER:--long-plt)
27+
if(system_processor MATCHES "ARM")
28+
set(FLAG_LONG_PLT "-Wl,--long-plt")
29+
llvm_check_linker_flag(CXX ${FLAG_LONG_PLT} LINKER_HAS_FLAG_LONG_PLT)
30+
# Linkers without this flag are assumed to have long PLTs by default
31+
if(LINKER_HAS_FLAG_LONG_PLT)
32+
target_link_options(clang-repl PRIVATE ${FLAG_LONG_PLT})
33+
endif()
2934
endif()

0 commit comments

Comments
 (0)