authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2021-02-07 14:51:27-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2021-02-07 14:51:27-07:00
loge197a03124527035f1a92381eb6ef46d6f6d2c39
treea3ad9b5db9a91389975bf0d755f40e807ad86d34
parent905c85be968e6823305887474d2a821dac82f16c

zig cc: recognize the `-s` flag to be "strip"


4 files changed, 17 insertions(+), 2 deletions(-)

src/Compilation.zig+3-1
......@@ -2348,7 +2348,9 @@ pub fn addCCArgs(
23482348 else => {},
23492349 }
23502350
2351 if (!comp.bin_file.options.strip) {
2351 if (comp.bin_file.options.strip) {
2352 try argv.append("-s");
2353 } else {
23522354 try argv.append("-g");
23532355 switch (comp.bin_file.options.object_format) {
23542356 .coff, .pe => try argv.append("-gcodeview"),
src/clang_options_data.zig+8-1
......@@ -4305,7 +4305,14 @@ flagpd1("rewrite-macros"),
43054305flagpd1("rewrite-objc"),
43064306flagpd1("rewrite-test"),
43074307sepd1("rpath"),
4308flagpd1("s"),
4308.{
4309 .name = "s",
4310 .syntax = .flag,
4311 .zig_equivalent = .strip,
4312 .pd1 = true,
4313 .pd2 = false,
4314 .psl = false,
4315},
43094316.{
43104317 .name = "save-stats",
43114318 .syntax = .flag,
src/main.zig+2
......@@ -1186,6 +1186,7 @@ fn buildOutputType(
11861186 .framework_dir => try framework_dirs.append(it.only_arg),
11871187 .framework => try frameworks.append(it.only_arg),
11881188 .nostdlibinc => want_native_include_dirs = false,
1189 .strip => strip = true,
11891190 }
11901191 }
11911192 // Parse linker args.
......@@ -3047,6 +3048,7 @@ pub const ClangArgIterator = struct {
30473048 nostdlibinc,
30483049 red_zone,
30493050 no_red_zone,
3051 strip,
30503052 };
30513053
30523054 const Args = struct {
tools/update_clang_options.zig+4
......@@ -312,6 +312,10 @@ const known_options = [_]KnownOpt{
312312 .name = "framework",
313313 .ident = "framework",
314314 },
315 .{
316 .name = "s",
317 .ident = "strip",
318 },
315319};
316320
317321const blacklisted_options = [_][]const u8{};