[clang-repl] Limit use of PLT offset flag to linkers that support it

Follow-up fix from https://github.com/llvm/llvm-project/pull/78959
This commit is contained in:
Stefan Gränitz
2024-01-22 17:04:07 +01:00
parent 06c3c3b67c
commit 2bb6d7b8a4

View File

@@ -24,6 +24,11 @@ if(CLANG_PLUGIN_SUPPORT)
endif()
string(TOUPPER ${CMAKE_SYSTEM_PROCESSOR} system_processor)
if(${system_processor} MATCHES "ARM")
target_link_options(clang-repl PRIVATE LINKER:--long-plt)
if(system_processor MATCHES "ARM")
set(FLAG_LONG_PLT "-Wl,--long-plt")
llvm_check_linker_flag(CXX ${FLAG_LONG_PLT} LINKER_HAS_FLAG_LONG_PLT)
# Linkers without this flag are assumed to have long PLTs by default
if(LINKER_HAS_FLAG_LONG_PLT)
target_link_options(clang-repl PRIVATE ${FLAG_LONG_PLT})
endif()
endif()