]> Cypherpunks repositories - gostls13.git/commitdiff
syscall: clean up mkasm related changes
authorJoel Sing <joel@sing.id.au>
Tue, 26 Jan 2021 14:00:05 +0000 (01:00 +1100)
committerJoel Sing <joel@sing.id.au>
Wed, 27 Jan 2021 12:01:17 +0000 (12:01 +0000)
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>
src/syscall/mkall.sh
src/syscall/mkasm_openbsd.go [deleted file]
src/syscall/mksyscall.pl

index 3aaf8c429d487ad7bc0e71071b404263af29d523..87e5157416122444c7b9ae21f434886fb29982be 100755 (executable)
@@ -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 (file)
index 9b938bd..0000000
+++ /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)
-       }
-}
index fa9e684d0f56d86ec2c00563ea48f646c92a6754..67e8d1d99efc02c93488dbea947ebd81c2a498a6 100755 (executable)
@@ -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;