authorgravatar for kubkon@jakubkonka.comJakub Konka <kubkon@jakubkonka.com> 2022-01-11 18:41:26+01:00
committergravatar for noreply@github.comGitHub <noreply@github.com> 2022-01-11 12:41:26-05:00
log6d9c02a54fc847e9bed3096f910e03babec63acb
tree5c017906f23031ec47fc0056978f6901814d8ff6
parent48731ccea9007529324e555ac9f24277d28c0d74
signaturebadge-question-mark Signed by PGP key 4AEE18F83AFDEB23

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.

3 files changed, 10 insertions(+), 2 deletions(-)

src/clang_options_data.zig+2-2
...@@ -1983,7 +1983,7 @@ flagpsl("MT"),...@@ -1983,7 +1983,7 @@ flagpsl("MT"),
1983.{1983.{
1984 .name = "sysroot",1984 .name = "sysroot",
1985 .syntax = .separate,1985 .syntax = .separate,
1986 .zig_equivalent = .other,1986 .zig_equivalent = .sysroot,
1987 .pd1 = false,1987 .pd1 = false,
1988 .pd2 = true,1988 .pd2 = true,
1989 .psl = false,1989 .psl = false,
...@@ -5970,7 +5970,7 @@ jspd1("undefined"),...@@ -5970,7 +5970,7 @@ jspd1("undefined"),
5970.{5970.{
5971 .name = "sysroot=",5971 .name = "sysroot=",
5972 .syntax = .joined,5972 .syntax = .joined,
5973 .zig_equivalent = .other,5973 .zig_equivalent = .sysroot,
5974 .pd1 = false,5974 .pd1 = false,
5975 .pd2 = true,5975 .pd2 = true,
5976 .psl = false,5976 .psl = false,
src/main.zig+4
...@@ -1476,6 +1476,9 @@ fn buildOutputType(...@@ -1476,6 +1476,9 @@ fn buildOutputType(
1476 fatal("expected [command|reactor] for -mexec-mode=[value], found '{s}'", .{it.only_arg});1476 fatal("expected [command|reactor] for -mexec-mode=[value], found '{s}'", .{it.only_arg});
1477 };1477 };
1478 },1478 },
1479 .sysroot => {
1480 sysroot = it.only_arg;
1481 },
1479 }1482 }
1480 }1483 }
1481 // Parse linker args.1484 // Parse linker args.
...@@ -4130,6 +4133,7 @@ pub const ClangArgIterator = struct {...@@ -4130,6 +4133,7 @@ pub const ClangArgIterator = struct {
4130 strip,4133 strip,
4131 exec_model,4134 exec_model,
4132 emit_llvm,4135 emit_llvm,
4136 sysroot,
4133 };4137 };
41344138
4135 const Args = struct {4139 const Args = struct {
tools/update_clang_options.zig+4
...@@ -412,6 +412,10 @@ const known_options = [_]KnownOpt{...@@ -412,6 +412,10 @@ const known_options = [_]KnownOpt{
412 .name = "emit-llvm",412 .name = "emit-llvm",
413 .ident = "emit_llvm",413 .ident = "emit_llvm",
414 },414 },
415 .{
416 .name = "sysroot",
417 .ident = "sysroot",
418 },
415};419};
416420
417const blacklisted_options = [_][]const u8{};421const blacklisted_options = [_][]const u8{};