[PATCH] D87418: [LLD] Allow configuring default ld.lld backend
Mateusz MikuĊa via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Sep 10 12:11:19 PDT 2020
mati865 updated this revision to Diff 291055.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D87418/new/
https://reviews.llvm.org/D87418
Files:
lld/CMakeLists.txt
lld/tools/lld/lld.cpp
Index: lld/tools/lld/lld.cpp
===================================================================
--- lld/tools/lld/lld.cpp
+++ lld/tools/lld/lld.cpp
@@ -92,7 +92,8 @@
continue;
return isPETargetName(*(it + 1));
}
- return false;
+
+ return strcmp(LLD_DEFAULT_LD_LLD_BACKEND, "MINGW") ? false : true;
}
static Flavor parseProgname(StringRef progname) {
Index: lld/CMakeLists.txt
===================================================================
--- lld/CMakeLists.txt
+++ lld/CMakeLists.txt
@@ -193,6 +193,15 @@
option(LLD_BUILD_TOOLS
"Build the lld tools. If OFF, just generate build targets." ON)
+set(LLD_DEFAULT_LD_LLD_BACKEND "ELF"
+ CACHE STRING "Default backend for ld.lld, can be either ELF (default) or MINGW")
+string(TOUPPER "${LLD_DEFAULT_LD_LLD_BACKEND}" uppercase_LLD_DEFAULT_LD_LLD_BACKEND)
+if (uppercase_LLD_DEFAULT_LD_LLD_BACKEND MATCHES "^ELF$|^MINGW$")
+ add_definitions("-DLLD_DEFAULT_LD_LLD_BACKEND=\"${uppercase_LLD_DEFAULT_LD_LLD_BACKEND}\"")
+else()
+ message(FATAL_ERROR "LLD_DEFAULT_LD_LLD_BACKEND can only be either ELF or MINGW")
+endif()
+
if (MSVC)
add_definitions(-wd4530) # Suppress 'warning C4530: C++ exception handler used, but unwind semantics are not enabled.'
add_definitions(-wd4062) # Suppress 'warning C4062: enumerator X in switch of enum Y is not handled' from system header.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D87418.291055.patch
Type: text/x-patch
Size: 1360 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200910/087993d1/attachment.bin>
More information about the llvm-commits
mailing list