authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2019-09-27 14:53:52-04:00
committergravatar for noreply@github.comGitHub <noreply@github.com> 2019-09-27 14:53:52-04:00
log70e934f116f3b889fcee755380a708fdceaaf699
tree87d1d26bd2475bbb492e4361bfeccd62be11aaa3
parent805f9b309bee2d1a6c4fa34f1bc2746a8e60c35f
parent9ad0541f2c06e0eb3419b3da7fe721affa3aa3b5
signaturebadge-question-mark Signed by PGP key 4AEE18F83AFDEB23

Merge pull request #3326 from LemonBoy/misc-misc

Miscellaneous and very small patches regarding mipsel and musl libc

4 files changed, 44 insertions(+), 26 deletions(-)

lib/libc/musl/src/setjmp/mips/longjmp.S+6-12
...@@ -12,18 +12,12 @@ longjmp:...@@ -12,18 +12,12 @@ longjmp:
12 addu $2, $2, 112 addu $2, $2, 1
131:131:
14#ifndef __mips_soft_float14#ifndef __mips_soft_float
15 lwc1 $20, 56($4)15 l.d $f20, 56($4)
16 lwc1 $21, 60($4)16 l.d $f22, 64($4)
17 lwc1 $22, 64($4)17 l.d $f24, 72($4)
18 lwc1 $23, 68($4)18 l.d $f26, 80($4)
19 lwc1 $24, 72($4)19 l.d $f28, 88($4)
20 lwc1 $25, 76($4)20 l.d $f30, 96($4)
21 lwc1 $26, 80($4)
22 lwc1 $27, 84($4)
23 lwc1 $28, 88($4)
24 lwc1 $29, 92($4)
25 lwc1 $30, 96($4)
26 lwc1 $31, 100($4)
27#endif21#endif
28 lw $ra, 0($4)22 lw $ra, 0($4)
29 lw $sp, 4($4)23 lw $sp, 4($4)
lib/libc/musl/src/setjmp/mips/setjmp.S+6-12
...@@ -22,18 +22,12 @@ setjmp:...@@ -22,18 +22,12 @@ setjmp:
22 sw $30, 40($4)22 sw $30, 40($4)
23 sw $28, 44($4)23 sw $28, 44($4)
24#ifndef __mips_soft_float24#ifndef __mips_soft_float
25 swc1 $20, 56($4)25 s.d $f20, 56($4)
26 swc1 $21, 60($4)26 s.d $f22, 64($4)
27 swc1 $22, 64($4)27 s.d $f24, 72($4)
28 swc1 $23, 68($4)28 s.d $f26, 80($4)
29 swc1 $24, 72($4)29 s.d $f28, 88($4)
30 swc1 $25, 76($4)30 s.d $f30, 96($4)
31 swc1 $26, 80($4)
32 swc1 $27, 84($4)
33 swc1 $28, 88($4)
34 swc1 $29, 92($4)
35 swc1 $30, 96($4)
36 swc1 $31, 100($4)
37#endif31#endif
38 jr $ra32 jr $ra
39 li $2, 033 li $2, 0
lib/std/os/linux.zig+22-2
...@@ -193,9 +193,29 @@ pub fn umount2(special: [*]const u8, flags: u32) usize {...@@ -193,9 +193,29 @@ pub fn umount2(special: [*]const u8, flags: u32) usize {
193193
194pub fn mmap(address: ?[*]u8, length: usize, prot: usize, flags: u32, fd: i32, offset: u64) usize {194pub fn mmap(address: ?[*]u8, length: usize, prot: usize, flags: u32, fd: i32, offset: u64) usize {
195 if (@hasDecl(@This(), "SYS_mmap2")) {195 if (@hasDecl(@This(), "SYS_mmap2")) {
196 return syscall6(SYS_mmap2, @ptrToInt(address), length, prot, flags, @bitCast(usize, isize(fd)), @truncate(usize, offset / MMAP2_UNIT));196 // Make sure the offset is also specified in multiples of page size
197 if ((offset & (MMAP2_UNIT - 1)) != 0)
198 return @bitCast(usize, isize(-EINVAL));
199
200 return syscall6(
201 SYS_mmap2,
202 @ptrToInt(address),
203 length,
204 prot,
205 flags,
206 @bitCast(usize, isize(fd)),
207 @truncate(usize, offset / MMAP2_UNIT),
208 );
197 } else {209 } else {
198 return syscall6(SYS_mmap, @ptrToInt(address), length, prot, flags, @bitCast(usize, isize(fd)), offset);210 return syscall6(
211 SYS_mmap,
212 @ptrToInt(address),
213 length,
214 prot,
215 flags,
216 @bitCast(usize, isize(fd)),
217 offset,
218 );
199 }219 }
200}220}
201221
test/tests.zig+10
...@@ -140,6 +140,16 @@ const test_targets = [_]TestTarget{...@@ -140,6 +140,16 @@ const test_targets = [_]TestTarget{
140 },140 },
141 },141 },
142 },142 },
143 TestTarget{
144 .target = Target{
145 .Cross = CrossTarget{
146 .os = .linux,
147 .arch = .mipsel,
148 .abi = .musl,
149 },
150 },
151 .link_libc = true,
152 },
143153
144 TestTarget{154 TestTarget{
145 .target = Target{155 .target = Target{