about summary refs log tree commit diff stats
path: root/subx/028translate.cc
diff options
context:
space:
mode:
authorKartik Agaram <vc@akkartik.com>2019-02-18 21:48:19 -0800
committerKartik Agaram <vc@akkartik.com>2019-02-18 21:48:19 -0800
commit8188bbbc9408322c18cdc2d1049126900abf793c (patch)
tree2141b32bc1b7df6106980e12f0edbacc7dcfd329 /subx/028translate.cc
parent6607a30415e2bede27c43b57ce3c5cbc42278fa9 (diff)
downloadmu-8188bbbc9408322c18cdc2d1049126900abf793c.tar.gz
4981 - no, go back to 3 phases
Considering how much trouble a merge phase would be (commit 4978), it seems
simpler to just add the extra syntax for controlling the entry point of
the generated ELF binary.

But I wouldn't have noticed this if I hadn't taken the time to write out
the commit messages of 4976 and 4978.

Even if we happened to already have linked list primitives built, this
may still be a good idea considering that I'm saving quite a lot of code
in duplicated entrypoints.
Diffstat (limited to 'subx/028translate.cc')
-rw-r--r--subx/028translate.cc7
1 files changed, 4 insertions, 3 deletions
diff --git a/subx/028translate.cc b/subx/028translate.cc
index 2104d57b..d4b1a3a5 100644
--- a/subx/028translate.cc
+++ b/subx/028translate.cc
@@ -97,13 +97,14 @@ void write_elf_header(ostream& out, const program& p) {
   // e_version
   O(0x01); O(0x00); O(0x00); O(0x00);
   // e_entry
-  int e_entry = p.segments.at(0).start;  // convention
+  uint32_t e_entry = p.segments.at(0).start;  // convention
+  // Override e_entry
   emit(e_entry);
   // e_phoff -- immediately after ELF header
-  int e_phoff = 0x34;
+  uint32_t e_phoff = 0x34;
   emit(e_phoff);
   // e_shoff; unused
-  int dummy32 = 0;
+  uint32_t dummy32 = 0;
   emit(dummy32);
   // e_flags; unused
   emit(dummy32);