mirror of
https://github.com/rwinkhart/sys.git
synced 2026-09-05 08:37:31 -04:00
unix: add support for openbsd/ppc64
Updates golang/go#56001 Change-Id: Ic2c7db7a0c2056d3bbc153066c187f27508cb96c Reviewed-on: https://go-review.googlesource.com/c/sys/+/439978 Reviewed-by: Ian Lance Taylor <iant@google.com> Run-TryBot: Joel Sing <joel@sing.id.au> Reviewed-by: Bryan Mills <bcmills@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
This commit is contained in:
+9
-4
@@ -23,7 +23,7 @@ func archPtrSize(arch string) int {
|
||||
switch arch {
|
||||
case "386", "arm":
|
||||
return 4
|
||||
case "amd64", "arm64", "mips64", "riscv64":
|
||||
case "amd64", "arm64", "mips64", "ppc64", "riscv64":
|
||||
return 8
|
||||
default:
|
||||
log.Fatalf("Unknown arch %q", arch)
|
||||
@@ -31,7 +31,7 @@ func archPtrSize(arch string) int {
|
||||
}
|
||||
}
|
||||
|
||||
func generateASMFile(arch string, inFileNames []string, outFileName string) map[string]bool {
|
||||
func generateASMFile(goos, arch string, inFileNames []string, outFileName string) map[string]bool {
|
||||
trampolines := map[string]bool{}
|
||||
var orderedTrampolines []string
|
||||
for _, inFileName := range inFileNames {
|
||||
@@ -62,7 +62,12 @@ func generateASMFile(arch string, inFileNames []string, outFileName string) map[
|
||||
fmt.Fprintf(&out, "#include \"textflag.h\"\n")
|
||||
for _, fn := range orderedTrampolines {
|
||||
fmt.Fprintf(&out, "\nTEXT %s_trampoline<>(SB),NOSPLIT,$0-0\n", fn)
|
||||
fmt.Fprintf(&out, "\tJMP\t%s(SB)\n\n", fn)
|
||||
if goos == "openbsd" && arch == "ppc64" {
|
||||
fmt.Fprintf(&out, "\tCALL\t%s(SB)\n", fn)
|
||||
fmt.Fprintf(&out, "\tRET\n")
|
||||
} else {
|
||||
fmt.Fprintf(&out, "\tJMP\t%s(SB)\n", fn)
|
||||
}
|
||||
fmt.Fprintf(&out, "GLOBL\t·%s_trampoline_addr(SB), RODATA, $%d\n", fn, ptrSize)
|
||||
fmt.Fprintf(&out, "DATA\t·%s_trampoline_addr(SB)/%d, $%s_trampoline<>(SB)\n", fn, ptrSize, fn)
|
||||
}
|
||||
@@ -127,7 +132,7 @@ func main() {
|
||||
zsyscallArchFilename,
|
||||
}
|
||||
|
||||
trampolines := generateASMFile(arch, inFileNames, zsyscallASMFileName)
|
||||
trampolines := generateASMFile(goos, arch, inFileNames, zsyscallASMFileName)
|
||||
|
||||
if goos == "darwin" {
|
||||
writeDarwinTest(trampolines, fmt.Sprintf("darwin_%s_test.go", arch), arch)
|
||||
|
||||
Reference in New Issue
Block a user