Commit 803a1025bb

Noam Preil <noam@pixelhero.dev>
2020-08-21 23:52:03
Targets: add SPU Mark II architecture
1 parent 29051a0
Changed files (3)
lib
src-self-hosted
link
lib/std/elf.zig
@@ -976,6 +976,9 @@ pub const EM = extern enum(u16) {
     /// MIPS RS3000 Little-endian
     _MIPS_RS3_LE = 10,
 
+    /// SPU Mark II
+    _SPU_2 = 13,
+
     /// Hewlett-Packard PA-RISC
     _PARISC = 15,
 
lib/std/target.zig
@@ -663,6 +663,8 @@ pub const Target = struct {
             renderscript32,
             renderscript64,
             ve,
+            // Non-LLVM targets go here
+            spu_2,
 
             pub fn isARM(arch: Arch) bool {
                 return switch (arch) {
@@ -761,6 +763,7 @@ pub const Target = struct {
                     .sparcv9 => ._SPARCV9,
                     .s390x => ._S390,
                     .ve => ._NONE,
+                    .spu_2 => ._SPU_2,
                 };
             }
 
@@ -803,6 +806,7 @@ pub const Target = struct {
                     .renderscript64,
                     .shave,
                     .ve,
+                    .spu_2,
                     => .Little,
 
                     .arc,
@@ -827,6 +831,7 @@ pub const Target = struct {
                 switch (arch) {
                     .avr,
                     .msp430,
+                    .spu_2,
                     => return 16,
 
                     .arc,
@@ -1317,12 +1322,13 @@ pub const Target = struct {
                 .bpfeb,
                 .nvptx,
                 .nvptx64,
+                .spu_2,
+                .avr,
                 => return result,
 
                 // TODO go over each item in this list and either move it to the above list, or
                 // implement the standard dynamic linker path code for it.
                 .arc,
-                .avr,
                 .hexagon,
                 .msp430,
                 .r600,
src-self-hosted/link/Elf.zig
@@ -249,7 +249,7 @@ fn openFile(allocator: *Allocator, file: fs.File, options: link.Options) !Elf {
             .allocator = allocator,
         },
         .ptr_width = switch (options.target.cpu.arch.ptrBitWidth()) {
-            32 => .p32,
+            16, 32 => .p32,
             64 => .p64,
             else => return error.UnsupportedELFArchitecture,
         },
@@ -278,7 +278,7 @@ fn createFile(allocator: *Allocator, file: fs.File, options: link.Options) !Elf
             .file = file,
         },
         .ptr_width = switch (options.target.cpu.arch.ptrBitWidth()) {
-            32 => .p32,
+            16, 32 => .p32,
             64 => .p64,
             else => return error.UnsupportedELFArchitecture,
         },