libpayload: 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 '-g -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 V=1 GDB_DEBUG=1 and observed the modified compiler
invocation line in the log.
Change-Id: I4a902ad25157fa7f93614917f440e56145405a1d
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/201783
Reviewed-by: David Hendricks <dhendrix@chromium.org>
Reviewed-by: Trevor Bourget <tbourget@codeaurora.org>
This commit is contained in:
parent
f1fd4e3f9d
commit
ad0d2e0278
1 changed files with 7 additions and 1 deletions
|
|
@ -53,12 +53,18 @@ subdirs-$(CONFIG_LP_CBFS) += libcbfs
|
|||
subdirs-$(CONFIG_LP_LZMA) += liblzma
|
||||
|
||||
INCLUDES := -Iinclude -Iinclude/$(ARCHDIR-y) -I$(obj)
|
||||
CFLAGS = $(EXTRA_CFLAGS) $(INCLUDES) -Os -pipe -nostdinc -ggdb3
|
||||
CFLAGS = $(EXTRA_CFLAGS) $(INCLUDES) -pipe -nostdinc -ggdb3
|
||||
CFLAGS += -nostdlib -fno-builtin -ffreestanding -fomit-frame-pointer
|
||||
CFLAGS += -Wall -Wundef -Wstrict-prototypes -Wmissing-prototypes
|
||||
CFLAGS += -Wwrite-strings -Wredundant-decls -Wno-trigraphs
|
||||
CFLAGS += -Wstrict-aliasing -Wshadow -Werror
|
||||
|
||||
ifneq ($(GDB_DEBUG),)
|
||||
CFLAGS += -O0 -g
|
||||
else
|
||||
CFLAGS += -Os
|
||||
endif
|
||||
|
||||
$(obj)/libpayload-config.h: $(KCONFIG_AUTOHEADER)
|
||||
cmp $@ $< 2>/dev/null || cp $< $@
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue