Provide a way to compile some files with -O0 option
When preparing an image for source level debugging, it is convenient
to be able to compile some modules with -O0, which makes it much
easier to follow the execution flow.
This patch allows to do it by defining GDB_DEBUG=1 in the environment
before invoking make. Adding this feature as a common config flag is
problematic, because we don't want to compile the entire image with
-O0.
BUG=none
TEST=manual
. ran make with GDB_DEBUG=1 and observed the modified compiler
invocation line in the log.
Change-Id: Ie0be653509509eeb64ea3a7229f54c0c812840a9
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/196359
This commit is contained in:
parent
42ca899436
commit
dde4928c04
1 changed files with 6 additions and 1 deletions
|
|
@ -208,7 +208,7 @@ INCLUDES += -Isrc/device/oprom/include
|
|||
# abspath is a workaround for romcc
|
||||
INCLUDES += -include $(src)/include/kconfig.h
|
||||
|
||||
CFLAGS = $(INCLUDES) -Os -pipe -g -nostdinc
|
||||
CFLAGS = $(INCLUDES) -pipe -g -nostdinc
|
||||
CFLAGS += -nostdlib -Wall -Wundef -Wstrict-prototypes -Wmissing-prototypes
|
||||
CFLAGS += -Wwrite-strings -Wredundant-decls -Wno-trigraphs
|
||||
CFLAGS += -Wstrict-aliasing -Wshadow
|
||||
|
|
@ -216,6 +216,11 @@ ifeq ($(CONFIG_WARNINGS_ARE_ERRORS),y)
|
|||
CFLAGS += -Werror
|
||||
endif
|
||||
CFLAGS += -fno-common -ffreestanding -fno-builtin -fomit-frame-pointer
|
||||
ifneq ($(GDB_DEBUG),)
|
||||
CFLAGS += -O0
|
||||
else
|
||||
CFLAGS += -Os
|
||||
endif
|
||||
|
||||
additional-dirs := $(objutil)/cbfstool $(objutil)/romcc $(objutil)/ifdtool $(objutil)/options
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue