From: Nadav Amit <namit@xxxxxxxxxx> Debugging tests that run on EFI is hard because the debug information is not included in the EFI file. Dump it into a separeate .debug file to allow the use of gdb or pretty_print_stacks script. Signed-off-by: Nadav Amit <namit@xxxxxxxxxx> --- v2->v3: * Add *.debug to .gitignore [Andrew] v1->v2: * Making clean should remove .debug [Andrew] * x86 EFI support [Andrew] --- .gitignore | 1 + arm/Makefile.common | 5 ++++- x86/Makefile.common | 5 ++++- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index 29f352c..2168e01 100644 --- a/.gitignore +++ b/.gitignore @@ -7,6 +7,7 @@ tags *.flat *.efi *.elf +*.debug *.patch .pc patches diff --git a/arm/Makefile.common b/arm/Makefile.common index d60cf8c..9b45a8f 100644 --- a/arm/Makefile.common +++ b/arm/Makefile.common @@ -78,6 +78,9 @@ ifeq ($(CONFIG_EFI),y) %.efi: %.so $(call arch_elf_check, $^) + $(OBJCOPY) --only-keep-debug $^ $@.debug + $(OBJCOPY) --strip-debug $^ + $(OBJCOPY) --add-gnu-debuglink=$@.debug $^ $(OBJCOPY) \ -j .text -j .sdata -j .data -j .dynamic -j .dynsym \ -j .rel -j .rela -j .rel.* -j .rela.* -j .rel* -j .rela* \ @@ -103,7 +106,7 @@ $(libeabi): $(eabiobjs) $(AR) rcs $@ $^ arm_clean: asm_offsets_clean - $(RM) $(TEST_DIR)/*.{o,flat,elf,so,efi} $(libeabi) $(eabiobjs) \ + $(RM) $(TEST_DIR)/*.{o,flat,elf,so,efi,debug} $(libeabi) $(eabiobjs) \ $(TEST_DIR)/.*.d $(TEST_DIR)/efi/.*.d lib/arm/.*.d generated-files = $(asm-offsets) diff --git a/x86/Makefile.common b/x86/Makefile.common index 9f2bc93..c42c3e4 100644 --- a/x86/Makefile.common +++ b/x86/Makefile.common @@ -54,6 +54,9 @@ ifeq ($(CONFIG_EFI),y) @chmod a-x $@ %.efi: %.so + $(OBJCOPY) --only-keep-debug $^ $@.debug + $(OBJCOPY) --strip-debug $^ + $(OBJCOPY) --add-gnu-debuglink=$@.debug $^ $(OBJCOPY) \ -j .text -j .sdata -j .data -j .dynamic -j .dynsym -j .rel \ -j .rela -j .reloc -S --target=$(FORMAT) $< $@ @@ -124,4 +127,4 @@ arch_clean: $(RM) $(TEST_DIR)/*.o $(TEST_DIR)/*.flat $(TEST_DIR)/*.elf \ $(TEST_DIR)/.*.d lib/x86/.*.d \ $(TEST_DIR)/efi/*.o $(TEST_DIR)/efi/.*.d \ - $(TEST_DIR)/*.so $(TEST_DIR)/*.efi + $(TEST_DIR)/*.so $(TEST_DIR)/*.efi $(TEST_DIR)/*.debug -- 2.34.1