about summary refs log tree commit diff stats
path: root/subx/021translate.cc
diff options
context:
space:
mode:
authorKartik Agaram <vc@akkartik.com>2018-07-03 14:24:50 -0700
committerKartik Agaram <vc@akkartik.com>2018-07-03 14:57:39 -0700
commit0defd18cfc5fd3e9190ceb067b859294c5b2677c (patch)
treecb3b1b3a48d14d2f7d97e2c86521dff77f8db2c5 /subx/021translate.cc
parent7c71860b87711531f1fd590a9768603a01dc4b18 (diff)
downloadmu-0defd18cfc5fd3e9190ceb067b859294c5b2677c.tar.gz
4308
Undo 4291; turns out the generated ELF binary was no longer running
natively on 32-bit Linux. Even with p_align set to 0.

Agh, not worth my time.
Diffstat (limited to 'subx/021translate.cc')
-rw-r--r--subx/021translate.cc6
1 files changed, 3 insertions, 3 deletions
diff --git a/subx/021translate.cc b/subx/021translate.cc
index e43ea894..40d75a8a 100644
--- a/subx/021translate.cc
+++ b/subx/021translate.cc
@@ -68,7 +68,7 @@ void dump_elf_header(ostream& out) {
   // e_version
   O(0x01); O(0x00); O(0x00); O(0x00);
   // e_entry
-  int e_entry = START;
+  int e_entry = START + /*size of ehdr*/52 + /*size of phdr*/32;
   emit(e_entry);
   // e_phoff -- immediately after ELF header
   int e_phoff = 52;
@@ -100,14 +100,14 @@ void dump_elf_header(ostream& out) {
   uint32_t p_type = 0x1;
   emit(p_type);
   // p_offset
-  uint32_t p_offset = /*size of ehdr*/52 + /*size of phdr*/32;
+  uint32_t p_offset = 0;
   emit(p_offset);
   // p_vaddr
   emit(START);
   // p_paddr
   emit(START);
   // p_filesz
-  uint32_t size = End_of_program - /*we're not using location 0*/1;
+  uint32_t size = (End_of_program-/*we're not using location 0*/1) + /*size of ehdr*/52 + /*size of phdr*/32;
   emit(size);
   // p_memsz
   emit(size);