genprotimg|zipl: build debuginfo files

Currently, the debug information of the bootloader is discarded during
the raw binary creation. Change this by creating separate
<loader>.bin.debug files containing the debug information. The packager
will then be able to package these files as desired and the developer
can use them to debug the code.

Reviewed-by: Jan Höppner <hoeppner@linux.ibm.com>
Signed-off-by: Marc Hartmayer <mhartmay@linux.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
This commit is contained in:
Marc Hartmayer
2023-07-20 17:10:01 +02:00
committed by Jan Höppner
parent 3d098416c6
commit faac2520c9
3 changed files with 17 additions and 7 deletions

1
.gitignore vendored
View File

@@ -24,6 +24,7 @@ compile_commands.json
# Ignore generated executables and other generated files
#
**/.detect-openssl.dep.c
*.debug
ap_tools/ap-check
cmsfs-fuse/cmsfs-fuse
cpacfstats/cpacfstats

View File

@@ -2,6 +2,7 @@
include ../../common.mak
FILES := stage3a.bin stage3b.bin stage3b_reloc.bin
DEBUG_FILES := $(addsuffix .debug,$(FILES))
ifeq ($(HOST_ARCH),s390x)
ZIPL_DIR := $(rootdir)/zipl
@@ -75,6 +76,9 @@ stage3b.elf: head.o $(ZIPL_OBJS)
$(LINK) $(NO_PIE_LDFLAGS) $(NO_WARN_RWX_SEGMENTS_LDFLAGS) -Wl,-T,$< -Wl,--build-id=none -m64 -static -nostdlib $(filter %.o, $^) -o $@
@chmod a-x $@
%.bin.debug: %.elf
$(OBJCOPY) --only-keep-debug $< $@
%.bin: %.elf
$(OBJCOPY) -O binary $< $@
@chmod a-x $@
@@ -89,7 +93,7 @@ else
# `-include $(dependencies_c)` statement).
.PHONY: $(dependencies_c)
$(FILES):
$(FILES) $(DEBUG_FILES):
echo " SKIP $@ due to HOST_ARCH != s390x"
install:
@@ -97,9 +101,9 @@ install:
endif
.DEFAULT_GOAL := all
all: $(FILES)
all: $(FILES) $(DEBUG_FILES)
clean:
rm -f *.o *.elf *.bin *.map .*.d *.lds
rm -f -- *.o *.elf *.bin *.map .*.d *.lds *.debug
.PHONY: all clean

View File

@@ -13,15 +13,17 @@ ALL_CFLAGS = $(NO_PIE_CFLAGS) -Os -g $(INCLUDE_PARMS) \
-W -Wall -Wformat-security -fno-sanitize=all -Wno-array-bounds
ALL_LDFLAGS += -fno-sanitize=all
FILES = fba0.bin fba1b.bin fba2.bin \
INC_FILES := fba0.bin fba1b.bin fba2.bin \
eckd0_ldl.bin eckd0_cdl.bin \
eckd1.bin eckd1b.bin eckd2.bin \
tape0.bin \
eckd2dump_sv.bin tape2dump.bin fba2dump.bin eckd2dump_mv.bin
FILES := $(INC_FILES) stage3.bin
DEBUG_FILES := $(addsuffix .debug,$(FILES))
all: .loaders tape0.bin stage3.bin
all: .loaders $(FILES) $(DEBUG_FILES)
.loaders: $(FILES)
.loaders: $(INC_FILES)
touch .loaders
# Prevent make from using some default rules...
@@ -75,12 +77,15 @@ stage3.exec: head.o stage3.o kdump3.o libc.o ebcdic.o ebcdic_conv.o sclp.o \
%.exec: %.o
$(LINK) -Wl,-T,$(filter %.lds,$^) $(NO_PIE_LDFLAGS) $(NO_WARN_RWX_SEGMENTS_LDFLAGS) -Wl,--build-id=none -m64 -static -nostdlib $(filter %.o, $^) -o $@
%.bin.debug: %.exec
$(OBJCOPY) --only-keep-debug $< $@
%.bin: %.exec
$(OBJCOPY) -O binary $< $@
clean:
rm -f -- *.o *.exec *.bin $(FILES) tape0.bin *.xxx *.yyy \
stage3.bin *.lds .*.lds.d .loaders
stage3.bin *.lds .*.lds.d .loaders *.debug
.PHONY: all clean