aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/main.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/main.cpp b/src/main.cpp
index 3c2ad46..de09301 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -666,7 +666,11 @@ static int buildProject(int argc, const _tinydir_char_t **argv, bool run)
// TODO: Make mold the default linker if it's installed and the installed gcc version supports it with -fuse-ld= option
if(linker.empty()) {
- if(is_lld_linker_installed())
+ // Static object files compiled with gcc are not compatible with lld (llvm linker)
+ // and we dont know which compiler was used to compile to code so we disable automatic
+ // use of lld by default. The user can still force lld with --linker=lld, if they are
+ // sure that they used clang to compile the code.
+ if(!use_lto && is_lld_linker_installed())
linker = "lld";
else if(is_gold_linker_installed())
linker = "gold";