| ... | @@ -8474,8 +8474,11 @@ static void gen_c_object(CodeGen *g, Buf *self_exe_path, CFile *c_file) { | ... | @@ -8474,8 +8474,11 @@ static void gen_c_object(CodeGen *g, Buf *self_exe_path, CFile *c_file) { |
| 8474 | } else { | 8474 | } else { |
| 8475 | args.append("-fno-stack-protector"); | 8475 | args.append("-fno-stack-protector"); |
| 8476 | } | 8476 | } |
| | 8477 | args.append("-fno-omit-frame-pointer"); |
| 8477 | break; | 8478 | break; |
| 8478 | case BuildModeSafeRelease: | 8479 | case BuildModeSafeRelease: |
| | 8480 | // See the comment in the BuildModeFastRelease case for why we pass -O2 rather |
| | 8481 | // than -O3 here. |
| 8479 | args.append("-O2"); | 8482 | args.append("-O2"); |
| 8480 | if (g->libc_link_lib != nullptr) { | 8483 | if (g->libc_link_lib != nullptr) { |
| 8481 | args.append("-D_FORTIFY_SOURCE=2"); | 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,16 +8488,24 @@ static void gen_c_object(CodeGen *g, Buf *self_exe_path, CFile *c_file) { |
| 8485 | } else { | 8488 | } else { |
| 8486 | args.append("-fno-stack-protector"); | 8489 | args.append("-fno-stack-protector"); |
| 8487 | } | 8490 | } |
| | 8491 | args.append("-fomit-frame-pointer"); |
| 8488 | break; | 8492 | break; |
| 8489 | case BuildModeFastRelease: | 8493 | case BuildModeFastRelease: |
| 8490 | args.append("-DNDEBUG"); | 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 | args.append("-O2"); | 8500 | args.append("-O2"); |
| 8492 | args.append("-fno-stack-protector"); | 8501 | args.append("-fno-stack-protector"); |
| | 8502 | args.append("-fomit-frame-pointer"); |
| 8493 | break; | 8503 | break; |
| 8494 | case BuildModeSmallRelease: | 8504 | case BuildModeSmallRelease: |
| 8495 | args.append("-DNDEBUG"); | 8505 | args.append("-DNDEBUG"); |
| 8496 | args.append("-Os"); | 8506 | args.append("-Os"); |
| 8497 | args.append("-fno-stack-protector"); | 8507 | args.append("-fno-stack-protector"); |
| | 8508 | args.append("-fomit-frame-pointer"); |
| 8498 | break; | 8509 | break; |
| 8499 | } | 8510 | } |
| 8500 | | 8511 | |