| ... | ... | @@ -8474,8 +8474,11 @@ static void gen_c_object(CodeGen *g, Buf *self_exe_path, CFile *c_file) { |
| 8474 | 8474 | } else { |
| 8475 | 8475 | args.append("-fno-stack-protector"); |
| 8476 | 8476 | } |
| 8477 | args.append("-fno-omit-frame-pointer"); |
| 8477 | 8478 | break; |
| 8478 | 8479 | case BuildModeSafeRelease: |
| 8480 | // See the comment in the BuildModeFastRelease case for why we pass -O2 rather |
| 8481 | // than -O3 here. |
| 8479 | 8482 | args.append("-O2"); |
| 8480 | 8483 | if (g->libc_link_lib != nullptr) { |
| 8481 | 8484 | args.append("-D_FORTIFY_SOURCE=2"); |
| ... | ... | @@ -8485,16 +8488,24 @@ static void gen_c_object(CodeGen *g, Buf *self_exe_path, CFile *c_file) { |
| 8485 | 8488 | } else { |
| 8486 | 8489 | args.append("-fno-stack-protector"); |
| 8487 | 8490 | } |
| 8491 | args.append("-fomit-frame-pointer"); |
| 8488 | 8492 | break; |
| 8489 | 8493 | case BuildModeFastRelease: |
| 8490 | 8494 | args.append("-DNDEBUG"); |
| 8495 | // Here we pass -O2 rather than -O3 because, although we do the equivalent of |
| 8496 | // -O3 in Zig code, the justification for the difference here is that Zig |
| 8497 | // has better detection and prevention of undefined behavior, so -O3 is safer for |
| 8498 | // Zig code than it is for C code. Also, C programmers are used to their code |
| 8499 | // running in -O2 and thus the -O3 path has been tested less. |
| 8491 | 8500 | args.append("-O2"); |
| 8492 | 8501 | args.append("-fno-stack-protector"); |
| 8502 | args.append("-fomit-frame-pointer"); |
| 8493 | 8503 | break; |
| 8494 | 8504 | case BuildModeSmallRelease: |
| 8495 | 8505 | args.append("-DNDEBUG"); |
| 8496 | 8506 | args.append("-Os"); |
| 8497 | 8507 | args.append("-fno-stack-protector"); |
| 8508 | args.append("-fomit-frame-pointer"); |
| 8498 | 8509 | break; |
| 8499 | 8510 | } |
| 8500 | 8511 | |