support CC envvar to be in the form "command args..." (#4582)

In case CC is set try to split it by spaces into a command and
arguments. This is the same behaviour as in dmd.

Signed-off-by: Andrei Horodniceanu <a.horodniceanu@proton.me>
This commit is contained in:
Andrei Horodniceanu 2024-02-24 15:46:35 +00:00 committed by GitHub
parent 17074a4422
commit d7f87811f6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 45 additions and 11 deletions

View file

@ -847,11 +847,11 @@ int linkObjToBinaryGcc(llvm::StringRef outputPath,
std::string tool;
std::unique_ptr<ArgsBuilder> argsBuilder;
if (global.params.targetTriple->isOSBinFormatWasm()) {
tool = getProgram("wasm-ld", &opts::linker);
argsBuilder = std::make_unique<LdArgsBuilder>();
tool = getProgram("wasm-ld", &opts::linker);
} else {
tool = getGcc();
argsBuilder = std::make_unique<ArgsBuilder>();
tool = getGcc(argsBuilder->args);
}
// build arguments