mirror of
https://github.com/golang/go
synced 2024-11-24 14:20:13 -07:00
syscall: fix NaCl
missing from last CL, sorry R=r CC=golang-dev https://golang.org/cl/2214043
This commit is contained in:
parent
33c4ff0669
commit
950ee18366
@ -16,6 +16,7 @@
|
|||||||
$cmdline = "mksyscall.sh " . join(' ', @ARGV);
|
$cmdline = "mksyscall.sh " . join(' ', @ARGV);
|
||||||
$errors = 0;
|
$errors = 0;
|
||||||
$_32bit = "";
|
$_32bit = "";
|
||||||
|
$nacl = 0;
|
||||||
|
|
||||||
if($ARGV[0] eq "-b32") {
|
if($ARGV[0] eq "-b32") {
|
||||||
$_32bit = "big-endian";
|
$_32bit = "big-endian";
|
||||||
@ -24,6 +25,10 @@ if($ARGV[0] eq "-b32") {
|
|||||||
$_32bit = "little-endian";
|
$_32bit = "little-endian";
|
||||||
shift;
|
shift;
|
||||||
}
|
}
|
||||||
|
if($ARGV[0] eq "-nacl") {
|
||||||
|
$nacl = 1;
|
||||||
|
shift;
|
||||||
|
}
|
||||||
|
|
||||||
if($ARGV[0] =~ /^-/) {
|
if($ARGV[0] =~ /^-/) {
|
||||||
print STDERR "usage: mksyscall.sh [-b32 | -l32] [file ...]\n";
|
print STDERR "usage: mksyscall.sh [-b32 | -l32] [file ...]\n";
|
||||||
@ -89,9 +94,15 @@ while(<>) {
|
|||||||
# Convert slice into pointer, length.
|
# Convert slice into pointer, length.
|
||||||
# Have to be careful not to take address of &a[0] if len == 0:
|
# Have to be careful not to take address of &a[0] if len == 0:
|
||||||
# pass nil in that case.
|
# pass nil in that case.
|
||||||
$text .= "\tvar _p$n *$1\n";
|
$text .= "\tvar _p$n unsafe.Pointer\n";
|
||||||
$text .= "\tif len($name) > 0 {\n\t\t_p$n = \&${name}[0]\n\t}\n";
|
$text .= "\tif len($name) > 0 {\n\t\t_p$n = unsafe.Pointer(\&${name}[0])\n\t}";
|
||||||
push @args, "uintptr(unsafe.Pointer(_p$n))", "uintptr(len($name))";
|
if($nacl) {
|
||||||
|
# NaCl rejects zero length write with nil pointer,
|
||||||
|
# so use non-nil pointer.
|
||||||
|
$text .= " else {\n\t\t_p$n = unsafe.Pointer(&_zero[0])\n\t}";
|
||||||
|
}
|
||||||
|
$text .= "\n";
|
||||||
|
push @args, "uintptr(_p$n)", "uintptr(len($name))";
|
||||||
$n++;
|
$n++;
|
||||||
} elsif($type eq "int64" && $_32bit ne "") {
|
} elsif($type eq "int64" && $_32bit ne "") {
|
||||||
if($_32bit eq "big-endian") {
|
if($_32bit eq "big-endian") {
|
||||||
|
Loading…
Reference in New Issue
Block a user