authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2021-04-23 15:12:38-04:00
committergravatar for noreply@github.comGitHub <noreply@github.com> 2021-04-23 15:12:38-04:00
logdfb34c315576525806a471ae0c4f94b76d362bf9
treee53c6878730747cadb475d5ae4c31b6e38ce05f9
parent41efdc73b9a57dfcc57474310c64724f58a95493
parentc5cc6b7082b132c6dd99df1c5bc8de817822bda4
signaturebadge-question-mark Signed by PGP key 4AEE18F83AFDEB23

Merge pull request #8586 from LemonBoy/ppc32-touchups

A few more PPC32 touch-ups

5 files changed, 28 insertions(+), 10 deletions(-)

lib/std/os/bits/linux/powerpc.zig+1-9
...@@ -557,18 +557,10 @@ pub const kernel_stat = extern struct {...@@ -557,18 +557,10 @@ pub const kernel_stat = extern struct {
557 size: off_t,557 size: off_t,
558 blksize: blksize_t,558 blksize: blksize_t,
559 blocks: blkcnt_t,559 blocks: blkcnt_t,
560 __atim32: timespec32,
561 __mtim32: timespec32,
562 __ctim32: timespec32,
563 __unused: [2]u32,
564 atim: timespec,560 atim: timespec,
565 mtim: timespec,561 mtim: timespec,
566 ctim: timespec,562 ctim: timespec,
567563 __unused: [2]u32,
568 const timespec32 = extern struct {
569 tv_sec: i32,
570 tv_nsec: i32,
571 };
572564
573 pub fn atime(self: @This()) timespec {565 pub fn atime(self: @This()) timespec {
574 return self.atim;566 return self.atim;
lib/std/os/linux.zig+1
...@@ -52,6 +52,7 @@ pub fn getauxval(index: usize) usize {...@@ -52,6 +52,7 @@ pub fn getauxval(index: usize) usize {
52// Some architectures (and some syscalls) require 64bit parameters to be passed52// Some architectures (and some syscalls) require 64bit parameters to be passed
53// in a even-aligned register pair.53// in a even-aligned register pair.
54const require_aligned_register_pair =54const require_aligned_register_pair =
55 std.Target.current.cpu.arch.isPPC() or
55 std.Target.current.cpu.arch.isMIPS() or56 std.Target.current.cpu.arch.isMIPS() or
56 std.Target.current.cpu.arch.isARM() or57 std.Target.current.cpu.arch.isARM() or
57 std.Target.current.cpu.arch.isThumb();58 std.Target.current.cpu.arch.isThumb();
lib/std/special/compiler_rt.zig+3-1
...@@ -113,9 +113,11 @@ comptime {...@@ -113,9 +113,11 @@ comptime {
113 @export(@import("compiler_rt/extendXfYf2.zig").__extenddftf2, .{ .name = "__extenddftf2", .linkage = linkage });113 @export(@import("compiler_rt/extendXfYf2.zig").__extenddftf2, .{ .name = "__extenddftf2", .linkage = linkage });
114 @export(@import("compiler_rt/extendXfYf2.zig").__extendsftf2, .{ .name = "__extendsftf2", .linkage = linkage });114 @export(@import("compiler_rt/extendXfYf2.zig").__extendsftf2, .{ .name = "__extendsftf2", .linkage = linkage });
115 @export(@import("compiler_rt/extendXfYf2.zig").__extendhfsf2, .{ .name = "__extendhfsf2", .linkage = linkage });115 @export(@import("compiler_rt/extendXfYf2.zig").__extendhfsf2, .{ .name = "__extendhfsf2", .linkage = linkage });
116 @export(@import("compiler_rt/extendXfYf2.zig").__extendhftf2, .{ .name = "__extendhftf2", .linkage = linkage });
116117
117 @export(@import("compiler_rt/truncXfYf2.zig").__truncsfhf2, .{ .name = "__truncsfhf2", .linkage = linkage });118 @export(@import("compiler_rt/truncXfYf2.zig").__truncsfhf2, .{ .name = "__truncsfhf2", .linkage = linkage });
118 @export(@import("compiler_rt/truncXfYf2.zig").__truncdfhf2, .{ .name = "__truncdfhf2", .linkage = linkage });119 @export(@import("compiler_rt/truncXfYf2.zig").__truncdfhf2, .{ .name = "__truncdfhf2", .linkage = linkage });
120 @export(@import("compiler_rt/truncXfYf2.zig").__trunctfhf2, .{ .name = "__trunctfhf2", .linkage = linkage });
119 @export(@import("compiler_rt/truncXfYf2.zig").__trunctfdf2, .{ .name = "__trunctfdf2", .linkage = linkage });121 @export(@import("compiler_rt/truncXfYf2.zig").__trunctfdf2, .{ .name = "__trunctfdf2", .linkage = linkage });
120 @export(@import("compiler_rt/truncXfYf2.zig").__trunctfsf2, .{ .name = "__trunctfsf2", .linkage = linkage });122 @export(@import("compiler_rt/truncXfYf2.zig").__trunctfsf2, .{ .name = "__trunctfsf2", .linkage = linkage });
121123
...@@ -296,7 +298,7 @@ comptime {...@@ -296,7 +298,7 @@ comptime {
296 @export(@import("compiler_rt/sparc.zig")._Qp_qtod, .{ .name = "_Qp_qtod", .linkage = linkage });298 @export(@import("compiler_rt/sparc.zig")._Qp_qtod, .{ .name = "_Qp_qtod", .linkage = linkage });
297 }299 }
298300
299 if (builtin.arch == .powerpc or builtin.arch.isPPC64()) {301 if ((builtin.arch == .powerpc or builtin.arch.isPPC64()) and !is_test) {
300 @export(@import("compiler_rt/addXf3.zig").__addtf3, .{ .name = "__addkf3", .linkage = linkage });302 @export(@import("compiler_rt/addXf3.zig").__addtf3, .{ .name = "__addkf3", .linkage = linkage });
301 @export(@import("compiler_rt/addXf3.zig").__subtf3, .{ .name = "__subkf3", .linkage = linkage });303 @export(@import("compiler_rt/addXf3.zig").__subtf3, .{ .name = "__subkf3", .linkage = linkage });
302 @export(@import("compiler_rt/mulXf3.zig").__multf3, .{ .name = "__mulkf3", .linkage = linkage });304 @export(@import("compiler_rt/mulXf3.zig").__multf3, .{ .name = "__mulkf3", .linkage = linkage });
lib/std/target.zig+7
...@@ -800,6 +800,13 @@ pub const Target = struct {...@@ -800,6 +800,13 @@ pub const Target = struct {
800 };800 };
801 }801 }
802802
803 pub fn isPPC(arch: Arch) bool {
804 return switch (arch) {
805 .powerpc, .powerpcle => true,
806 else => false,
807 };
808 }
809
803 pub fn isPPC64(arch: Arch) bool {810 pub fn isPPC64(arch: Arch) bool {
804 return switch (arch) {811 return switch (arch) {
805 .powerpc64, .powerpc64le => true,812 .powerpc64, .powerpc64le => true,
test/tests.zig+16
...@@ -212,6 +212,22 @@ const test_targets = blk: {...@@ -212,6 +212,22 @@ const test_targets = blk: {
212 // .link_libc = true,212 // .link_libc = true,
213 //},213 //},
214214
215 TestTarget{
216 .target = .{
217 .cpu_arch = .powerpc,
218 .os_tag = .linux,
219 .abi = .none,
220 },
221 },
222 TestTarget{
223 .target = .{
224 .cpu_arch = .powerpc,
225 .os_tag = .linux,
226 .abi = .musl,
227 },
228 .link_libc = true,
229 },
230
215 TestTarget{231 TestTarget{
216 .target = .{232 .target = .{
217 .cpu_arch = .riscv64,233 .cpu_arch = .riscv64,