switch assembler to little-endian
authorLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Wed, 8 Jul 2020 17:26:16 +0000 (18:26 +0100)
committerLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Wed, 8 Jul 2020 17:26:16 +0000 (18:26 +0100)
src/soc/simulator/program.py

index 4cf9b9ffd52778e2a971178121f8979679b690b6..2f3d88b3755bd2a0a86e1d5428f3ee0fb0d4f3f6 100644 (file)
@@ -13,9 +13,15 @@ import sys
 filedir = os.path.dirname(os.path.realpath(__file__))
 memmap = os.path.join(filedir, "memmap")
 
-bigendian = True
-endian_fmt = "elf64-big"
-obj_fmt = "-be"
+bigendian = False
+if bigendian:
+    endian_fmt = "elf64-big"
+    obj_fmt = "-be"
+    ld_fmt = "-EB"
+else:
+    ld_fmt = "-EL"
+    endian_fmt = "elf64-little"
+    obj_fmt = "-le"
 
 
 class Program:
@@ -49,6 +55,7 @@ class Program:
     def _link(self, ofile):
         with tempfile.NamedTemporaryFile(suffix=".elf") as elffile:
             args = ["powerpc64-linux-gnu-ld",
+                    ld_fmt,
                     "-o", elffile.name,
                     "-T", memmap,
                     ofile.name]