| author | |
| committer | |
| log | eb33394d14e29600d36280b6797de0d8f40076c1 |
| tree | b80904044e8207f2c9deaa00c5fd092867611255 |
| parent | a0a834a2f292eb7f4170d590833b5d56084c0468 |
Closes #60913 files changed, 78 insertions(+), 14 deletions(-)
src/clang_options_data.zig+34-6| ... | @@ -75,8 +75,22 @@ flagpd1("M"), | ... | @@ -75,8 +75,22 @@ flagpd1("M"), |
| 75 | .psl = false, | 75 | .psl = false, |
| 76 | }, | 76 | }, |
| 77 | flagpd1("Mach"), | 77 | flagpd1("Mach"), |
| 78 | flagpd1("O0"), | 78 | .{ |
| 79 | flagpd1("O4"), | 79 | .name = "O0", |
| 80 | .syntax = .flag, | ||
| 81 | .zig_equivalent = .optimize, | ||
| 82 | .pd1 = true, | ||
| 83 | .pd2 = false, | ||
| 84 | .psl = false, | ||
| 85 | }, | ||
| 86 | .{ | ||
| 87 | .name = "O4", | ||
| 88 | .syntax = .flag, | ||
| 89 | .zig_equivalent = .optimize, | ||
| 90 | .pd1 = true, | ||
| 91 | .pd2 = false, | ||
| 92 | .psl = false, | ||
| 93 | }, | ||
| 80 | .{ | 94 | .{ |
| 81 | .name = "O", | 95 | .name = "O", |
| 82 | .syntax = .flag, | 96 | .syntax = .flag, |
| ... | @@ -2163,7 +2177,7 @@ flagpd1("fno-ident"), | ... | @@ -2163,7 +2177,7 @@ flagpd1("fno-ident"), |
| 2163 | .{ | 2177 | .{ |
| 2164 | .name = "Os", | 2178 | .name = "Os", |
| 2165 | .syntax = .flag, | 2179 | .syntax = .flag, |
| 2166 | .zig_equivalent = .other, | 2180 | .zig_equivalent = .optimize, |
| 2167 | .pd1 = true, | 2181 | .pd1 = true, |
| 2168 | .pd2 = false, | 2182 | .pd2 = false, |
| 2169 | .psl = true, | 2183 | .psl = true, |
| ... | @@ -3148,7 +3162,14 @@ flagpd1("fxray-link-deps"), | ... | @@ -3148,7 +3162,14 @@ flagpd1("fxray-link-deps"), |
| 3148 | flagpd1("fzero-initialized-in-bss"), | 3162 | flagpd1("fzero-initialized-in-bss"), |
| 3149 | flagpd1("fzvector"), | 3163 | flagpd1("fzvector"), |
| 3150 | flagpd1("g0"), | 3164 | flagpd1("g0"), |
| 3151 | flagpd1("g1"), | 3165 | .{ |
| 3166 | .name = "g1", | ||
| 3167 | .syntax = .flag, | ||
| 3168 | .zig_equivalent = .debug, | ||
| 3169 | .pd1 = true, | ||
| 3170 | .pd2 = false, | ||
| 3171 | .psl = false, | ||
| 3172 | }, | ||
| 3152 | flagpd1("g2"), | 3173 | flagpd1("g2"), |
| 3153 | flagpd1("g3"), | 3174 | flagpd1("g3"), |
| 3154 | .{ | 3175 | .{ |
| ... | @@ -3189,7 +3210,14 @@ flagpd1("ggdb3"), | ... | @@ -3189,7 +3210,14 @@ flagpd1("ggdb3"), |
| 3189 | flagpd1("ggnu-pubnames"), | 3210 | flagpd1("ggnu-pubnames"), |
| 3190 | flagpd1("ginline-line-tables"), | 3211 | flagpd1("ginline-line-tables"), |
| 3191 | flagpd1("gline-directives-only"), | 3212 | flagpd1("gline-directives-only"), |
| 3192 | flagpd1("gline-tables-only"), | 3213 | .{ |
| 3214 | .name = "gline-tables-only", | ||
| 3215 | .syntax = .flag, | ||
| 3216 | .zig_equivalent = .debug, | ||
| 3217 | .pd1 = true, | ||
| 3218 | .pd2 = false, | ||
| 3219 | .psl = false, | ||
| 3220 | }, | ||
| 3193 | flagpd1("glldb"), | 3221 | flagpd1("glldb"), |
| 3194 | flagpd1("gmlt"), | 3222 | flagpd1("gmlt"), |
| 3195 | flagpd1("gmodules"), | 3223 | flagpd1("gmodules"), |
| ... | @@ -5363,7 +5391,7 @@ jspd1("iquote"), | ... | @@ -5363,7 +5391,7 @@ jspd1("iquote"), |
| 5363 | joinpd1("weak-l"), | 5391 | joinpd1("weak-l"), |
| 5364 | .{ | 5392 | .{ |
| 5365 | .name = "Ofast", | 5393 | .name = "Ofast", |
| 5366 | .syntax = .joined, | 5394 | .syntax = .flag, |
| 5367 | .zig_equivalent = .optimize, | 5395 | .zig_equivalent = .optimize, |
| 5368 | .pd1 = true, | 5396 | .pd1 = true, |
| 5369 | .pd2 = false, | 5397 | .pd2 = false, |
src/main.zig+17-7| ... | @@ -992,15 +992,20 @@ fn buildOutputType( | ... | @@ -992,15 +992,20 @@ fn buildOutputType( |
| 992 | }, | 992 | }, |
| 993 | .optimize => { | 993 | .optimize => { |
| 994 | // Alright, what release mode do they want? | 994 | // Alright, what release mode do they want? |
| 995 | if (mem.eql(u8, it.only_arg, "Os")) { | 995 | const level = if (it.only_arg.len >= 1 and it.only_arg[0] == 'O') it.only_arg[1..] else it.only_arg; |
| 996 | if (mem.eql(u8, level, "s") or | ||
| 997 | mem.eql(u8, level, "z")) | ||
| 998 | { | ||
| 996 | optimize_mode = .ReleaseSmall; | 999 | optimize_mode = .ReleaseSmall; |
| 997 | } else if (mem.eql(u8, it.only_arg, "O2") or | 1000 | } else if (mem.eql(u8, level, "1") or |
| 998 | mem.eql(u8, it.only_arg, "O3") or | 1001 | mem.eql(u8, level, "2") or |
| 999 | mem.eql(u8, it.only_arg, "O4")) | 1002 | mem.eql(u8, level, "3") or |
| 1003 | mem.eql(u8, level, "4") or | ||
| 1004 | mem.eql(u8, level, "fast")) | ||
| 1000 | { | 1005 | { |
| 1001 | optimize_mode = .ReleaseFast; | 1006 | optimize_mode = .ReleaseFast; |
| 1002 | } else if (mem.eql(u8, it.only_arg, "Og") or | 1007 | } else if (mem.eql(u8, level, "g") or |
| 1003 | mem.eql(u8, it.only_arg, "O0")) | 1008 | mem.eql(u8, level, "0")) |
| 1004 | { | 1009 | { |
| 1005 | optimize_mode = .Debug; | 1010 | optimize_mode = .Debug; |
| 1006 | } else { | 1011 | } else { |
| ... | @@ -1009,8 +1014,13 @@ fn buildOutputType( | ... | @@ -1009,8 +1014,13 @@ fn buildOutputType( |
| 1009 | }, | 1014 | }, |
| 1010 | .debug => { | 1015 | .debug => { |
| 1011 | strip = false; | 1016 | strip = false; |
| 1012 | if (mem.eql(u8, it.only_arg, "-g")) { | 1017 | if (mem.eql(u8, it.only_arg, "g")) { |
| 1013 | // We handled with strip = false above. | 1018 | // We handled with strip = false above. |
| 1019 | } else if (mem.eql(u8, it.only_arg, "g1") or | ||
| 1020 | mem.eql(u8, it.only_arg, "gline-tables-only")) | ||
| 1021 | { | ||
| 1022 | // We handled with strip = false above. but we also want reduced debug info. | ||
| 1023 | try clang_argv.append("-gline-tables-only"); | ||
| 1014 | } else { | 1024 | } else { |
| 1015 | try clang_argv.appendSlice(it.other_args); | 1025 | try clang_argv.appendSlice(it.other_args); |
| 1016 | } | 1026 | } |
tools/update_clang_options.zig+27-1| ... | @@ -130,6 +130,10 @@ const known_options = [_]KnownOpt{ | ... | @@ -130,6 +130,10 @@ const known_options = [_]KnownOpt{ |
| 130 | .name = "assemble", | 130 | .name = "assemble", |
| 131 | .ident = "asm_only", | 131 | .ident = "asm_only", |
| 132 | }, | 132 | }, |
| 133 | .{ | ||
| 134 | .name = "O0", | ||
| 135 | .ident = "optimize", | ||
| 136 | }, | ||
| 133 | .{ | 137 | .{ |
| 134 | .name = "O1", | 138 | .name = "O1", |
| 135 | .ident = "optimize", | 139 | .ident = "optimize", |
| ... | @@ -138,10 +142,20 @@ const known_options = [_]KnownOpt{ | ... | @@ -138,10 +142,20 @@ const known_options = [_]KnownOpt{ |
| 138 | .name = "O2", | 142 | .name = "O2", |
| 139 | .ident = "optimize", | 143 | .ident = "optimize", |
| 140 | }, | 144 | }, |
| 145 | // O3 is only detected from the joined "-O" option | ||
| 146 | .{ | ||
| 147 | .name = "O4", | ||
| 148 | .ident = "optimize", | ||
| 149 | }, | ||
| 141 | .{ | 150 | .{ |
| 142 | .name = "Og", | 151 | .name = "Og", |
| 143 | .ident = "optimize", | 152 | .ident = "optimize", |
| 144 | }, | 153 | }, |
| 154 | .{ | ||
| 155 | .name = "Os", | ||
| 156 | .ident = "optimize", | ||
| 157 | }, | ||
| 158 | // Oz is only detected from the joined "-O" option | ||
| 145 | .{ | 159 | .{ |
| 146 | .name = "O", | 160 | .name = "O", |
| 147 | .ident = "optimize", | 161 | .ident = "optimize", |
| ... | @@ -154,6 +168,14 @@ const known_options = [_]KnownOpt{ | ... | @@ -154,6 +168,14 @@ const known_options = [_]KnownOpt{ |
| 154 | .name = "optimize", | 168 | .name = "optimize", |
| 155 | .ident = "optimize", | 169 | .ident = "optimize", |
| 156 | }, | 170 | }, |
| 171 | .{ | ||
| 172 | .name = "g1", | ||
| 173 | .ident = "debug", | ||
| 174 | }, | ||
| 175 | .{ | ||
| 176 | .name = "gline-tables-only", | ||
| 177 | .ident = "debug", | ||
| 178 | }, | ||
| 157 | .{ | 179 | .{ |
| 158 | .name = "g", | 180 | .name = "g", |
| 159 | .ident = "debug", | 181 | .ident = "debug", |
| ... | @@ -390,6 +412,10 @@ pub fn main() anyerror!void { | ... | @@ -390,6 +412,10 @@ pub fn main() anyerror!void { |
| 390 | // the only way. | 412 | // the only way. |
| 391 | try stdout.print("flagpsl(\"{}\"),\n", .{name}); | 413 | try stdout.print("flagpsl(\"{}\"),\n", .{name}); |
| 392 | } else if (knownOption(name)) |ident| { | 414 | } else if (knownOption(name)) |ident| { |
| 415 | |||
| 416 | // Workaround the fact that in 'Options.td' -Ofast is listed as 'joined' | ||
| 417 | const final_syntax = if (std.mem.eql(u8, name, "Ofast")) .flag else syntax; | ||
| 418 | |||
| 393 | try stdout.print( | 419 | try stdout.print( |
| 394 | \\.{{ | 420 | \\.{{ |
| 395 | \\ .name = "{}", | 421 | \\ .name = "{}", |
| ... | @@ -400,7 +426,7 @@ pub fn main() anyerror!void { | ... | @@ -400,7 +426,7 @@ pub fn main() anyerror!void { |
| 400 | \\ .psl = {}, | 426 | \\ .psl = {}, |
| 401 | \\}}, | 427 | \\}}, |
| 402 | \\ | 428 | \\ |
| 403 | , .{ name, syntax, ident, pd1, pd2, pslash }); | 429 | , .{ name, final_syntax, ident, pd1, pd2, pslash }); |
| 404 | } else if (pd1 and !pd2 and !pslash and syntax == .flag) { | 430 | } else if (pd1 and !pd2 and !pslash and syntax == .flag) { |
| 405 | try stdout.print("flagpd1(\"{}\"),\n", .{name}); | 431 | try stdout.print("flagpd1(\"{}\"),\n", .{name}); |
| 406 | } else if (!pd1 and !pd2 and pslash and syntax == .flag) { | 432 | } else if (!pd1 and !pd2 and pslash and syntax == .flag) { |