aboutsummaryrefslogtreecommitdiff
path: root/elf/header.lua
diff options
context:
space:
mode:
Diffstat (limited to 'elf/header.lua')
-rw-r--r--elf/header.lua14
1 files changed, 8 insertions, 6 deletions
diff --git a/elf/header.lua b/elf/header.lua
index 179e3bd..751ff9a 100644
--- a/elf/header.lua
+++ b/elf/header.lua
@@ -90,15 +90,17 @@ end
---@return string
---@nodiscard
function M.pack(hdr)
- return string.pack(
- "BBBBBBBBBxxxxxxx" .. fmt.endian(hdr.data) .. "I2I2I4"
- .. string.rep(fmt.word(hdr.class), 3) .. "I4I2I2I2I2I2I2",
- hdr.magic[1], hdr.magic[2], hdr.magic[3], hdr.magic[4], hdr.class,
+ return string.pack(table.concat({
+ "BBBBBBBBBxxxxxxx",
+ fmt.endian(hdr.data),
+ "I2I2I4",
+ string.rep(fmt.word(hdr.class), 3),
+ "I4I2I2I2I2I2I2",
+ }), hdr.magic[1], hdr.magic[2], hdr.magic[3], hdr.magic[4], hdr.class,
hdr.data, hdr.ident_version, hdr.osabi, hdr.abiversion, hdr.type,
hdr.machine, hdr.version, hdr.entry, hdr.phoff, hdr.shoff, hdr.flags,
hdr.ehsize, hdr.phentsize, hdr.phnum, hdr.shentsize, hdr.shnum,
- hdr.shstrndx
- )
+ hdr.shstrndx)
end
return M