summaryrefslogtreecommitdiff
path: root/sample.elf.lua
diff options
context:
space:
mode:
authorSunil Nimmagadda <sunil@nimmagadda.net>2026-10-23 22:43:44 +0530
committerSunil Nimmagadda <sunil@nimmagadda.net>2026-10-23 22:44:48 +0530
commit79f6b161f892f621a909ce1df99b3c680f3682a2 (patch)
tree7647bed7ccaa977f3cd28dcc8283ceef63265e57 /sample.elf.lua
parentd46e3e7761a133d58b6c77058473d9edc8a54744 (diff)
Refactor: Move to an elf module.
While here, define a elf.d.lua to help author type check configuration file.
Diffstat (limited to 'sample.elf.lua')
-rw-r--r--sample.elf.lua47
1 files changed, 47 insertions, 0 deletions
diff --git a/sample.elf.lua b/sample.elf.lua
new file mode 100644
index 0000000..f6b48d5
--- /dev/null
+++ b/sample.elf.lua
@@ -0,0 +1,47 @@
+header {
+ magic = { 0x7f, 0x45, 0x4c, 0x46 },
+ class = Class.bit64,
+ data = Endian.big,
+ ident_version = ELFVERSION,
+ osabi = Osabi.netbsd,
+ abiversion = 0,
+ type = Type.exec,
+ machine = Machine.i386,
+ version = ELFVERSION,
+ entry = 0,
+ phoff = 0x40,
+ shoff = 0xff,
+ flags = 0,
+ ehsize = 64,
+ shentsize = 0x40,
+ shnum = 0,
+ shstrndx = 0,
+}
+
+segments {
+ {
+ type = SegmentType.dynamic,
+ flags = SegmentFlags.x,
+ offset = 0xf,
+ vaddr = 0xff,
+ paddr = 0xfff,
+ filesz = 0xffff,
+ memsz = 0xfffff,
+ align = 1,
+ },
+ {
+ type = SegmentType.dynamic,
+ flags = SegmentFlags.r,
+ offset = 0xa,
+ vaddr = 0xaa,
+ paddr = 0xaaa,
+ filesz = 0xaaaa,
+ memsz = 0xaaaaa,
+ align = 1,
+ },
+}
+
+sections {
+ {},
+ {},
+}