aboutsummaryrefslogtreecommitdiff
path: root/mkelf.lua
diff options
context:
space:
mode:
authorSunil Nimmagadda <sunil@nimmagadda.net>2026-10-30 10:27:05 +0530
committerSunil Nimmagadda <sunil@nimmagadda.net>2026-10-30 10:27:05 +0530
commit7d496278cc9b36f3a593df137586204d3d766a3e (patch)
tree38aa22849c4f26205c1f59edf21755e2d44e3b83 /mkelf.lua
parentb408893577d64b02caecd77778c6c5517d552b3a (diff)
Type check user config for tables.
Diffstat (limited to 'mkelf.lua')
-rw-r--r--mkelf.lua9
1 files changed, 7 insertions, 2 deletions
diff --git a/mkelf.lua b/mkelf.lua
index f078764..518b765 100644
--- a/mkelf.lua
+++ b/mkelf.lua
@@ -30,11 +30,17 @@ local function loadconfig(fn)
ELFVERSION = elf.VERSION,
header = function(t)
+ if type(t) ~= "table" then
+ error("header must be a table", 2)
+ end
header = setmetatable(t, header_mt)
t:normalize()
t:validate()
end,
segments = function(t)
+ if type(t) ~= "table" then
+ error("segments must be a table", 2)
+ end
segments = setmetatable(t, segments_mt)
t:normalize()
t:validate()
@@ -75,8 +81,7 @@ local function main()
local out <close> = assert(io.open(outfn, "wb"))
out:write(header:pack())
out:write(segments:pack(header.data, header.class))
- -- TODO finish section.pack
- out:write(sections:pack(header.data))
+ -- out:write(sections:pack(header.data, header.class))
end
main()