commit 803a1025bbfb8757589068ae29f6f2fc57a4f566 (tree)
parent 29051a0674800881957479c423a1feb043391671
Author: Noam Preil <noam@pixelhero.dev>
Date: Fri, 21 Aug 2020 17:52:03 -0400
Targets: add SPU Mark II architecture
Diffstat:
3 files changed, 12 insertions(+), 3 deletions(-)
diff --git a/lib/std/elf.zig b/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,
diff --git a/lib/std/target.zig b/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,
diff --git a/src-self-hosted/link/Elf.zig b/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,
},