1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162 |
- package main
- import (
- "fmt"
- "go/format"
- "io/ioutil"
- "log"
- "os"
- "regexp"
- )
- func main() {
- b, err := ioutil.ReadAll(os.Stdin)
- if err != nil {
- log.Fatal(err)
- }
- s := string(b)
- goarch := os.Getenv("GOARCH")
- goos := os.Getenv("GOOS")
- if goarch == "s390x" && goos == "linux" {
-
- re := regexp.MustCompile("ptrace(Psw|Fpregs|Per)")
- s = re.ReplaceAllString(s, "Ptrace$1")
-
- re = regexp.MustCompile("Pad_cgo[A-Za-z0-9_]*")
- s = re.ReplaceAllString(s, "_")
-
- re = regexp.MustCompile("X_[A-Za-z0-9_]*")
- s = re.ReplaceAllString(s, "_")
-
- re = regexp.MustCompile("(Control_regs)\\s+\\[0\\]uint64")
- s = re.ReplaceAllString(s, "_ [0]uint64")
- }
-
- b, err = format.Source([]byte(s))
- if err != nil {
- log.Fatal(err)
- }
-
-
- re := regexp.MustCompile("(cgo -godefs [a-zA-Z0-9_]+\\.go.*)")
- b = re.ReplaceAll(b, []byte("$1 | go run mkpost.go"))
- fmt.Printf("%s", b)
- }
|