]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commit
cmake: add "-Og" to CMAKE_C_FLAGS_DEBUG
authorKefu Chai <kchai@redhat.com>
Fri, 16 Jul 2021 02:37:23 +0000 (10:37 +0800)
committerKefu Chai <kchai@redhat.com>
Tue, 20 Jul 2021 12:20:06 +0000 (20:20 +0800)
commit8e742424a7f9f5204bee435ca8609e93f648ef77
tree304ea7275b4e874203690a33b6a6d0a64b7b1aaa
parenta5d38f0b14f9f9d7cd13f8a0df5bbef9a5802a02
cmake: add "-Og" to CMAKE_C_FLAGS_DEBUG

without specifying -Og, -O0 is used. as per
https://gcc.gnu.org/onlinedocs/gcc/Optimize-Options.html

> -O0
>  Reduce compilation time and make debugging produce the expected
>  results. This is the default.

and

> -Og
>  Optimize debugging experience. -Og should be the optimization level of
>  choice for the standard edit-compile-debug cycle, offering a reasonable
>  level of optimization while maintaining fast compilation and a good
>  debugging experience. It is a better choice than -O0 for producing
>  debuggable code because some compiler passes that collect debug
>  information are disabled at -O0.

and Debug is the default built type if .git directory is found under
the root source directory, so by adding "-Og -g" to CMAKE_C_FLAGS_DEBUG,
developers can have better debugging experience when testing Ceph
built from a git repo. but the downside is that it might take longer
to build the tree.

this change should also enable us to link crimson on aarch64.

the same applies to Clang,

> -O0 Means “no optimization”: this level compiles the fastest and generates the most debuggable code.
> -O1 Somewhere between -O0 and -O2.
> -O2 Moderate level of optimization which enables most optimizations.
> -Og Like -O1. In future versions, this option might disable different optimizations in order to improve debuggability.

see
https://clang.llvm.org/docs/CommandGuide/clang.html#cmdoption-o0

see also https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101448

Fixes: https://tracker.ceph.com/issues/51441
Signed-off-by: Kefu Chai <kchai@redhat.com>
src/CMakeLists.txt