aboutsummaryrefslogtreecommitdiff
path: root/src/main.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/main.cpp')
-rw-r--r--src/main.cpp12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/main.cpp b/src/main.cpp
index 2592135..3c2ad46 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -138,7 +138,7 @@ static void usageBuild(bool run)
printf(" --platform The platform to build for - Optional (default: the running platform)\n");
printf(" --lto Use link-time optimization. May increase compile times - Optional (default: not used)\n");
printf(" --debug-symbols Include debug symbols in release mode - Optional (default: not used)\n");
- printf(" --linker=linker The linker to use. \"gold\" is the default linker when using gcc\n");
+ printf(" --linker=linker The linker to use. \"lld\" or \"gold\" is the default linker when using gcc\n");
if(run) {
printf(" --args <args...> A list of arguments to run the program with\n");
} else {
@@ -182,7 +182,7 @@ static void usageTest()
printf(" --sanitize=option Add runtime address/undefined behavior sanitization. Program can be up to 3 times slower and use 10 times as much RAM. Ignored if compiler doesn't support sanitization - Optional (default: address)\n");
printf(" --file Specify file to test, path to test file should be defined after this. Can be defined multiple times to test multiple files - Optional (default: not used), Only applicable for Zig\n");
printf(" --all-files Test all files - Optional (default: not used), Only applicable for Zig\n");
- printf(" --linker=linker The linker to use. \"gold\" is the default linker when using gcc\n");
+ printf(" --linker=linker The linker to use. \"lld\" or \"gold\" is the default linker when using gcc\n");
printf(" --skip-compile Skip compilation. This can be used to generate a compile_commands.json file without compiling. Note that the compile_commands.json can miss files that are generated when this option is used. This option also skips running the tests\n");
printf(" --args <args...> A list of arguments to run the program with\n");
printf("Examples:\n");
@@ -664,6 +664,14 @@ static int buildProject(int argc, const _tinydir_char_t **argv, bool run)
Compiler compiler = Compiler::MSVC;
#endif
+ // 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())
+ linker = "lld";
+ else if(is_gold_linker_installed())
+ linker = "gold";
+ }
+
SibsConfig sibsConfig(compiler, projectPath, optimizationLevel, false);
sibsConfig.showWarnings = true;
sibsConfig.platform = platform;