From patchwork Wed Sep 22 21:35:18 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: generate debug symbols Date: Wed, 22 Sep 2010 21:35:18 -0000 From: Marc Jones X-Patchwork-Id: 1968 Message-Id: To: Coreboot This patch is for source level debugging with the Sage SmartProbe. ( a little self plug there :) ) Generate and extract debug sysmbols for coreboot. *.debug files can be used for source level debug. Signed-off-by: Marc Jones Acked-by: Peter Stuge Index: coreboot/Makefile =================================================================== --- coreboot.orig/Makefile 2010-09-22 15:03:43.000000000 -0600 +++ coreboot/Makefile 2010-09-10 12:42:37.000000000 -0600 @@ -287,7 +287,7 @@ # abspath is a workaround for romcc INCLUDES += -include $(abspath $(obj)/config.h) -CFLAGS = $(INCLUDES) -Os -nostdinc -pipe +CFLAGS = $(INCLUDES) -Os -nostdinc -pipe -g CFLAGS += -nostdlib -Wall -Wundef -Wstrict-prototypes -Wmissing-prototypes CFLAGS += -Wwrite-strings -Wredundant-decls -Wno-trigraphs CFLAGS += -Wstrict-aliasing -Wshadow Index: coreboot/src/arch/i386/Makefile.bigbootblock.inc =================================================================== --- coreboot.orig/src/arch/i386/Makefile.bigbootblock.inc 2010-09-22 15:02:59.000000000 -0600 +++ coreboot/src/arch/i386/Makefile.bigbootblock.inc 2010-09-22 15:07:44.000000000 -0600 @@ -32,4 +32,7 @@ @printf " LINK $(subst $(obj)/,,$(@))\n" $(CC) -nostdlib -nostartfiles -static -o $@ -L$(obj) -T $(obj)/ldscript.ld $(initobjs) $(NM) -n $(obj)/coreboot | sort > $(obj)/coreboot.map + $(OBJCOPY) --only-keep-debug $@ $(obj)/bootblock.debug + $(OBJCOPY) --strip-debug $@ + $(OBJCOPY) --add-gnu-debuglink=$(obj)/bootblock.debug $@ Index: coreboot/src/arch/i386/Makefile.bootblock.inc =================================================================== --- coreboot.orig/src/arch/i386/Makefile.bootblock.inc 2010-09-22 15:03:05.000000000 -0600 +++ coreboot/src/arch/i386/Makefile.bootblock.inc 2010-09-22 15:08:13.000000000 -0600 @@ -75,6 +75,9 @@ @printf " LINK $(subst $(obj)/,,$(@))\n" $(CC) -nostdlib -nostartfiles -static -o $@ -L$(obj) -T $(obj)/bootblock/ldscript.ld $< $(NM) -n $(obj)/bootblock.elf | sort > $(obj)/bootblock.map + $(OBJCOPY) --only-keep-debug $@ $(obj)/bootblock.debug + $(OBJCOPY) --strip-debug $@ + $(OBJCOPY) --add-gnu-debuglink=$(obj)/bootblock.debug $@ ####################################################################### # Build the romstage @@ -89,6 +92,9 @@ printf ';\nAUTO_XIP_ROM_BASE = CONFIG_ROMBASE & ~(CONFIG_XIP_ROM_SIZE - 1);\n' >> $(obj)/location.ld $(CC) -nostdlib -nostartfiles -static -o $(obj)/romstage.elf -L$(obj) -T $(obj)/romstage/ldscript.ld $(initobjs) $(NM) -n $(obj)/romstage.elf | sort > $(obj)/romstage.map + $(OBJCOPY) --only-keep-debug $(obj)/romstage.elf $(obj)/romstage.debug + $(OBJCOPY) --strip-debug $(obj)/romstage.elf + $(OBJCOPY) --add-gnu-debuglink=$(obj)/romstage.debug $(obj)/romstage.elf $(OBJCOPY) -O binary $(obj)/romstage.elf $@ $(obj)/romstage/ldscript.ld: $$(ldscripts) $(obj)/ldoptions Index: coreboot/src/arch/i386/Makefile.inc =================================================================== --- coreboot.orig/src/arch/i386/Makefile.inc 2010-09-22 15:02:52.000000000 -0600 +++ coreboot/src/arch/i386/Makefile.inc 2010-09-22 15:11:23.000000000 -0600 @@ -107,6 +107,9 @@ @printf " CC $(subst $(obj)/,,$(@))\n" $(CC) -nostdlib -nostartfiles -static -o $@ -L$(obj) -T $(src)/arch/i386/coreboot_ram.ld $(obj)/coreboot_ram.o $(NM) -n $(obj)/coreboot_ram | sort > $(obj)/coreboot_ram.map + $(OBJCOPY) --only-keep-debug $@ $(obj)/coreboot_ram.debug + $(OBJCOPY) --strip-debug $@ + $(OBJCOPY) --add-gnu-debuglink=$(obj)/coreboot_ram.debug $@ $(obj)/coreboot_ram.o: $(obj)/arch/i386/lib/c_start.o $$(drivers) $(obj)/coreboot.a $(LIBGCC_FILE_NAME) @printf " CC $(subst $(obj)/,,$(@))\n" @@ -125,6 +128,9 @@ $(obj)/coreboot_ap: $(obj)/mainboard/$(MAINBOARDDIR)/ap_romstage.o @printf " CC $(subst $(obj)/,,$(@))\n" $(CC) -nostdlib -nostartfiles -static -o $@ -L$(obj) -T $(src)/arch/i386/init/ldscript_apc.lb $^ + $(OBJCOPY) --only-keep-debug $@ $(obj)/coreboot_ap.debug + $(OBJCOPY) --strip-debug $@ + $(OBJCOPY) --add-gnu-debuglink=$(obj)/coreboot_ap.debug $@ $(NM) -n $(obj)/coreboot_ap | sort > $(obj)/coreboot_ap.map