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(...@@ -2348,7 +2348,9 @@ pub fn addCCArgs(
2348 else => {},2348 else => {},
2349 }2349 }
23502350
2351 if (!comp.bin_file.options.strip) {2351 if (comp.bin_file.options.strip) {
2352 try argv.append("-s");
2353 } else {
2352 try argv.append("-g");2354 try argv.append("-g");
2353 switch (comp.bin_file.options.object_format) {2355 switch (comp.bin_file.options.object_format) {
2354 .coff, .pe => try argv.append("-gcodeview"),2356 .coff, .pe => try argv.append("-gcodeview"),
src/clang_options_data.zig+8-1
...@@ -4305,7 +4305,14 @@ flagpd1("rewrite-macros"),...@@ -4305,7 +4305,14 @@ flagpd1("rewrite-macros"),
4305flagpd1("rewrite-objc"),4305flagpd1("rewrite-objc"),
4306flagpd1("rewrite-test"),4306flagpd1("rewrite-test"),
4307sepd1("rpath"),4307sepd1("rpath"),
4308flagpd1("s"),4308.{
4309 .name = "s",
4310 .syntax = .flag,
4311 .zig_equivalent = .strip,
4312 .pd1 = true,
4313 .pd2 = false,
4314 .psl = false,
4315},
4309.{4316.{
4310 .name = "save-stats",4317 .name = "save-stats",
4311 .syntax = .flag,4318 .syntax = .flag,
src/main.zig+2
...@@ -1186,6 +1186,7 @@ fn buildOutputType(...@@ -1186,6 +1186,7 @@ fn buildOutputType(
1186 .framework_dir => try framework_dirs.append(it.only_arg),1186 .framework_dir => try framework_dirs.append(it.only_arg),
1187 .framework => try frameworks.append(it.only_arg),1187 .framework => try frameworks.append(it.only_arg),
1188 .nostdlibinc => want_native_include_dirs = false,1188 .nostdlibinc => want_native_include_dirs = false,
1189 .strip => strip = true,
1189 }1190 }
1190 }1191 }
1191 // Parse linker args.1192 // Parse linker args.
...@@ -3047,6 +3048,7 @@ pub const ClangArgIterator = struct {...@@ -3047,6 +3048,7 @@ pub const ClangArgIterator = struct {
3047 nostdlibinc,3048 nostdlibinc,
3048 red_zone,3049 red_zone,
3049 no_red_zone,3050 no_red_zone,
3051 strip,
3050 };3052 };
30513053
3052 const Args = struct {3054 const Args = struct {
tools/update_clang_options.zig+4
...@@ -312,6 +312,10 @@ const known_options = [_]KnownOpt{...@@ -312,6 +312,10 @@ const known_options = [_]KnownOpt{
312 .name = "framework",312 .name = "framework",
313 .ident = "framework",313 .ident = "framework",
314 },314 },
315 .{
316 .name = "s",
317 .ident = "strip",
318 },
315};319};
316320
317const blacklisted_options = [_][]const u8{};321const blacklisted_options = [_][]const u8{};