summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarc Jones <marcj303@gmail.com>2010-09-23 15:38:55 +0000
committerMarc Jones <marc.jones@amd.com>2010-09-23 15:38:55 +0000
commit5c3126936d0387df5308817f63f25f170e2c5cb0 (patch)
tree5968d7e8acdd545d27e1cedf0fdb30888407254c
parenta34a0b1876948d34c8f7d49f224998a6dfc7755a (diff)
downloadcoreboot-5c3126936d0387df5308817f63f25f170e2c5cb0.tar.xz
Generate and extract debug sysmbols for coreboot. *.debug files can be
used for source level debug. Signed-off-by: Marc Jones <marcj303@gmail.com> Acked-by: Peter Stuge <peter@stuge.se> git-svn-id: svn://svn.coreboot.org/coreboot/trunk@5827 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1
-rw-r--r--Makefile2
-rw-r--r--src/arch/i386/Makefile.bigbootblock.inc3
-rw-r--r--src/arch/i386/Makefile.bootblock.inc6
-rw-r--r--src/arch/i386/Makefile.inc6
4 files changed, 16 insertions, 1 deletions
diff --git a/Makefile b/Makefile
index 247daccc01..771f48de8d 100644
--- a/Makefile
+++ b/Makefile
@@ -287,7 +287,7 @@ INCLUDES += -Isrc/devices/oprom/include
# 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
diff --git a/src/arch/i386/Makefile.bigbootblock.inc b/src/arch/i386/Makefile.bigbootblock.inc
index 9b0e179e71..939eea63a3 100644
--- a/src/arch/i386/Makefile.bigbootblock.inc
+++ b/src/arch/i386/Makefile.bigbootblock.inc
@@ -32,4 +32,7 @@ $(obj)/coreboot: $$(initobjs) $(obj)/ldscript.ld
@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 $@
diff --git a/src/arch/i386/Makefile.bootblock.inc b/src/arch/i386/Makefile.bootblock.inc
index 9fb78c57b7..52a529c1d7 100644
--- a/src/arch/i386/Makefile.bootblock.inc
+++ b/src/arch/i386/Makefile.bootblock.inc
@@ -75,6 +75,9 @@ $(obj)/bootblock.elf: $(obj)/mainboard/$(MAINBOARDDIR)/bootblock.o $(obj)/bootbl
@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 @@ $(obj)/coreboot.romstage: $(obj)/coreboot.pre1 $$(initobjs) $(obj)/romstage/ldsc
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
diff --git a/src/arch/i386/Makefile.inc b/src/arch/i386/Makefile.inc
index 13ecd2f2f0..ba6489030f 100644
--- a/src/arch/i386/Makefile.inc
+++ b/src/arch/i386/Makefile.inc
@@ -107,6 +107,9 @@ $(obj)/coreboot_ram: $(obj)/coreboot_ram.o $(src)/arch/i386/coreboot_ram.ld #ldo
@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 @@ ifeq ($(CONFIG_AP_CODE_IN_CAR),y)
$(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