summaryrefslogtreecommitdiff
path: root/elf
diff options
context:
space:
mode:
authorSunil Nimmagadda <sunil@nimmagadda.net>2026-10-24 20:37:33 +0530
committerSunil Nimmagadda <sunil@nimmagadda.net>2026-10-24 20:37:33 +0530
commitfce4f25578506e18de600579fc230d50c5e7b665 (patch)
treef14d1d1b5263dacb135a97c7a2aefca5a942ade2 /elf
parentf5f7251972748d76f9f6e0cacdcae97a303a02dc (diff)
header: set ehsize to valid value at normalize.HEADmain
Diffstat (limited to 'elf')
-rw-r--r--elf/header.lua2
1 files changed, 1 insertions, 1 deletions
diff --git a/elf/header.lua b/elf/header.lua
index b289f13..3efce7b 100644
--- a/elf/header.lua
+++ b/elf/header.lua
@@ -35,7 +35,7 @@ function M.normalize(hdr)
hdr.phoff = hdr.phoff or 0
hdr.shoff = hdr.shoff or 0
hdr.flags = hdr.flags or 0
- hdr.ehsize = hdr.ehsize or 0
+ hdr.ehsize = hdr.ehsize or ((hdr.class == ec.Class.bit32) and 0x34 or 0x40)
hdr.phentsize = hdr.phentsize or 0
hdr.phnum = hdr.phnum or 0
hdr.shentsize = hdr.shentsize or 0