From d7d46f8537f31ea0e0b0d391d53ac93c276cb53e Mon Sep 17 00:00:00 2001
From: dec05eba <dec05eba@protonmail.com>
Date: Sat, 12 Nov 2022 10:59:53 +0100
Subject: Only default to lld in release mode

---
 README.md    | 2 +-
 src/main.cpp | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/README.md b/README.md
index 21f8c20..b26a472 100644
--- a/README.md
+++ b/README.md
@@ -72,7 +72,7 @@ The current recommended way of using sibs is to add dependencies as git submodul
 You can list all your system packages with `pkg-config --list-all` (if the packages provide pkg-config files). To search for a package in this list you can use grep, like so: `pkg-config --list-all | grep 'pkg-name'` (replace pkg-name with the name of the package you want to search for).\
 To then show the version of the found package you can use `pkg-config --modversion pkg-name`.
 
-sibs will prefer lld linker if it's available and then the gold linker. You can install lld to improve compile times.
+sibs will prefer lld linker in release mode if it's available and then the gold linker. You can install lld to improve compile times. Note that gdb debugging is a bit buggy when using lld so use of lld is only recommended in release mode.
 # Quirks
 Zig support has not been tested properly yet and currently always links to c library.
 You can run zig tests with `sibs test --file filepath` or `sibs test --all-files`.
diff --git a/src/main.cpp b/src/main.cpp
index de09301..2fc470e 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -670,7 +670,7 @@ static int buildProject(int argc, const _tinydir_char_t **argv, bool run)
         // 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())
+        if(!use_lto && optimizationLevel != OPT_LEV_DEBUG && !include_debug_symbols_in_release && is_lld_linker_installed())
             linker = "lld";
         else if(is_gold_linker_installed())
             linker = "gold";
-- 
cgit v1.2.3-70-g09d2