]> git.ipfire.org Git - thirdparty/ipxe.git/commitdiff
[build] Allow for 32-bit and 64-bit versions of util/zbin
authorMichael Brown <mcb30@ipxe.org>
Tue, 6 May 2025 11:07:38 +0000 (12:07 +0100)
committerMichael Brown <mcb30@ipxe.org>
Tue, 6 May 2025 11:11:02 +0000 (12:11 +0100)
Parsing ELF data is simpler if we don't have to build a single binary
to handle both 32-bit and 64-bit ELF formats.

Allow for separate 32-bit and 64-bit binaries built from util/zbin.c
(as is already done for util/elf2efi.c).

Signed-off-by: Michael Brown <mcb30@ipxe.org>
src/Makefile
src/Makefile.housekeeping
src/arch/arm32/Makefile
src/arch/arm64/Makefile
src/arch/i386/Makefile
src/arch/loong64/Makefile
src/arch/riscv32/Makefile
src/arch/riscv64/Makefile
src/arch/x86_64/Makefile
src/util/.gitignore

index 548a4e3f1ea7c4518c68be909b261a3934154f48..be5c7fda6b060c3ea7cce440752d7a6a44ddee31 100644 (file)
@@ -45,7 +45,8 @@ SORTOBJDUMP   := ./util/sortobjdump.pl
 PADIMG         := ./util/padimg.pl
 LICENCE                := ./util/licence.pl
 NRV2B          := ./util/nrv2b
-ZBIN           := ./util/zbin
+ZBIN32         := ./util/zbin32
+ZBIN64         := ./util/zbin64
 ELF2EFI32      := ./util/elf2efi32
 ELF2EFI64      := ./util/elf2efi64
 EFIROM         := ./util/efirom
index b291732135f5838cf9521ecb31bcbd88eb1c8227..3d4e731f6f14c090552c4467f43d8d3349bb3cfb 100644 (file)
@@ -1449,10 +1449,15 @@ endif # defined(BIN)
 
 ZBIN_LDFLAGS := -llzma
 
-$(ZBIN) : util/zbin.c $(MAKEDEPS)
+$(ZBIN32) : util/zbin.c $(MAKEDEPS)
        $(QM)$(ECHO) "  [HOSTCC] $@"
-       $(Q)$(HOST_CC) $(HOST_CFLAGS) $< $(ZBIN_LDFLAGS) -o $@
-CLEANUP += $(ZBIN)
+       $(Q)$(HOST_CC) $(HOST_CFLAGS) $< $(ZBIN_LDFLAGS) -DELF32 -o $@
+CLEANUP += $(ZBIN32)
+
+$(ZBIN64) : util/zbin.c $(MAKEDEPS)
+       $(QM)$(ECHO) "  [HOSTCC] $@"
+       $(Q)$(HOST_CC) $(HOST_CFLAGS) $< $(ZBIN_LDFLAGS) -DELF64 -o $@
+CLEANUP += $(ZBIN64)
 
 ###############################################################################
 #
index 0c1cf99d1843983948a0cb0a33a5af322eb20d01..070041734fab57bef3a5f831776ce6098255aafe 100644 (file)
@@ -1,3 +1,7 @@
+# Specify compressor
+#
+ZBIN           = $(ZBIN32)
+
 # ARM32-specific directories containing source files
 #
 SRCDIRS                += arch/arm32/core
index 9b9dd5ec8254fd9b719a0f7e4ba22abb8c6e08e1..719a1e61c8dfa3e8fdde1d79fec300bc8463c7a4 100644 (file)
@@ -1,3 +1,7 @@
+# Specify compressor
+#
+ZBIN           = $(ZBIN64)
+
 # ARM64-specific directories containing source files
 #
 SRCDIRS                += arch/arm64/core
index e59f05fc82c21d6db2422132e0d5bd52624a6b40..44ccfccc8440010ae42ae6f353959311ff3ad431 100644 (file)
@@ -1,3 +1,7 @@
+# Specify compressor
+#
+ZBIN           = $(ZBIN32)
+
 # Force i386-only instructions
 #
 CFLAGS         += -march=i386
index 90d0ec8e1eb7f095c1812c9796058a553b97c973..809af07eba08aef496fd916d3370305b77512531 100644 (file)
@@ -1,3 +1,7 @@
+# Specify compressor
+#
+ZBIN           = $(ZBIN64)
+
 # Assembler section type character
 #
 ASM_TCHAR      := @
index 0415f7c2dd96227980937d312855aeac8687bcb8..0d8b7ef50b2c92a1b4aa50cebe06ea08f5fc6245 100644 (file)
@@ -1,3 +1,7 @@
+# Specify compressor
+#
+ZBIN           = $(ZBIN32)
+
 # RISCV32-specific directories containing source files
 #
 SRCDIRS                += arch/riscv32/core
index 2fd18fc13bc8c491e6049e0fec35e252382c14bd..017fbacef273858a00153ff4271ab51b5bad8740 100644 (file)
@@ -1,3 +1,7 @@
+# Specify compressor
+#
+ZBIN           = $(ZBIN64)
+
 # RISCV64-specific directories containing source files
 #
 SRCDIRS                += arch/riscv64/core
index b3064b7526fd7ca5b16606b7eda086e184bcd4fe..276b96d3b2ce21b8acf26dd2307d28609318f3b1 100644 (file)
@@ -1,3 +1,7 @@
+# Specify compressor
+#
+ZBIN           = $(ZBIN64)
+
 # Code size reduction.
 #
 CFLAGS         += -fstrength-reduce -fomit-frame-pointer
index b4cb136013cf2da883ecff16c78f62c46c5d436b..fe68ee753d317355f1c668bdd95bd452c00ef86d 100644 (file)
@@ -1,5 +1,6 @@
 nrv2b
-zbin
+zbin32
+zbin64
 hijack
 prototester
 elf2efi32