From 60d03262d801bd4d7392e1100b35c05cf7ef49eb Mon Sep 17 00:00:00 2001 From: Marc Hartmayer Date: Fri, 27 Jan 2023 16:44:02 +0000 Subject: [PATCH] zipl/boot: simplify objcopy commands MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Instead of maintaining an include list, use an exclude list (if neccessary). This simplifies the `objcopy` calls a lot, and it's possible because `objcopy -O binary` only includes the memory dump of the contents of the input object file. [1] This means that sections like for debug information that do not occupy memory during the process execution are discarded by design. [2] In addition, if we do not want a particular ELF section, we can list it in the discard section of the linker script. [1] https://man7.org/linux/man-pages/man1/objcopy.1.html [2] https://man7.org/linux/man-pages/man5/elf.5.html Reviewed-by: Stefan Haberland Signed-off-by: Marc Hartmayer Signed-off-by: Jan Höppner --- zipl/boot/Makefile | 32 +------------------------------- 1 file changed, 1 insertion(+), 31 deletions(-) diff --git a/zipl/boot/Makefile b/zipl/boot/Makefile index 6177dfc1..52d01fdd 100644 --- a/zipl/boot/Makefile +++ b/zipl/boot/Makefile @@ -77,37 +77,7 @@ stage3.exec: head.o stage3.o kdump3.o libc.o ebcdic.o ebcdic_conv.o sclp.o \ $(LINK) $$SFLAGS $(NO_PIE_LDFLAGS) $(NO_WARN_RWX_SEGMENTS_LDFLAGS) -Wl,--build-id=none -m64 -static -nostdlib $(filter %.o, $^) -o $@ %.bin: %.exec - $(OBJCOPY) -O binary \ - --only-section=.stage2.head \ - --only-section=.text.dummy \ - --only-section=.text.start \ - --only-section=.text \ - --only-section=.ex_table \ - --only-section=.data \ - --only-section=.rodata.str1.2 \ - --only-section=.rodata.cst8 \ - --only-section=.rodata \ - --only-section=.stage2dump.tail \ - --only-section=.eckd2dump_mv.tail \ - --only-section=.fixup \ - $< $@ - -stage3.bin: stage3.exec - $(OBJCOPY) -O binary \ - --only-section=.stage2.head \ - --only-section=.text.dummy \ - --only-section=.text.start \ - --only-section=.text \ - --only-section=.ex_table \ - --only-section=.data \ - --only-section=.rodata.str1.2 \ - --only-section=.rodata.cst8 \ - --only-section=.rodata \ - --only-section=.stage2dump.tail \ - --only-section=.eckd2dump_mv.tail \ - --only-section=.fixup \ - --only-section=.sb.trailer \ - $< $@ + $(OBJCOPY) -O binary $< $@ data.o: $(FILES) $(LINK) $(NO_PIE_LDFLAGS) -static -nostdlib -Wl,--relocatable -Wl,--format,binary -o data.o $(FILES)