bitcoin
bitcoin copied to clipboard
[RFC] Align debugging flags to `-O0`
We currently have two issues in relation to debugging optimisation flags:
- A depends build with
DEBUG=1
and usingcmake -B build -DCMAKE_BUILD_TYPE=Debug
do not align, which is inconsistent/confusing. A depends build will-O1
, whileCMAKE_BUILD_TYPE=Debug
will set-O0
. -
-O0
is unusable in various ways:- Compiling certain assembly under
-O0
doesn't currently work: https://github.com/bitcoin/bitcoin/pull/29407#issuecomment-2027843446 (probably an upstream issue?). - Windows cross-compilation at
-O0
is broken without additional flags: https://github.com/bitcoin/bitcoin/issues/28109.
- Compiling certain assembly under
I'm not completely sure yet what the right choice is (previously it seems that -Og
was unusable with Clang? (note that for Clang it looks like -Og
and -O1
are basically equivalent), but we should at least align the two systems to be using the same thing for debugging.
Configure history:
-O0
added in https://github.com/bitcoin/bitcoin/pull/3833
Switched to -Og
in https://github.com/bitcoin/bitcoin/pull/13005.
Switched back to -O0
https://github.com/bitcoin/bitcoin/pull/16435
Depends DEBUG=1
mode has used -O1
since inception.