diff --git a/src/Compilation.zig b/src/Compilation.zig index c7bb260aa7d1e8e33c7ee3af359e00a5a1a15992..268c259c02da47ddbd672f6993a26134090b4b77 100644 --- a/src/Compilation.zig +++ b/src/Compilation.zig @@ -2348,7 +2348,9 @@ pub fn addCCArgs( else => {}, } - if (!comp.bin_file.options.strip) { + if (comp.bin_file.options.strip) { + try argv.append("-s"); + } else { try argv.append("-g"); switch (comp.bin_file.options.object_format) { .coff, .pe => try argv.append("-gcodeview"), diff --git a/src/clang_options_data.zig b/src/clang_options_data.zig index 4d89308545dc782a41d658b6bbcb252ddabdb610..0293a5327e96f28f90b182fcedf1ced187c8b10b 100644 --- a/src/clang_options_data.zig +++ b/src/clang_options_data.zig @@ -4305,7 +4305,14 @@ flagpd1("rewrite-macros"), flagpd1("rewrite-objc"), flagpd1("rewrite-test"), sepd1("rpath"), -flagpd1("s"), +.{ + .name = "s", + .syntax = .flag, + .zig_equivalent = .strip, + .pd1 = true, + .pd2 = false, + .psl = false, +}, .{ .name = "save-stats", .syntax = .flag, diff --git a/src/main.zig b/src/main.zig index 14f63d99117d967760f64f671572f972ea44e9f6..c31252a96aca945d27c59c145b03dc47afd4ea80 100644 --- a/src/main.zig +++ b/src/main.zig @@ -1186,6 +1186,7 @@ fn buildOutputType( .framework_dir => try framework_dirs.append(it.only_arg), .framework => try frameworks.append(it.only_arg), .nostdlibinc => want_native_include_dirs = false, + .strip => strip = true, } } // Parse linker args. @@ -3047,6 +3048,7 @@ pub const ClangArgIterator = struct { nostdlibinc, red_zone, no_red_zone, + strip, }; const Args = struct { diff --git a/tools/update_clang_options.zig b/tools/update_clang_options.zig index 2aeee6845b59b870106ce8ea4274a7f679e4803f..1cb134a7317b8e3bb7fa483e841397acb596b3bf 100644 --- a/tools/update_clang_options.zig +++ b/tools/update_clang_options.zig @@ -312,6 +312,10 @@ const known_options = [_]KnownOpt{ .name = "framework", .ident = "framework", }, + .{ + .name = "s", + .ident = "strip", + }, }; const blacklisted_options = [_][]const u8{};