diff options
| author | Sunil Nimmagadda <sunil@nimmagadda.net> | 2026-10-30 11:35:52 +0530 |
|---|---|---|
| committer | Sunil Nimmagadda <sunil@nimmagadda.net> | 2026-10-30 11:35:52 +0530 |
| commit | cc5e2ae695cfe199044ef614b2dfc1991095bcc0 (patch) | |
| tree | a23da9366a49cd82e0cec425cbf5c55061e71ea4 /elf/section.lua | |
| parent | 7d496278cc9b36f3a593df137586204d3d766a3e (diff) | |
Untangle segment vs segments.
Let the elf module handle just a single segment/section while the
wrapper does the iteration.
Diffstat (limited to 'elf/section.lua')
| -rw-r--r-- | elf/section.lua | 48 |
1 files changed, 25 insertions, 23 deletions
diff --git a/elf/section.lua b/elf/section.lua index ca9953e..8f84b35 100644 --- a/elf/section.lua +++ b/elf/section.lua @@ -11,34 +11,36 @@ local fmt = require("elf.fmt") ---@field info? integer ---@field addralign? integer ---@field entsize? integer - ----@class Sections local M = {} ----@param sections Sections +function M.normalize(section) + -- TODO +end + +function M.validate(section) + --TODO +end + +---@param section Section ---@param endian Endian ---@return string ---@nodiscard -function M.pack(sections, endian, class) - local s = {} - for i, section in ipairs(sections) do - s[i] = string.pack(fmt.endian(endian) .. - "I4I4" .. - string.rep(fmt.word(class), 4) .. - "I4I4" .. - string.rep(fmt.word(class), 2), - section.name, - section.type, - section.flags, - section.addr, - section.offset, - section.size, - section.link, - section.info, - section.addralign, - section.entsize) - end - return table.concat(s) +function M.pack(section, endian, class) + return string.pack(fmt.endian(endian) .. + "I4I4" .. + string.rep(fmt.word(class), 4) .. + "I4I4" .. + string.rep(fmt.word(class), 2), + section.name, + section.type, + section.flags, + section.addr, + section.offset, + section.size, + section.link, + section.info, + section.addralign, + section.entsize) end return M |
