mirror of
https://github.com/rwinkhart/sys.git
synced 2026-08-28 04:46:44 -04:00
unix: update generation scripts for arm64/ppc64
This applies the following CLs from the syscall package: http://golang.org/cl/9962 http://golang.org/cl/9966 http://golang.org/cl/9924 It also adds arm64/ppc64 support to mkall.sh and mksysnum_linux.pl. Change-Id: I84fbfde2a2876dbf6d16c6159e847195c274b396 Reviewed-on: https://go-review.googlesource.com/10037 Reviewed-by: Rob Pike <r@golang.org>
This commit is contained in:
+28
-2
@@ -107,6 +107,7 @@ case "$#" in
|
|||||||
exit 2
|
exit 2
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
GOOSARCH_in=syscall_$GOOSARCH.go
|
||||||
case "$GOOSARCH" in
|
case "$GOOSARCH" in
|
||||||
_* | *_ | _)
|
_* | *_ | _)
|
||||||
echo 'undefined $GOOS_$GOARCH:' "$GOOSARCH" 1>&2
|
echo 'undefined $GOOS_$GOARCH:' "$GOOSARCH" 1>&2
|
||||||
@@ -173,7 +174,32 @@ linux_amd64)
|
|||||||
linux_arm)
|
linux_arm)
|
||||||
mkerrors="$mkerrors"
|
mkerrors="$mkerrors"
|
||||||
mksyscall="./mksyscall.pl -l32 -arm"
|
mksyscall="./mksyscall.pl -l32 -arm"
|
||||||
mksysnum="curl -s 'http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/plain/arch/arm/include/uapi/asm/unistd.h' | ./mksysnum_linux.pl"
|
mksysnum="curl -s 'http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/plain/arch/arm/include/uapi/asm/unistd.h' | ./mksysnum_linux.pl -"
|
||||||
|
mktypes="GOARCH=$GOARCH go tool cgo -godefs"
|
||||||
|
;;
|
||||||
|
linux_arm64)
|
||||||
|
unistd_h=$(ls -1 /usr/include/asm/unistd.h /usr/include/asm-generic/unistd.h 2>/dev/null | head -1)
|
||||||
|
if [ "$unistd_h" = "" ]; then
|
||||||
|
echo >&2 cannot find unistd_64.h
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
mksysnum="./mksysnum_linux.pl $unistd_h"
|
||||||
|
# Let the type of C char be singed for making the bare syscall
|
||||||
|
# API consistent across over platforms.
|
||||||
|
mktypes="GOARCH=$GOARCH go tool cgo -godefs -- -fsigned-char"
|
||||||
|
;;
|
||||||
|
linux_ppc64)
|
||||||
|
GOOSARCH_in=syscall_linux_ppc64x.go
|
||||||
|
unistd_h=/usr/include/asm/unistd.h
|
||||||
|
mkerrors="$mkerrors -m64"
|
||||||
|
mksysnum="./mksysnum_linux.pl $unistd_h"
|
||||||
|
mktypes="GOARCH=$GOARCH go tool cgo -godefs"
|
||||||
|
;;
|
||||||
|
linux_ppc64le)
|
||||||
|
GOOSARCH_in=syscall_linux_ppc64x.go
|
||||||
|
unistd_h=/usr/include/powerpc64le-linux-gnu/asm/unistd.h
|
||||||
|
mkerrors="$mkerrors -m64"
|
||||||
|
mksysnum="./mksysnum_linux.pl $unistd_h"
|
||||||
mktypes="GOARCH=$GOARCH go tool cgo -godefs"
|
mktypes="GOARCH=$GOARCH go tool cgo -godefs"
|
||||||
;;
|
;;
|
||||||
netbsd_386)
|
netbsd_386)
|
||||||
@@ -226,7 +252,7 @@ esac
|
|||||||
syscall_goos="syscall_bsd.go $syscall_goos"
|
syscall_goos="syscall_bsd.go $syscall_goos"
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
if [ -n "$mksyscall" ]; then echo "$mksyscall $syscall_goos syscall_$GOOSARCH.go |gofmt >zsyscall_$GOOSARCH.go"; fi
|
if [ -n "$mksyscall" ]; then echo "$mksyscall $syscall_goos $GOOSARCH_in |gofmt >zsyscall_$GOOSARCH.go"; fi
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
if [ -n "$mksysctl" ]; then echo "$mksysctl |gofmt >$zsysctl"; fi
|
if [ -n "$mksysctl" ]; then echo "$mksysctl |gofmt >$zsysctl"; fi
|
||||||
|
|||||||
@@ -88,7 +88,9 @@ includes_FreeBSD='
|
|||||||
includes_Linux='
|
includes_Linux='
|
||||||
#define _LARGEFILE_SOURCE
|
#define _LARGEFILE_SOURCE
|
||||||
#define _LARGEFILE64_SOURCE
|
#define _LARGEFILE64_SOURCE
|
||||||
|
#ifndef __LP64__
|
||||||
#define _FILE_OFFSET_BITS 64
|
#define _FILE_OFFSET_BITS 64
|
||||||
|
#endif
|
||||||
#define _GNU_SOURCE
|
#define _GNU_SOURCE
|
||||||
|
|
||||||
#include <bits/sockaddr.h>
|
#include <bits/sockaddr.h>
|
||||||
|
|||||||
+15
-2
@@ -18,13 +18,26 @@ EOF
|
|||||||
|
|
||||||
sub fmt {
|
sub fmt {
|
||||||
my ($name, $num) = @_;
|
my ($name, $num) = @_;
|
||||||
|
if($num > 999){
|
||||||
|
# ignore deprecated syscalls that are no longer implemented
|
||||||
|
# https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/include/uapi/asm-generic/unistd.h?id=refs/heads/master#n716
|
||||||
|
return;
|
||||||
|
}
|
||||||
$name =~ y/a-z/A-Z/;
|
$name =~ y/a-z/A-Z/;
|
||||||
print " SYS_$name = $num;\n";
|
print " SYS_$name = $num;\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
my $prev;
|
my $prev;
|
||||||
while(<>){
|
open(GCC, "gcc -E -dD $ARGV[0] |") || die "can't run gcc";
|
||||||
if(/^#define __NR_(\w+)\s+([0-9]+)/){
|
while(<GCC>){
|
||||||
|
if(/^#define __NR_syscalls\s+/) {
|
||||||
|
# ignore redefinitions of __NR_syscalls
|
||||||
|
}
|
||||||
|
elsif(/^#define __NR_(\w+)\s+([0-9]+)/){
|
||||||
|
$prev = $2;
|
||||||
|
fmt($1, $2);
|
||||||
|
}
|
||||||
|
elsif(/^#define __NR3264_(\w+)\s+([0-9]+)/){
|
||||||
$prev = $2;
|
$prev = $2;
|
||||||
fmt($1, $2);
|
fmt($1, $2);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user