aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--mkelf.lua4
1 files changed, 2 insertions, 2 deletions
diff --git a/mkelf.lua b/mkelf.lua
index b7c693a..2f811a3 100644
--- a/mkelf.lua
+++ b/mkelf.lua
@@ -96,8 +96,8 @@ local function main()
i = i + 1
end
local header, segments, sections = loadconfig(infn)
- header.phnum = #segments
- header.shnum = #sections
+ if header.phnum == 0 then header.phnum = #segments end
+ if header.shnum == 0 then header.shnum = #sections end
local out <close> = assert(io.open(outfn, "wb"))
out:write(header:pack())
for _, segment in ipairs(segments) do