aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/obj.h
diff options
context:
space:
mode:
authorlemon <lsof@mailbox.org>2026-03-17 13:22:00 +0100
committerlemon <lsof@mailbox.org>2026-03-17 13:22:00 +0100
commita8d6f8bf30c07edb775e56889f568ca20240bedf (patch)
treeb5a452b2675b2400f15013617291fe6061180bbf /src/obj.h
parent24f14b7ad1af08d872971d72ce089a529911f657 (diff)
REFACTOR: move sources to src/
Diffstat (limited to 'src/obj.h')
-rw-r--r--src/obj.h36
1 files changed, 36 insertions, 0 deletions
diff --git a/src/obj.h b/src/obj.h
new file mode 100644
index 0000000..1982033
--- /dev/null
+++ b/src/obj.h
@@ -0,0 +1,36 @@
+#include "../common.h"
+
+extern struct objfile {
+ const char *infile, *outfile;
+ uchar *textbegin, *textend;
+ uchar *code;
+ uchar dataalign, rodataalign, bssalign;
+ uint nbss;
+ vec_of(uchar) data, rodata;
+} objout;
+
+enum relockind {
+ REL_ABS64,
+ REL_ABS32,
+ REL_ABS32S,
+ REL_PCREL32,
+ REL_PLT32,
+ REL_GOTPCRELX,
+ REL_GOTPCRELX_REX,
+ REL_CALL26,
+ REL_ADR_PREL_LO21,
+ REL_ADR_PREL_PG_HI21,
+ REL_ADD_ABS_LO12_NC,
+ REL_LD_PREL_LO19,
+ NRELOCKIND,
+};
+enum section { Snone, Stext, Srodata, Sdata, Sbss };
+
+void objini(const char *infile, const char *outfile);
+void objdeffunc(internstr nam, bool globl, uint off, uint siz);
+enum section objhassym(internstr name, uint *off);
+uint objnewdat(internstr name, enum section, bool globl, uint siz, uint align);
+void objreloc(internstr sym, enum relockind, enum section, uint off, vlong addend);
+void objfini(void);
+
+/* vim:set ts=3 sw=3 expandtab: */