aboutsummaryrefslogtreecommitdiff
path: root/lib/imm.ld
diff options
context:
space:
mode:
authorKimplul <kimi.h.kuparinen@gmail.com>2023-06-27 13:00:19 +0300
committerKimplul <kimi.h.kuparinen@gmail.com>2023-06-27 13:00:19 +0300
commit6aefc5167a64e05580dcf1afc70efa496ed145ac (patch)
tree57032839fd8f5f748b273c679f3766c6911bbca5 /lib/imm.ld
parente80d3758a37848cda7990e8eff68ed9df344afa4 (diff)
downloadcopyjit-6aefc5167a64e05580dcf1afc70efa496ed145ac.tar.gz
copyjit-6aefc5167a64e05580dcf1afc70efa496ed145ac.zip
add immediate loading
Diffstat (limited to 'lib/imm.ld')
-rw-r--r--lib/imm.ld23
1 files changed, 23 insertions, 0 deletions
diff --git a/lib/imm.ld b/lib/imm.ld
new file mode 100644
index 0000000..5e69ebf
--- /dev/null
+++ b/lib/imm.ld
@@ -0,0 +1,23 @@
+ENTRY(_op)
+
+PHDRS {
+ headers PT_PHDR PHDRS;
+ text PT_LOAD FILEHDR PHDRS;
+ data PT_LOAD;
+}
+
+SECTIONS {
+ . = SIZEOF_HEADERS;
+ .text : {
+ *(.text*);
+
+ /* reserve eight bytes of data */
+ __imm = .;
+ . += 8;
+ __next_op = .;
+ } :text
+
+ /* mostly just to silence warnings, operations aren't allowed to have
+ * any data in them */
+ .data : { *(.data*) } :data
+}