about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorKartik Agaram <vc@akkartik.com>2018-07-14 10:40:26 -0700
committerKartik Agaram <vc@akkartik.com>2018-07-14 10:43:34 -0700
commitaa6c342af977b4638361b2e68c3f8cc6888cac24 (patch)
treeee7ac032d37796dc5949bd1a9a1a0c747d388428
parent6f812e6ea125aadd2e0891b094902b34924dccd0 (diff)
downloadmu-aa6c342af977b4638361b2e68c3f8cc6888cac24.tar.gz
4343
Let's minimize the alignment requirements of each segment's offset.
It'll make binaries take less room later. Otherwise we may need to pad
lots of 0s for segments after the first.

Generated ELF binaries continue to work natively (except ex4, but that
was already not working).
-rw-r--r--subx/021translate.cc2
-rwxr-xr-xsubx/ex1bin96 -> 96 bytes
-rwxr-xr-xsubx/ex2bin102 -> 102 bytes
-rwxr-xr-xsubx/ex3bin119 -> 119 bytes
-rwxr-xr-xsubx/ex4bin113 -> 113 bytes
5 files changed, 1 insertions, 1 deletions
diff --git a/subx/021translate.cc b/subx/021translate.cc
index c3d780f1..d33755ab 100644
--- a/subx/021translate.cc
+++ b/subx/021translate.cc
@@ -114,7 +114,7 @@ void dump_elf_header(ostream& out) {
   uint32_t p_flags = 0x5;  // r-x
   emit(p_flags);
   // p_align
-  uint32_t p_align = 0x1000;
+  uint32_t p_align = 0x4;  // p_offset must be congruent to p_paddr/p_vaddr modulo p_align
   emit(p_align);
 #undef O
 #undef emit
diff --git a/subx/ex1 b/subx/ex1
index f3c9730d..c4114dfd 100755
--- a/subx/ex1
+++ b/subx/ex1
Binary files differdiff --git a/subx/ex2 b/subx/ex2
index 3bbd979b..38520d38 100755
--- a/subx/ex2
+++ b/subx/ex2
Binary files differdiff --git a/subx/ex3 b/subx/ex3
index aa209b92..9c1f9a92 100755
--- a/subx/ex3
+++ b/subx/ex3
Binary files differdiff --git a/subx/ex4 b/subx/ex4
index b20490ad..21f7118b 100755
--- a/subx/ex4
+++ b/subx/ex4
Binary files differ