From 6097ee3f9dd21b710dec224f897fc5f6007b9537 Mon Sep 17 00:00:00 2001 From: Marc Hartmayer Date: Fri, 3 Feb 2023 19:07:57 +0100 Subject: [PATCH] genprotimg/boot: Makefile: simplify objcopy command 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: Steffen Eiden Signed-off-by: Marc Hartmayer Signed-off-by: Jan Höppner --- genprotimg/boot/Makefile | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/genprotimg/boot/Makefile b/genprotimg/boot/Makefile index 604af974..85421e92 100644 --- a/genprotimg/boot/Makefile +++ b/genprotimg/boot/Makefile @@ -82,14 +82,8 @@ stage3b_reloc.elf: $(LINK) $$SFLAGS $(NO_PIE_LDFLAGS) $(NO_WARN_RWX_SEGMENTS_LDFLAGS) -Wl,--build-id=none -m64 -static -nostdlib $(filter %.o, $^) -o $@ @chmod a-x $@ -%.bin: %.elf - $(OBJCOPY) -O binary \ - --only-section=.text* \ - --only-section=.ex_table* \ - --only-section=.fixup* \ - --only-section=.data* \ - --only-section=.rodata* \ - $< $@ +%.bin: %.elf + $(OBJCOPY) -O binary $< $@ @chmod a-x $@ clean: