authorgravatar for kubkon@jakubkonka.comJakub Konka <kubkon@jakubkonka.com> 2022-01-11 18:41:26+01:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2022-01-12 11:58:36-07:00
log3542dcad33f5e2021caeb897857b7cc3a57f2c23
tree0745077b440b586424582e47854e60c564c607d6
parent9b97edb01223d83095df35d5651572d796baae39

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"),
19831983.{
19841984 .name = "sysroot",
19851985 .syntax = .separate,
1986 .zig_equivalent = .other,
1986 .zig_equivalent = .sysroot,
19871987 .pd1 = false,
19881988 .pd2 = true,
19891989 .psl = false,
......@@ -5970,7 +5970,7 @@ jspd1("undefined"),
59705970.{
59715971 .name = "sysroot=",
59725972 .syntax = .joined,
5973 .zig_equivalent = .other,
5973 .zig_equivalent = .sysroot,
59745974 .pd1 = false,
59755975 .pd2 = true,
59765976 .psl = false,
src/main.zig+4
......@@ -1468,6 +1468,9 @@ fn buildOutputType(
14681468 fatal("expected [command|reactor] for -mexec-mode=[value], found '{s}'", .{it.only_arg});
14691469 };
14701470 },
1471 .sysroot => {
1472 sysroot = it.only_arg;
1473 },
14711474 }
14721475 }
14731476 // Parse linker args.
......@@ -4115,6 +4118,7 @@ pub const ClangArgIterator = struct {
41154118 strip,
41164119 exec_model,
41174120 emit_llvm,
4121 sysroot,
41184122 };
41194123
41204124 const Args = struct {
tools/update_clang_options.zig+4
......@@ -412,6 +412,10 @@ const known_options = [_]KnownOpt{
412412 .name = "emit-llvm",
413413 .ident = "emit_llvm",
414414 },
415 .{
416 .name = "sysroot",
417 .ident = "sysroot",
418 },
415419};
416420
417421const blacklisted_options = [_][]const u8{};