aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoel Sing <joel@sing.id.au>2021-01-27 01:00:05 +1100
committerJoel Sing <joel@sing.id.au>2021-01-27 12:01:17 +0000
commit5cdf0da1bfc74ad1017a488044a865850f7c3c8e (patch)
tree798514c34e7c5d2f4b9d9876f9364c803f8e97b4
parent210f70e298cf7e45a2b2638545228a44c78740de (diff)
downloadgo-5cdf0da1bfc74ad1017a488044a865850f7c3c8e.tar.gz
go-5cdf0da1bfc74ad1017a488044a865850f7c3c8e.zip
syscall: clean up mkasm related changes
The mkasm_darwin.go file was renamed to mkasm.go in CL 270380, with OpenBSD support being added. The mkasm_openbsd.go file should not have been merged, so remove it. Fix up references to mkasm_$GOOS.go and provide $GOOS as an argument on invocation. Updates #36435 Change-Id: I868d3f2146973d026e6a663d437749dbb6b312ec Reviewed-on: https://go-review.googlesource.com/c/go/+/286812 Trust: Joel Sing <joel@sing.id.au> Reviewed-by: Cherry Zhang <cherryyz@google.com>
-rwxr-xr-xsrc/syscall/mkall.sh8
-rw-r--r--src/syscall/mkasm_openbsd.go58
-rwxr-xr-xsrc/syscall/mksyscall.pl2
3 files changed, 5 insertions, 63 deletions
diff --git a/src/syscall/mkall.sh b/src/syscall/mkall.sh
index 3aaf8c429d..87e5157416 100755
--- a/src/syscall/mkall.sh
+++ b/src/syscall/mkall.sh
@@ -125,13 +125,13 @@ darwin_amd64)
mkerrors="$mkerrors -m64"
mksyscall="./mksyscall.pl -darwin"
mktypes="GOARCH=$GOARCH go tool cgo -godefs"
- mkasm="go run mkasm_darwin.go"
+ mkasm="go run mkasm.go"
;;
darwin_arm64)
mkerrors="$mkerrors -m64"
mksyscall="./mksyscall.pl -darwin"
mktypes="GOARCH=$GOARCH go tool cgo -godefs"
- mkasm="go run mkasm_darwin.go"
+ mkasm="go run mkasm.go"
;;
dragonfly_amd64)
mkerrors="$mkerrors -m64"
@@ -299,7 +299,7 @@ openbsd_amd64)
zsysctl="zsysctl_openbsd.go"
mksysnum="curl -s 'http://cvsweb.openbsd.org/cgi-bin/cvsweb/~checkout~/src/sys/kern/syscalls.master' | ./mksysnum_openbsd.pl"
mktypes="GOARCH=$GOARCH go tool cgo -godefs"
- mkasm="go run mkasm_openbsd.go"
+ mkasm="go run mkasm.go"
;;
openbsd_arm)
GOOSARCH_in="syscall_openbsd1.go syscall_openbsd_$GOARCH.go"
@@ -372,5 +372,5 @@ esac
# Therefore, "go run" tries to recompile syscall package but ztypes is empty and it fails.
echo "$mktypes types_$GOOS.go |go run mkpost.go >ztypes_$GOOSARCH.go.NEW && mv ztypes_$GOOSARCH.go.NEW ztypes_$GOOSARCH.go";
fi
- if [ -n "$mkasm" ]; then echo "$mkasm $GOARCH"; fi
+ if [ -n "$mkasm" ]; then echo "$mkasm $GOOS $GOARCH"; fi
) | $run
diff --git a/src/syscall/mkasm_openbsd.go b/src/syscall/mkasm_openbsd.go
deleted file mode 100644
index 9b938bde8c..0000000000
--- a/src/syscall/mkasm_openbsd.go
+++ /dev/null
@@ -1,58 +0,0 @@
-// Copyright 2020 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build ignore
-
-// mkasm_openbsd.go generates assembly trampolines to call libc routines from Go.
-// This program must be run after mksyscall.pl.
-package main
-
-import (
- "bytes"
- "fmt"
- "io/ioutil"
- "log"
- "os"
- "strings"
-)
-
-func main() {
- in1, err := ioutil.ReadFile("syscall_openbsd.go")
- if err != nil {
- log.Fatalf("can't open syscall_openbsd.go: %s", err)
- }
- arch := os.Args[1]
- in2, err := ioutil.ReadFile(fmt.Sprintf("syscall_openbsd_%s.go", arch))
- if err != nil {
- log.Fatalf("can't open syscall_openbsd_%s.go: %s", arch, err)
- }
- in3, err := ioutil.ReadFile(fmt.Sprintf("zsyscall_openbsd_%s.go", arch))
- if err != nil {
- log.Fatalf("can't open zsyscall_openbsd_%s.go: %s", arch, err)
- }
- in := string(in1) + string(in2) + string(in3)
-
- trampolines := map[string]bool{}
-
- var out bytes.Buffer
-
- fmt.Fprintf(&out, "// go run mkasm_openbsd.go %s\n", strings.Join(os.Args[1:], " "))
- fmt.Fprintf(&out, "// Code generated by the command above; DO NOT EDIT.\n")
- fmt.Fprintf(&out, "#include \"textflag.h\"\n")
- for _, line := range strings.Split(in, "\n") {
- if !strings.HasPrefix(line, "func ") || !strings.HasSuffix(line, "_trampoline()") {
- continue
- }
- fn := line[5 : len(line)-13]
- if !trampolines[fn] {
- trampolines[fn] = true
- fmt.Fprintf(&out, "TEXT ยท%s_trampoline(SB),NOSPLIT,$0-0\n", fn)
- fmt.Fprintf(&out, "\tJMP\t%s(SB)\n", fn)
- }
- }
- err = ioutil.WriteFile(fmt.Sprintf("zsyscall_openbsd_%s.s", arch), out.Bytes(), 0644)
- if err != nil {
- log.Fatalf("can't write zsyscall_openbsd_%s.s: %s", arch, err)
- }
-}
diff --git a/src/syscall/mksyscall.pl b/src/syscall/mksyscall.pl
index fa9e684d0f..67e8d1d99e 100755
--- a/src/syscall/mksyscall.pl
+++ b/src/syscall/mksyscall.pl
@@ -352,7 +352,7 @@ while(<>) {
# The assembly trampoline that jumps to the libc routine.
$text .= "func ${funcname}_trampoline()\n";
# Map syscall.funcname to just plain funcname.
- # (The jump to this function is in the assembly trampoline, generated by mkasm_$GOOS.go.)
+ # (The jump to this function is in the assembly trampoline, generated by mkasm.go.)
$text .= "//go:linkname $funcname $funcname\n";
# Tell the linker that funcname can be found in libSystem using varname without the libc_ prefix.
my $basename = substr $funcname, 5;