diff options
Diffstat (limited to 'backend/ninja')
-rw-r--r-- | backend/ninja/Ninja.cpp | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/backend/ninja/Ninja.cpp b/backend/ninja/Ninja.cpp index 6c69d13..c66907c 100644 --- a/backend/ninja/Ninja.cpp +++ b/backend/ninja/Ninja.cpp @@ -810,7 +810,9 @@ namespace backend // TODO: Allow configuring default linking flags. Maybe have `package.useThreads = false` to disable this flag string allLinkerFlags; - if(!config.linker.empty()) + if(config.linker == "mold") + allLinkerFlags += " -B/usr/lib/mold/"; + else if(!config.linker.empty()) allLinkerFlags += " -fuse-ld=" + config.linker; if(isSamePlatformFamily(config.platform, PLATFORM_POSIX)) @@ -1011,6 +1013,10 @@ namespace backend vector<ninja::NinjaArg> optimizationFlags = getCompilerOptimizationFlags(config); compileCCommand.insert(compileCCommand.end(), optimizationFlags.begin(), optimizationFlags.end()); + for(auto &optFlag : optimizationFlags) { + allLinkerFlags += " " + optFlag.arg; + } + ninja::NinjaArg sanitizerFlag = getCompilerSanitizerFlag(config); if(sanitizerFlag.type != ninja::NinjaArg::Type::NONE) compileCCommand.push_back(std::move(sanitizerFlag)); @@ -1065,6 +1071,10 @@ namespace backend vector<ninja::NinjaArg> optimizationFlags = getCompilerOptimizationFlags(config); compileCCommand.insert(compileCCommand.end(), optimizationFlags.begin(), optimizationFlags.end()); + for(auto &optFlag : optimizationFlags) { + allLinkerFlags += " " + optFlag.arg; + } + ninja::NinjaArg sanitizerFlag = getCompilerSanitizerFlag(config); if(sanitizerFlag.type != ninja::NinjaArg::Type::NONE) compileCCommand.push_back(std::move(sanitizerFlag)); |