diff options
| author | Sunil Nimmagadda <sunil@nimmagadda.net> | 2026-10-30 12:37:38 +0530 |
|---|---|---|
| committer | Sunil Nimmagadda <sunil@nimmagadda.net> | 2026-10-30 12:54:38 +0530 |
| commit | d7520a75f01194a22f433c682e99b4482808f443 (patch) | |
| tree | 938af4c650b206c71f0a67fb3a4ed989170f747a | |
| parent | cc5e2ae695cfe199044ef614b2dfc1991095bcc0 (diff) | |
Don't take a detour to reach constants.
| -rw-r--r-- | elf/init.lua | 9 | ||||
| -rw-r--r-- | mkelf.lua | 19 | ||||
| -rw-r--r-- | types/elf.d.lua | 21 |
3 files changed, 21 insertions, 28 deletions
diff --git a/elf/init.lua b/elf/init.lua index 6e6966a..7a9040b 100644 --- a/elf/init.lua +++ b/elf/init.lua @@ -1,18 +1,9 @@ -local constants = require("elf.constants") local header = require("elf.header") local segment = require("elf.segment") local section = require("elf.section") local M = {} -M.VERSION = constants.VERSION -M.Class = constants.Class -M.Endian = constants.Endian -M.Osabi = constants.Osabi -M.Type = constants.Type -M.Machine = constants.Machine -M.SegmentType = constants.SegmentType -M.SegmentFlags = constants.SegmentFlags M.header = header M.segment = segment M.section = section @@ -19,15 +19,16 @@ local function loadconfig(fn) local section_mt = { __index = elf.section } local env = setmetatable({}, { __index = { - -- Keep in sync with types/elf.d.lua - Class = elf.Class, - Endian = elf.Endian, - Osabi = elf.Osabi, - Type = elf.Type, - Machine = elf.Machine, - SegmentType = elf.SegmentType, - SegmentFlags = elf.SegmentFlags, - ELFVERSION = elf.VERSION, + Class = ec.Class, + Endian = ec.Endian, + Osabi = ec.Osabi, + Type = ec.Type, + Machine = ec.Machine, + SegmentType = ec.SegmentType, + SegmentFlags = ec.SegmentFlags, + SectionType = ec.SectionType, + SectionFlags = ec.SectionFlags, + ELFVERSION = ec.VERSION, header = function(t) if type(t) ~= "table" then diff --git a/types/elf.d.lua b/types/elf.d.lua index 5e367b1..f5fb3a8 100644 --- a/types/elf.d.lua +++ b/types/elf.d.lua @@ -1,16 +1,17 @@ ---@meta -local elf = require("elf") +local ec = require("elf.constants") --- TODO keep in sync with mkelf:loadconfig() env. -Class = elf.Class -Endian = elf.Endian -Osabi = elf.Osabi -Type = elf.Type -Machine = elf.Machine -SegmentType = elf.SegmentType -SegmentFlags = elf.SegmentFlags -ELFVERSION = elf.VERSION +Class = ec.Class +Endian = ec.Endian +Osabi = ec.Osabi +Type = ec.Type +Machine = ec.Machine +SegmentType = ec.SegmentType +SegmentFlags = ec.SegmentFlags +SectionType = ec.SectionType +SectionFlags = ec.SectionFlags +ELFVERSION = ec.VERSION ---ELF header --[[ |
