aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSunil Nimmagadda <sunil@nimmagadda.net>2026-11-09 16:22:26 +0530
committerSunil Nimmagadda <sunil@nimmagadda.net>2026-11-09 16:22:26 +0530
commit1058681fde4d104cf01a804a488b0d94911c1240 (patch)
tree630ec69744224a726311d8909c6df78cec6f96c7
parent1a3386f21b5cd7750b27885c31adf14376b06f68 (diff)
Consistently collect the parts.
-rw-r--r--mkelf.lua3
1 files changed, 2 insertions, 1 deletions
diff --git a/mkelf.lua b/mkelf.lua
index fbd7909..d350a8d 100644
--- a/mkelf.lua
+++ b/mkelf.lua
@@ -143,9 +143,10 @@ end
---@param sections Section[]
---@return string
local function elf_pack(header, segments, sections)
+ local parts = {}
local ok, b = pcall(elf.header.pack, header)
if not ok then error(("header: %s"):format(b), 0) end
- local parts = { b }
+ parts[#parts + 1] = b
for i, sg in ipairs(segments) do
local sgok, sgb = pcall(elf.segment.pack, sg, header.data, header.class)
if not sgok then error(("segment #%d: %s"):format(i, sgb), 0) end