Reduced file size when data is empty

This commit is contained in:
Eduard Urbach 2024-07-18 23:06:48 +02:00
parent 824efbf424
commit 733c12d413
Signed by: akyoto
GPG Key ID: C874F672B1AF20C0

View File

@ -81,6 +81,9 @@ func (elf *ELF) Write(writer io.Writer) {
binary.Write(writer, binary.LittleEndian, &elf.DataHeader) binary.Write(writer, binary.LittleEndian, &elf.DataHeader)
writer.Write(elf.CodePadding) writer.Write(elf.CodePadding)
writer.Write(elf.Code) writer.Write(elf.Code)
if len(elf.Data) > 0 {
writer.Write(elf.DataPadding) writer.Write(elf.DataPadding)
writer.Write(elf.Data) writer.Write(elf.Data)
} }
}