diff options
| author | Sunil Nimmagadda <sunil@nimmagadda.net> | 2026-10-24 11:21:21 +0530 |
|---|---|---|
| committer | Sunil Nimmagadda <sunil@nimmagadda.net> | 2026-10-24 11:21:21 +0530 |
| commit | 3e36380874aa40932fa629fc4f53bdd50c4f2311 (patch) | |
| tree | ca18272e9d5f4143937d8dbb869290e22dea4560 /elf | |
| parent | 4676bb3a05d89bb3c282da2ed8b2072e163093ff (diff) | |
Attach the respective metatables to loaded the config.
This simplifies calling pack() on respective tables.
Diffstat (limited to 'elf')
| -rw-r--r-- | elf/header.lua | 3 | ||||
| -rw-r--r-- | elf/section.lua | 9 | ||||
| -rw-r--r-- | elf/segment.lua | 5 |
3 files changed, 9 insertions, 8 deletions
diff --git a/elf/header.lua b/elf/header.lua index 2a9ec68..6baf327 100644 --- a/elf/header.lua +++ b/elf/header.lua @@ -1,7 +1,5 @@ local fmt = require("elf.fmt") -local M = {} - ---@alias Magic [integer, integer, integer, integer] ---@class Header @@ -24,6 +22,7 @@ local M = {} ---@field shentsize integer ---@field shnum integer ---@field shstrndx integer +local M = {} ---@param hdr Header ---@return string diff --git a/elf/section.lua b/elf/section.lua index 64a91b2..5e185fd 100644 --- a/elf/section.lua +++ b/elf/section.lua @@ -1,14 +1,15 @@ local fmt = require("elf.fmt") -local M = {} - ---@class Section ----@param section Section +---@class Sections +local M = {} + +---@param sections Sections ---@param endian Endian ---@return string ---@nodiscard -function M.pack(section, endian) +function M.pack(sections, endian) -- TODO return string.pack("B", 0x1) end diff --git a/elf/segment.lua b/elf/segment.lua index da8e9c6..662f42e 100644 --- a/elf/segment.lua +++ b/elf/segment.lua @@ -1,8 +1,6 @@ local ec = require("elf.constants") local fmt = require("elf.fmt") -local M = {} - ---@class Segment ---@field type SegmentType ---@field flags integer @@ -13,6 +11,9 @@ local M = {} ---@field memsz integer ---@field align integer +---@class Segments +local M = {} + ---@param phdr Segment ---@param endian Endian ---@return string |
