diff options
author | Julius Werner <jwerner@chromium.org> | 2021-06-24 15:35:31 -0700 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2021-07-01 01:07:42 +0000 |
commit | 6a558ef5be4703b9ff61bdc92c4a6f43d8cc406b (patch) | |
tree | 293b3bd1997d0dd1400e3e0009bae81a4a93d491 /Makefile | |
parent | 5c0fcf0f8725b98043a4b18f36e21489375d133a (diff) | |
download | vboot-6a558ef5be4703b9ff61bdc92c4a6f43d8cc406b.tar.gz |
Makefile: Optimize with -Og for DEBUG=1
vboot has grown code that requires optimizations (notably dead code
elimination) to be enabled to work right and avoid linker reference
errors. For example, the VB2_TRY() macro may or may not emit a call to
vb2api_fail(), based on whether a `ctx` argument was passed. This is
done through an if-statement with a compile-time constant condition, but
the compiler will only actually omit the vb2api_fail() call instruction
when optimizations are enabled. Not all vboot build targets (e.g.
hostlib) provide the vb2api_fail() symbol, so disabling optimizations
may cause link failures for those targets.
GCC and clang offer an -Og option that only enables simple optimizations
(like dead-code elimination) which don't interfere with debugging...
let's just use that instead.
BRANCH=None
BUG=None
TEST=None
Signed-off-by: Julius Werner <jwerner@chromium.org>
Change-Id: Ia972dc498839df80af6ccae8a8203e8c63a5eadc
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2986801
Reviewed-by: Joel Kitching <kitching@chromium.org>
Diffstat (limited to 'Makefile')
-rw-r--r-- | Makefile | 2 |
1 files changed, 1 insertions, 1 deletions
@@ -123,7 +123,7 @@ endif # Provide default CC and CFLAGS for firmware builds; if you have any -D flags, # please add them after this point (e.g., -DVBOOT_DEBUG). -DEBUG_FLAGS := $(if ${DEBUG},-g -O0,-g -Os) +DEBUG_FLAGS := $(if ${DEBUG},-g -Og,-g -Os) WERROR := -Werror FIRMWARE_FLAGS := -nostdinc -ffreestanding -fno-builtin -fno-stack-protector COMMON_FLAGS := -pipe ${WERROR} -Wall -Wstrict-prototypes -Wtype-limits \ |