From 733c12d41385cd37c07406e576ed78ad1719e772 Mon Sep 17 00:00:00 2001 From: Eduard Urbach Date: Thu, 18 Jul 2024 23:06:48 +0200 Subject: [PATCH] Reduced file size when data is empty --- src/build/elf/ELF.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/build/elf/ELF.go b/src/build/elf/ELF.go index a2b1e4a..1cc8b57 100644 --- a/src/build/elf/ELF.go +++ b/src/build/elf/ELF.go @@ -81,6 +81,9 @@ func (elf *ELF) Write(writer io.Writer) { binary.Write(writer, binary.LittleEndian, &elf.DataHeader) writer.Write(elf.CodePadding) writer.Write(elf.Code) - writer.Write(elf.DataPadding) - writer.Write(elf.Data) + + if len(elf.Data) > 0 { + writer.Write(elf.DataPadding) + writer.Write(elf.Data) + } }