diff options
| author | Sunil Nimmagadda <sunil@nimmagadda.net> | 2026-11-05 23:25:40 +0530 |
|---|---|---|
| committer | Sunil Nimmagadda <sunil@nimmagadda.net> | 2026-11-05 23:25:40 +0530 |
| commit | 763930302205c61e4909dc429d61e33624d61d6b (patch) | |
| tree | e5b134e786b38cc9566221b9ca33195e70821a87 /elf/header.lua | |
| parent | 6f83d9020a1788b0fa1d1b1fac658f2c8d704bd9 (diff) | |
Move all the validations to correct place.
Diffstat (limited to 'elf/header.lua')
| -rw-r--r-- | elf/header.lua | 14 |
1 files changed, 0 insertions, 14 deletions
diff --git a/elf/header.lua b/elf/header.lua index de939d9..179e3bd 100644 --- a/elf/header.lua +++ b/elf/header.lua @@ -50,20 +50,6 @@ local M = {} ---@param hdropts HeaderOptions ---@return Header function M.normalize(hdropts) - -- TODO drop these error() and return, let callers report. - if not hdropts.class then error("class is required in header", 3) end - if not hdropts.data then error("data is required in header", 3) end - if not hdropts.type then error("type is required in header", 3) end - if not hdropts.machine then error("machine is required in header", 3) end - - -- Can't pack without these values being valid. - if hdropts.class ~= ec.Class.bit32 and hdropts.class ~= ec.Class.bit64 then - error("class must be Class.bit32 or Class.bit64 in header", 3) - end - if hdropts.data ~= ec.Endian.little and hdropts.data ~= ec.Endian.big then - error("data must be Endian.little or Endian.big in header", 3) - end - local phoff, ehsize, phentsize, shentsize if hdropts.class == ec.Class.bit32 then phoff = hdropts.phoff or 0x34 |
