Skip to content

Commit

Permalink
Pass -O0 rather than -Og to Clang for Debug builds
Browse files Browse the repository at this point in the history
  • Loading branch information
kmicklas authored and andrewrk committed Jun 28, 2022
1 parent aa1f955 commit 2249089
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/Compilation.zig
Original file line number Diff line number Diff line change
Expand Up @@ -4073,7 +4073,10 @@ pub fn addCCArgs(
.Debug => {
// windows c runtime requires -D_DEBUG if using debug libraries
try argv.append("-D_DEBUG");
try argv.append("-Og");
// Clang has -Og for compatibility with GCC, but currently it is just equivalent
// to -O1. Besides potentially impairing debugging, -O1/-Og significantly
// increases compile times.
try argv.append("-O0");

if (comp.bin_file.options.link_libc and target.os.tag != .wasi) {
try argv.append("-fstack-protector-strong");
Expand Down

0 comments on commit 2249089

Please sign in to comment.