zig cc: integration with sysroot arg (#10568)

Prior to this change, even if the use specified the sysroot on the
compiler line like so

```
zig cc --sysroot=/path/to/sdk
```

it would only be used as a prefix to include paths and not as a prefix
for `zig ld` linker.
This commit is contained in:
Jakub Konka 2022-01-11 18:41:26 +01:00 committed by GitHub
parent 48731ccea9
commit 6d9c02a54f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 10 additions and 2 deletions

View File

@ -1983,7 +1983,7 @@ flagpsl("MT"),
.{
.name = "sysroot",
.syntax = .separate,
.zig_equivalent = .other,
.zig_equivalent = .sysroot,
.pd1 = false,
.pd2 = true,
.psl = false,
@ -5970,7 +5970,7 @@ jspd1("undefined"),
.{
.name = "sysroot=",
.syntax = .joined,
.zig_equivalent = .other,
.zig_equivalent = .sysroot,
.pd1 = false,
.pd2 = true,
.psl = false,

View File

@ -1476,6 +1476,9 @@ fn buildOutputType(
fatal("expected [command|reactor] for -mexec-mode=[value], found '{s}'", .{it.only_arg});
};
},
.sysroot => {
sysroot = it.only_arg;
},
}
}
// Parse linker args.
@ -4130,6 +4133,7 @@ pub const ClangArgIterator = struct {
strip,
exec_model,
emit_llvm,
sysroot,
};
const Args = struct {

View File

@ -412,6 +412,10 @@ const known_options = [_]KnownOpt{
.name = "emit-llvm",
.ident = "emit_llvm",
},
.{
.name = "sysroot",
.ident = "sysroot",
},
};
const blacklisted_options = [_][]const u8{};