From 6aa65bb1ee0951865e27da81dde1de76c6d4687e Mon Sep 17 00:00:00 2001 From: Joseph Chen Date: Fri, 1 Feb 2019 15:15:30 +0800 Subject: [PATCH] armv7: add -funwind-tables compile option to support stacktrace Change-Id: Icfa223397e05dcd42ea3c12275385104bf275213 Signed-off-by: Joseph Chen --- arch/arm/config.mk | 3 ++- arch/arm/cpu/armv7/config.mk | 4 ++++ examples/Makefile | 4 ++++ 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/arch/arm/config.mk b/arch/arm/config.mk index 1a77779db4..42a1d9c490 100644 --- a/arch/arm/config.mk +++ b/arch/arm/config.mk @@ -139,7 +139,8 @@ OBJCOPYFLAGS += -j .text -j .secure_text -j .secure_data -j .rodata -j .data \ -j .u_boot_list -j .rela.dyn -j .got -j .got.plt else OBJCOPYFLAGS += -j .text -j .secure_text -j .secure_data -j .rodata -j .hash \ - -j .data -j .got -j .got.plt -j .u_boot_list -j .rel.dyn + -j .data -j .got -j .got.plt -j .u_boot_list -j .rel.dyn \ + -j .ARM.exidx -j .ARM.extab endif # if a dtb section exists we always have to include it diff --git a/arch/arm/cpu/armv7/config.mk b/arch/arm/cpu/armv7/config.mk index 63591d4a29..63ae71cd4c 100644 --- a/arch/arm/cpu/armv7/config.mk +++ b/arch/arm/cpu/armv7/config.mk @@ -11,3 +11,7 @@ # of our decision. PF_NO_UNALIGNED := $(call cc-option, -mno-unaligned-access,) PLATFORM_CPPFLAGS += $(PF_NO_UNALIGNED) + +ifeq ($(CONFIG_SPL_BUILD)$(CONFIG_TPL_BUILD),) +PLATFORM_CPPFLAGS += -mabi=aapcs-linux -funwind-tables +endif diff --git a/examples/Makefile b/examples/Makefile index 8e329d7cd5..3b75f41fb9 100644 --- a/examples/Makefile +++ b/examples/Makefile @@ -8,6 +8,10 @@ ifdef FTRACE subdir-ccflags-y += -finstrument-functions -DFTRACE endif +# Here is an compile issue: "undefined reference to `__aeabi_unwind_cpp_pr0'..." +# when -funwind-tables is enabled, so make it compile depends on -funwind-tables. +ifeq (,$(findstring -funwind-tables,$(PLATFORM_CPPFLAGS))) subdir-y += standalone subdir-$(CONFIG_API) += api endif +endif