unix/linux: run each mkall.go target in a seperate goroutine
Each target within mkall.go is now within a seperate goroutine,
except for making headers which have artifacts in their respective
folders that overlap and conflict during their make target.
Fixes golang/go#54009
Change-Id: I04dad7ffdb772029e62a34a1197577c718b533e1
Reviewed-on: https://go-review.googlesource.com/c/sys/+/419517
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>
diff --git a/unix/linux/mkall.go b/unix/linux/mkall.go
index ef49c5d..8c773d9 100644
--- a/unix/linux/mkall.go
+++ b/unix/linux/mkall.go
@@ -30,6 +30,7 @@
"path/filepath"
"runtime"
"strings"
+ "sync"
"unicode"
)
@@ -38,8 +39,6 @@
var GlibcDir string
const TempDir = "/tmp"
-const IncludeDir = TempDir + "/include" // To hold our C headers
-const BuildDir = TempDir + "/build" // To hold intermediate build files
const GOOS = "linux" // Only for Linux targets
const BuildArch = "amd64" // Must be built on this architecture
@@ -52,6 +51,9 @@
BigEndian bool // Default Little Endian
SignedChar bool // Is -fsigned-char needed (default no)
Bits int
+ env []string
+ stderrBuf bytes.Buffer
+ compiler string
}
// List of all Linux targets supported by the go compiler. Currently, sparc64 is
@@ -193,14 +195,38 @@
LinuxDir = os.Args[1]
GlibcDir = os.Args[2]
+ wg := sync.WaitGroup{}
for _, t := range targets {
- fmt.Printf("----- GENERATING: %s -----\n", t.GoArch)
- if err := t.generateFiles(); err != nil {
- fmt.Printf("%v\n***** FAILURE: %s *****\n\n", err, t.GoArch)
- } else {
- fmt.Printf("----- SUCCESS: %s -----\n\n", t.GoArch)
+ fmt.Printf("arch %s: GENERATING\n", t.GoArch)
+ if err := t.setupEnvironment(); err != nil {
+ fmt.Printf("arch %s: could not setup environment: %v\n", t.GoArch, err)
+ break
}
+ includeDir := filepath.Join(TempDir, t.GoArch, "include")
+ // Make the include directory and fill it with headers
+ if err := os.MkdirAll(includeDir, os.ModePerm); err != nil {
+ fmt.Printf("arch %s: could not make directory: %v\n", t.GoArch, err)
+ break
+ }
+ // During header generation "/git/linux/scripts/basic/fixdep" is created by "basic/Makefile" for each
+ // instance of "make headers_install". This leads to a "text file is busy" error from any running
+ // "make headers_install" after the first one's target. Workaround is to serialize header generation
+ if err := t.makeHeaders(); err != nil {
+ fmt.Printf("arch %s: could not make header files: %v\n", t.GoArch, err)
+ break
+ }
+ wg.Add(1)
+ go func(t target) {
+ defer wg.Done()
+ fmt.Printf("arch %s: header files generated\n", t.GoArch)
+ if err := t.generateFiles(); err != nil {
+ fmt.Printf("%v\n***** FAILURE: %s *****\n\n", err, t.GoArch)
+ } else {
+ fmt.Printf("arch %s: SUCCESS\n", t.GoArch)
+ }
+ }(t)
}
+ wg.Wait()
fmt.Printf("----- GENERATING: merging generated files -----\n")
if err := mergeFiles(); err != nil {
@@ -227,17 +253,29 @@
}
}
-// Makes an exec.Cmd with Stderr attached to os.Stderr
-func makeCommand(name string, args ...string) *exec.Cmd {
+func (t *target) printAndResetBuilder() {
+ if t.stderrBuf.Len() > 0 {
+ for _, l := range bytes.Split(t.stderrBuf.Bytes(), []byte{'\n'}) {
+ fmt.Printf("arch %s: stderr: %s\n", t.GoArch, l)
+ }
+ t.stderrBuf.Reset()
+ }
+}
+
+// Makes an exec.Cmd with Stderr attached to the target string Builder, and target environment
+func (t *target) makeCommand(name string, args ...string) *exec.Cmd {
cmd := exec.Command(name, args...)
- cmd.Stderr = os.Stderr
+ cmd.Env = t.env
+ cmd.Stderr = &t.stderrBuf
return cmd
}
// Set GOARCH for target and build environments.
func (t *target) setTargetBuildArch(cmd *exec.Cmd) {
// Set GOARCH_TARGET so command knows what GOARCH is..
- cmd.Env = append(os.Environ(), "GOARCH_TARGET="+t.GoArch)
+ var env []string
+ env = append(env, t.env...)
+ cmd.Env = append(env, "GOARCH_TARGET="+t.GoArch)
// Set GOARCH to host arch for command, so it can run natively.
for i, s := range cmd.Env {
if strings.HasPrefix(s, "GOARCH=") {
@@ -249,23 +287,31 @@
// Runs the command, pipes output to a formatter, pipes that to an output file.
func (t *target) commandFormatOutput(formatter string, outputFile string,
name string, args ...string) (err error) {
- mainCmd := makeCommand(name, args...)
+ mainCmd := t.makeCommand(name, args...)
if name == "mksyscall" {
args = append([]string{"run", "mksyscall.go"}, args...)
- mainCmd = makeCommand("go", args...)
+ mainCmd = t.makeCommand("go", args...)
t.setTargetBuildArch(mainCmd)
} else if name == "mksysnum" {
args = append([]string{"run", "linux/mksysnum.go"}, args...)
- mainCmd = makeCommand("go", args...)
+ mainCmd = t.makeCommand("go", args...)
t.setTargetBuildArch(mainCmd)
}
- fmtCmd := makeCommand(formatter)
+ fmtCmd := t.makeCommand(formatter)
if formatter == "mkpost" {
- fmtCmd = makeCommand("go", "run", "mkpost.go")
+ fmtCmd = t.makeCommand("go", "run", "mkpost.go")
t.setTargetBuildArch(fmtCmd)
+ } else if formatter == "gofmt2" {
+ fmtCmd = t.makeCommand("gofmt")
+ mainCmd.Dir = filepath.Join(TempDir, t.GoArch, "mkerrors")
+ if err = os.MkdirAll(mainCmd.Dir, os.ModePerm); err != nil {
+ return err
+ }
}
+ defer t.printAndResetBuilder()
+
// mainCmd | fmtCmd > outputFile
if fmtCmd.Stdin, err = mainCmd.StdoutPipe(); err != nil {
return
@@ -288,20 +334,19 @@
return mainCmd.Run()
}
-// Generates all the files for a Linux target
-func (t *target) generateFiles() error {
+func (t *target) setupEnvironment() error {
// Setup environment variables
- os.Setenv("GOOS", GOOS)
- os.Setenv("GOARCH", t.GoArch)
+ t.env = append(os.Environ(), fmt.Sprintf("%s=%s", "GOOS", GOOS))
+ t.env = append(t.env, fmt.Sprintf("%s=%s", "GOARCH", t.GoArch))
// Get appropriate compiler and emulator (unless on x86)
if t.LinuxArch != "x86" {
// Check/Setup cross compiler
- compiler := t.GNUArch + "-gcc"
- if _, err := exec.LookPath(compiler); err != nil {
+ t.compiler = t.GNUArch + "-gcc"
+ if _, err := exec.LookPath(t.compiler); err != nil {
return err
}
- os.Setenv("CC", compiler)
+ t.env = append(t.env, fmt.Sprintf("%s=%s", "CC", t.compiler))
// Check/Setup emulator (usually first component of GNUArch)
qemuArchName := t.GNUArch[:strings.Index(t.GNUArch, "-")]
@@ -310,76 +355,74 @@
}
// Fake uname for QEMU to allow running on Host kernel version < 4.15
if t.LinuxArch == "riscv" {
- os.Setenv("QEMU_UNAME", "4.15")
+ t.env = append(t.env, fmt.Sprintf("%s=%s", "QEMU_UNAME", "4.15"))
}
- os.Setenv("GORUN", "qemu-"+qemuArchName)
+ t.env = append(t.env, fmt.Sprintf("%s=%s", "GORUN", "qemu-"+qemuArchName))
} else {
- os.Setenv("CC", "gcc")
+ t.compiler = "gcc"
+ t.env = append(t.env, fmt.Sprintf("%s=%s", "CC", "gcc"))
}
+ return nil
+}
- // Make the include directory and fill it with headers
- if err := os.MkdirAll(IncludeDir, os.ModePerm); err != nil {
- return err
- }
- defer os.RemoveAll(IncludeDir)
- if err := t.makeHeaders(); err != nil {
- return fmt.Errorf("could not make header files: %v", err)
- }
- fmt.Println("header files generated")
-
+// Generates all the files for a Linux target
+func (t *target) generateFiles() error {
// Make each of the four files
if err := t.makeZSysnumFile(); err != nil {
return fmt.Errorf("could not make zsysnum file: %v", err)
}
- fmt.Println("zsysnum file generated")
+ fmt.Printf("arch %s: zsysnum file generated\n", t.GoArch)
if err := t.makeZSyscallFile(); err != nil {
return fmt.Errorf("could not make zsyscall file: %v", err)
}
- fmt.Println("zsyscall file generated")
+ fmt.Printf("arch %s: zsyscall file generated\n", t.GoArch)
if err := t.makeZTypesFile(); err != nil {
return fmt.Errorf("could not make ztypes file: %v", err)
}
- fmt.Println("ztypes file generated")
+ fmt.Printf("arch %s: ztypes file generated\n", t.GoArch)
if err := t.makeZErrorsFile(); err != nil {
return fmt.Errorf("could not make zerrors file: %v", err)
}
- fmt.Println("zerrors file generated")
+ fmt.Printf("arch %s: zerrors file generated\n", t.GoArch)
return nil
}
// Create the Linux, glibc and ABI (C compiler convention) headers in the include directory.
func (t *target) makeHeaders() error {
+ defer t.printAndResetBuilder()
+
// Make the Linux headers we need for this architecture
- linuxMake := makeCommand("make", "headers_install", "ARCH="+t.LinuxArch, "INSTALL_HDR_PATH="+TempDir)
+ linuxMake := t.makeCommand("make", "headers_install", "ARCH="+t.LinuxArch, "INSTALL_HDR_PATH="+filepath.Join(TempDir, t.GoArch))
linuxMake.Dir = LinuxDir
if err := linuxMake.Run(); err != nil {
return err
}
+ buildDir := filepath.Join(TempDir, t.GoArch, "build")
// A Temporary build directory for glibc
- if err := os.MkdirAll(BuildDir, os.ModePerm); err != nil {
+ if err := os.MkdirAll(buildDir, os.ModePerm); err != nil {
return err
}
- defer os.RemoveAll(BuildDir)
+ defer os.RemoveAll(buildDir)
// Make the glibc headers we need for this architecture
confScript := filepath.Join(GlibcDir, "configure")
- glibcConf := makeCommand(confScript, "--prefix="+TempDir, "--host="+t.GNUArch, "--enable-kernel="+MinKernel)
- glibcConf.Dir = BuildDir
+ glibcConf := t.makeCommand(confScript, "--prefix="+filepath.Join(TempDir, t.GoArch), "--host="+t.GNUArch, "--enable-kernel="+MinKernel)
+ glibcConf.Dir = buildDir
if err := glibcConf.Run(); err != nil {
return err
}
- glibcMake := makeCommand("make", "install-headers")
- glibcMake.Dir = BuildDir
+ glibcMake := t.makeCommand("make", "install-headers")
+ glibcMake.Dir = buildDir
if err := glibcMake.Run(); err != nil {
return err
}
// We only need an empty stubs file
- stubsFile := filepath.Join(IncludeDir, "gnu/stubs.h")
+ stubsFile := filepath.Join(TempDir, t.GoArch, "include", "gnu", "stubs.h")
if file, err := os.Create(stubsFile); err != nil {
return err
} else {
@@ -396,19 +439,18 @@
//
// We generate C headers instead of a Go file, so as to enable references to the ABI from Cgo.
func (t *target) makeABIHeaders() (err error) {
- abiDir := filepath.Join(IncludeDir, "abi")
+ abiDir := filepath.Join(TempDir, t.GoArch, "include", "abi")
if err = os.Mkdir(abiDir, os.ModePerm); err != nil {
return err
}
- cc := os.Getenv("CC")
- if cc == "" {
+ if t.compiler == "" {
return errors.New("CC (compiler) env var not set")
}
// Build a sacrificial ELF file, to mine for C compiler behavior.
- binPath := filepath.Join(TempDir, "tmp_abi.o")
- bin, err := t.buildELF(cc, cCode, binPath)
+ binPath := filepath.Join(TempDir, t.GoArch, "tmp_abi.o")
+ bin, err := t.buildELF(t.compiler, cCode, binPath)
if err != nil {
return fmt.Errorf("cannot build ELF to analyze: %v", err)
}
@@ -436,9 +478,10 @@
func (t *target) buildELF(cc, src, path string) (*elf.File, error) {
// Compile the cCode source using the set compiler - we will need its .data section.
// Do not link the binary, so that we can find .data section offsets from the symbol values.
- ccCmd := makeCommand(cc, "-o", path, "-gdwarf", "-x", "c", "-c", "-")
+ ccCmd := t.makeCommand(cc, "-o", path, "-gdwarf", "-x", "c", "-c", "-")
ccCmd.Stdin = strings.NewReader(src)
ccCmd.Stdout = os.Stdout
+ defer t.printAndResetBuilder()
if err := ccCmd.Run(); err != nil {
return nil, fmt.Errorf("compiler error: %v", err)
}
@@ -500,7 +543,7 @@
// makes the zsysnum_linux_$GOARCH.go file
func (t *target) makeZSysnumFile() error {
zsysnumFile := fmt.Sprintf("zsysnum_linux_%s.go", t.GoArch)
- unistdFile := filepath.Join(IncludeDir, "asm/unistd.h")
+ unistdFile := filepath.Join(TempDir, t.GoArch, "include", "asm", "unistd.h")
args := append(t.cFlags(), unistdFile)
return t.commandFormatOutput("gofmt", zsysnumFile, "mksysnum", args...)
@@ -606,15 +649,19 @@
// makes the zerrors_linux_$GOARCH.go file
func (t *target) makeZErrorsFile() error {
zerrorsFile := fmt.Sprintf("zerrors_linux_%s.go", t.GoArch)
-
- return t.commandFormatOutput("gofmt", zerrorsFile, "./mkerrors.sh", t.cFlags()...)
+ return t.commandFormatOutput("gofmt2", zerrorsFile, "/"+filepath.Join("build", "unix", "mkerrors.sh"), t.cFlags()...)
}
// makes the ztypes_linux_$GOARCH.go file
func (t *target) makeZTypesFile() error {
ztypesFile := fmt.Sprintf("ztypes_linux_%s.go", t.GoArch)
- args := []string{"tool", "cgo", "-godefs", "--"}
+ cgoDir := filepath.Join(TempDir, t.GoArch, "cgo")
+ if err := os.MkdirAll(cgoDir, os.ModePerm); err != nil {
+ return err
+ }
+
+ args := []string{"tool", "cgo", "-godefs", "-objdir=" + cgoDir, "--"}
args = append(args, t.cFlags()...)
args = append(args, "linux/types.go")
return t.commandFormatOutput("mkpost", ztypesFile, "go", args...)
@@ -623,7 +670,7 @@
// Flags that should be given to gcc and cgo for this target
func (t *target) cFlags() []string {
// Compile statically to avoid cross-architecture dynamic linking.
- flags := []string{"-Wall", "-Werror", "-static", "-I" + IncludeDir}
+ flags := []string{"-Wall", "-Werror", "-static", "-I" + filepath.Join(TempDir, t.GoArch, "include")}
// Architecture-specific flags
if t.SignedChar {
@@ -661,7 +708,8 @@
// Merge each of the four type of files
for _, ztyp := range []string{"zerrors", "zsyscall", "zsysnum", "ztypes"} {
- cmd := makeCommand("go", "run", "./internal/mkmerge", "-out", fmt.Sprintf("%s_%s.go", ztyp, GOOS), fmt.Sprintf("%s_%s_*.go", ztyp, GOOS))
+ cmd := exec.Command("go", "run", "./internal/mkmerge", "-out", fmt.Sprintf("%s_%s.go", ztyp, GOOS), fmt.Sprintf("%s_%s_*.go", ztyp, GOOS))
+ cmd.Stderr = os.Stderr
err := cmd.Run()
if err != nil {
return fmt.Errorf("could not merge %s files: %w", ztyp, err)
diff --git a/unix/zerrors_linux_386.go b/unix/zerrors_linux_386.go
index 274e2da..36c0dfc 100644
--- a/unix/zerrors_linux_386.go
+++ b/unix/zerrors_linux_386.go
@@ -1,11 +1,11 @@
-// mkerrors.sh -Wall -Werror -static -I/tmp/include -m32
+// mkerrors.sh -Wall -Werror -static -I/tmp/386/include -m32
// Code generated by the command above; see README.md. DO NOT EDIT.
//go:build 386 && linux
// +build 386,linux
// Code generated by cmd/cgo -godefs; DO NOT EDIT.
-// cgo -godefs -- -Wall -Werror -static -I/tmp/include -m32 _const.go
+// cgo -godefs -- -Wall -Werror -static -I/tmp/386/include -m32 _const.go
package unix
diff --git a/unix/zerrors_linux_amd64.go b/unix/zerrors_linux_amd64.go
index 95b6eee..4ff9427 100644
--- a/unix/zerrors_linux_amd64.go
+++ b/unix/zerrors_linux_amd64.go
@@ -1,11 +1,11 @@
-// mkerrors.sh -Wall -Werror -static -I/tmp/include -m64
+// mkerrors.sh -Wall -Werror -static -I/tmp/amd64/include -m64
// Code generated by the command above; see README.md. DO NOT EDIT.
//go:build amd64 && linux
// +build amd64,linux
// Code generated by cmd/cgo -godefs; DO NOT EDIT.
-// cgo -godefs -- -Wall -Werror -static -I/tmp/include -m64 _const.go
+// cgo -godefs -- -Wall -Werror -static -I/tmp/amd64/include -m64 _const.go
package unix
diff --git a/unix/zerrors_linux_arm.go b/unix/zerrors_linux_arm.go
index 918cd13..3eaa0fb 100644
--- a/unix/zerrors_linux_arm.go
+++ b/unix/zerrors_linux_arm.go
@@ -1,11 +1,11 @@
-// mkerrors.sh -Wall -Werror -static -I/tmp/include
+// mkerrors.sh -Wall -Werror -static -I/tmp/arm/include
// Code generated by the command above; see README.md. DO NOT EDIT.
//go:build arm && linux
// +build arm,linux
// Code generated by cmd/cgo -godefs; DO NOT EDIT.
-// cgo -godefs -- -Wall -Werror -static -I/tmp/include _const.go
+// cgo -godefs -- -Wall -Werror -static -I/tmp/arm/include _const.go
package unix
diff --git a/unix/zerrors_linux_arm64.go b/unix/zerrors_linux_arm64.go
index 3907dc5..d7995bd 100644
--- a/unix/zerrors_linux_arm64.go
+++ b/unix/zerrors_linux_arm64.go
@@ -1,11 +1,11 @@
-// mkerrors.sh -Wall -Werror -static -I/tmp/include -fsigned-char
+// mkerrors.sh -Wall -Werror -static -I/tmp/arm64/include -fsigned-char
// Code generated by the command above; see README.md. DO NOT EDIT.
//go:build arm64 && linux
// +build arm64,linux
// Code generated by cmd/cgo -godefs; DO NOT EDIT.
-// cgo -godefs -- -Wall -Werror -static -I/tmp/include -fsigned-char _const.go
+// cgo -godefs -- -Wall -Werror -static -I/tmp/arm64/include -fsigned-char _const.go
package unix
diff --git a/unix/zerrors_linux_loong64.go b/unix/zerrors_linux_loong64.go
index 03d5c10..928e24c 100644
--- a/unix/zerrors_linux_loong64.go
+++ b/unix/zerrors_linux_loong64.go
@@ -1,11 +1,11 @@
-// mkerrors.sh -Wall -Werror -static -I/tmp/include
+// mkerrors.sh -Wall -Werror -static -I/tmp/loong64/include
// Code generated by the command above; see README.md. DO NOT EDIT.
//go:build loong64 && linux
// +build loong64,linux
// Code generated by cmd/cgo -godefs; DO NOT EDIT.
-// cgo -godefs -- -Wall -Werror -static -I/tmp/include _const.go
+// cgo -godefs -- -Wall -Werror -static -I/tmp/loong64/include _const.go
package unix
diff --git a/unix/zerrors_linux_mips.go b/unix/zerrors_linux_mips.go
index bd794e0..179bffb 100644
--- a/unix/zerrors_linux_mips.go
+++ b/unix/zerrors_linux_mips.go
@@ -1,11 +1,11 @@
-// mkerrors.sh -Wall -Werror -static -I/tmp/include
+// mkerrors.sh -Wall -Werror -static -I/tmp/mips/include
// Code generated by the command above; see README.md. DO NOT EDIT.
//go:build mips && linux
// +build mips,linux
// Code generated by cmd/cgo -godefs; DO NOT EDIT.
-// cgo -godefs -- -Wall -Werror -static -I/tmp/include _const.go
+// cgo -godefs -- -Wall -Werror -static -I/tmp/mips/include _const.go
package unix
diff --git a/unix/zerrors_linux_mips64.go b/unix/zerrors_linux_mips64.go
index 6c741b0..1fba17b 100644
--- a/unix/zerrors_linux_mips64.go
+++ b/unix/zerrors_linux_mips64.go
@@ -1,11 +1,11 @@
-// mkerrors.sh -Wall -Werror -static -I/tmp/include
+// mkerrors.sh -Wall -Werror -static -I/tmp/mips64/include
// Code generated by the command above; see README.md. DO NOT EDIT.
//go:build mips64 && linux
// +build mips64,linux
// Code generated by cmd/cgo -godefs; DO NOT EDIT.
-// cgo -godefs -- -Wall -Werror -static -I/tmp/include _const.go
+// cgo -godefs -- -Wall -Werror -static -I/tmp/mips64/include _const.go
package unix
diff --git a/unix/zerrors_linux_mips64le.go b/unix/zerrors_linux_mips64le.go
index 807b8cd..b77dde3 100644
--- a/unix/zerrors_linux_mips64le.go
+++ b/unix/zerrors_linux_mips64le.go
@@ -1,11 +1,11 @@
-// mkerrors.sh -Wall -Werror -static -I/tmp/include
+// mkerrors.sh -Wall -Werror -static -I/tmp/mips64le/include
// Code generated by the command above; see README.md. DO NOT EDIT.
//go:build mips64le && linux
// +build mips64le,linux
// Code generated by cmd/cgo -godefs; DO NOT EDIT.
-// cgo -godefs -- -Wall -Werror -static -I/tmp/include _const.go
+// cgo -godefs -- -Wall -Werror -static -I/tmp/mips64le/include _const.go
package unix
diff --git a/unix/zerrors_linux_mipsle.go b/unix/zerrors_linux_mipsle.go
index a39e4f5..78c6c75 100644
--- a/unix/zerrors_linux_mipsle.go
+++ b/unix/zerrors_linux_mipsle.go
@@ -1,11 +1,11 @@
-// mkerrors.sh -Wall -Werror -static -I/tmp/include
+// mkerrors.sh -Wall -Werror -static -I/tmp/mipsle/include
// Code generated by the command above; see README.md. DO NOT EDIT.
//go:build mipsle && linux
// +build mipsle,linux
// Code generated by cmd/cgo -godefs; DO NOT EDIT.
-// cgo -godefs -- -Wall -Werror -static -I/tmp/include _const.go
+// cgo -godefs -- -Wall -Werror -static -I/tmp/mipsle/include _const.go
package unix
diff --git a/unix/zerrors_linux_ppc.go b/unix/zerrors_linux_ppc.go
index c0fcda8..1c0d31f 100644
--- a/unix/zerrors_linux_ppc.go
+++ b/unix/zerrors_linux_ppc.go
@@ -1,11 +1,11 @@
-// mkerrors.sh -Wall -Werror -static -I/tmp/include
+// mkerrors.sh -Wall -Werror -static -I/tmp/ppc/include
// Code generated by the command above; see README.md. DO NOT EDIT.
//go:build ppc && linux
// +build ppc,linux
// Code generated by cmd/cgo -godefs; DO NOT EDIT.
-// cgo -godefs -- -Wall -Werror -static -I/tmp/include _const.go
+// cgo -godefs -- -Wall -Werror -static -I/tmp/ppc/include _const.go
package unix
diff --git a/unix/zerrors_linux_ppc64.go b/unix/zerrors_linux_ppc64.go
index f3b7240..959dd9b 100644
--- a/unix/zerrors_linux_ppc64.go
+++ b/unix/zerrors_linux_ppc64.go
@@ -1,11 +1,11 @@
-// mkerrors.sh -Wall -Werror -static -I/tmp/include
+// mkerrors.sh -Wall -Werror -static -I/tmp/ppc64/include
// Code generated by the command above; see README.md. DO NOT EDIT.
//go:build ppc64 && linux
// +build ppc64,linux
// Code generated by cmd/cgo -godefs; DO NOT EDIT.
-// cgo -godefs -- -Wall -Werror -static -I/tmp/include _const.go
+// cgo -godefs -- -Wall -Werror -static -I/tmp/ppc64/include _const.go
package unix
diff --git a/unix/zerrors_linux_ppc64le.go b/unix/zerrors_linux_ppc64le.go
index 72f2a45..5a873cd 100644
--- a/unix/zerrors_linux_ppc64le.go
+++ b/unix/zerrors_linux_ppc64le.go
@@ -1,11 +1,11 @@
-// mkerrors.sh -Wall -Werror -static -I/tmp/include
+// mkerrors.sh -Wall -Werror -static -I/tmp/ppc64le/include
// Code generated by the command above; see README.md. DO NOT EDIT.
//go:build ppc64le && linux
// +build ppc64le,linux
// Code generated by cmd/cgo -godefs; DO NOT EDIT.
-// cgo -godefs -- -Wall -Werror -static -I/tmp/include _const.go
+// cgo -godefs -- -Wall -Werror -static -I/tmp/ppc64le/include _const.go
package unix
diff --git a/unix/zerrors_linux_riscv64.go b/unix/zerrors_linux_riscv64.go
index 45b214b..e336d14 100644
--- a/unix/zerrors_linux_riscv64.go
+++ b/unix/zerrors_linux_riscv64.go
@@ -1,11 +1,11 @@
-// mkerrors.sh -Wall -Werror -static -I/tmp/include
+// mkerrors.sh -Wall -Werror -static -I/tmp/riscv64/include
// Code generated by the command above; see README.md. DO NOT EDIT.
//go:build riscv64 && linux
// +build riscv64,linux
// Code generated by cmd/cgo -godefs; DO NOT EDIT.
-// cgo -godefs -- -Wall -Werror -static -I/tmp/include _const.go
+// cgo -godefs -- -Wall -Werror -static -I/tmp/riscv64/include _const.go
package unix
diff --git a/unix/zerrors_linux_s390x.go b/unix/zerrors_linux_s390x.go
index 1897f20..390c01d 100644
--- a/unix/zerrors_linux_s390x.go
+++ b/unix/zerrors_linux_s390x.go
@@ -1,11 +1,11 @@
-// mkerrors.sh -Wall -Werror -static -I/tmp/include -fsigned-char
+// mkerrors.sh -Wall -Werror -static -I/tmp/s390x/include -fsigned-char
// Code generated by the command above; see README.md. DO NOT EDIT.
//go:build s390x && linux
// +build s390x,linux
// Code generated by cmd/cgo -godefs; DO NOT EDIT.
-// cgo -godefs -- -Wall -Werror -static -I/tmp/include -fsigned-char _const.go
+// cgo -godefs -- -Wall -Werror -static -I/tmp/s390x/include -fsigned-char _const.go
package unix
diff --git a/unix/zerrors_linux_sparc64.go b/unix/zerrors_linux_sparc64.go
index 1fb7a39..98a6e5f 100644
--- a/unix/zerrors_linux_sparc64.go
+++ b/unix/zerrors_linux_sparc64.go
@@ -1,11 +1,11 @@
-// mkerrors.sh -Wall -Werror -static -I/tmp/include
+// mkerrors.sh -Wall -Werror -static -I/tmp/sparc64/include
// Code generated by the command above; see README.md. DO NOT EDIT.
//go:build sparc64 && linux
// +build sparc64,linux
// Code generated by cmd/cgo -godefs; DO NOT EDIT.
-// cgo -godefs -- -Wall -Werror -static -I/tmp/include _const.go
+// cgo -godefs -- -Wall -Werror -static -I/tmp/sparc64/include _const.go
package unix
diff --git a/unix/zsysnum_linux_386.go b/unix/zsysnum_linux_386.go
index 62192e1..c9c4ad0 100644
--- a/unix/zsysnum_linux_386.go
+++ b/unix/zsysnum_linux_386.go
@@ -1,4 +1,4 @@
-// go run linux/mksysnum.go -Wall -Werror -static -I/tmp/include -m32 /tmp/include/asm/unistd.h
+// go run linux/mksysnum.go -Wall -Werror -static -I/tmp/386/include -m32 /tmp/386/include/asm/unistd.h
// Code generated by the command above; see README.md. DO NOT EDIT.
//go:build 386 && linux
diff --git a/unix/zsysnum_linux_amd64.go b/unix/zsysnum_linux_amd64.go
index 490aab5..12ff341 100644
--- a/unix/zsysnum_linux_amd64.go
+++ b/unix/zsysnum_linux_amd64.go
@@ -1,4 +1,4 @@
-// go run linux/mksysnum.go -Wall -Werror -static -I/tmp/include -m64 /tmp/include/asm/unistd.h
+// go run linux/mksysnum.go -Wall -Werror -static -I/tmp/amd64/include -m64 /tmp/amd64/include/asm/unistd.h
// Code generated by the command above; see README.md. DO NOT EDIT.
//go:build amd64 && linux
diff --git a/unix/zsysnum_linux_arm.go b/unix/zsysnum_linux_arm.go
index aca17b6..c3fb5e7 100644
--- a/unix/zsysnum_linux_arm.go
+++ b/unix/zsysnum_linux_arm.go
@@ -1,4 +1,4 @@
-// go run linux/mksysnum.go -Wall -Werror -static -I/tmp/include /tmp/include/asm/unistd.h
+// go run linux/mksysnum.go -Wall -Werror -static -I/tmp/arm/include /tmp/arm/include/asm/unistd.h
// Code generated by the command above; see README.md. DO NOT EDIT.
//go:build arm && linux
diff --git a/unix/zsysnum_linux_arm64.go b/unix/zsysnum_linux_arm64.go
index 54b4dfa..358c847 100644
--- a/unix/zsysnum_linux_arm64.go
+++ b/unix/zsysnum_linux_arm64.go
@@ -1,4 +1,4 @@
-// go run linux/mksysnum.go -Wall -Werror -static -I/tmp/include -fsigned-char /tmp/include/asm/unistd.h
+// go run linux/mksysnum.go -Wall -Werror -static -I/tmp/arm64/include -fsigned-char /tmp/arm64/include/asm/unistd.h
// Code generated by the command above; see README.md. DO NOT EDIT.
//go:build arm64 && linux
diff --git a/unix/zsysnum_linux_loong64.go b/unix/zsysnum_linux_loong64.go
index 44a764c..81c4849 100644
--- a/unix/zsysnum_linux_loong64.go
+++ b/unix/zsysnum_linux_loong64.go
@@ -1,4 +1,4 @@
-// go run linux/mksysnum.go -Wall -Werror -static -I/tmp/include /tmp/include/asm/unistd.h
+// go run linux/mksysnum.go -Wall -Werror -static -I/tmp/loong64/include /tmp/loong64/include/asm/unistd.h
// Code generated by the command above; see README.md. DO NOT EDIT.
//go:build loong64 && linux
diff --git a/unix/zsysnum_linux_mips.go b/unix/zsysnum_linux_mips.go
index 65a99ef..202a57e 100644
--- a/unix/zsysnum_linux_mips.go
+++ b/unix/zsysnum_linux_mips.go
@@ -1,4 +1,4 @@
-// go run linux/mksysnum.go -Wall -Werror -static -I/tmp/include /tmp/include/asm/unistd.h
+// go run linux/mksysnum.go -Wall -Werror -static -I/tmp/mips/include /tmp/mips/include/asm/unistd.h
// Code generated by the command above; see README.md. DO NOT EDIT.
//go:build mips && linux
diff --git a/unix/zsysnum_linux_mips64.go b/unix/zsysnum_linux_mips64.go
index 841c8a6..1fbceb5 100644
--- a/unix/zsysnum_linux_mips64.go
+++ b/unix/zsysnum_linux_mips64.go
@@ -1,4 +1,4 @@
-// go run linux/mksysnum.go -Wall -Werror -static -I/tmp/include /tmp/include/asm/unistd.h
+// go run linux/mksysnum.go -Wall -Werror -static -I/tmp/mips64/include /tmp/mips64/include/asm/unistd.h
// Code generated by the command above; see README.md. DO NOT EDIT.
//go:build mips64 && linux
diff --git a/unix/zsysnum_linux_mips64le.go b/unix/zsysnum_linux_mips64le.go
index e26a7c7..b4ffb7a 100644
--- a/unix/zsysnum_linux_mips64le.go
+++ b/unix/zsysnum_linux_mips64le.go
@@ -1,4 +1,4 @@
-// go run linux/mksysnum.go -Wall -Werror -static -I/tmp/include /tmp/include/asm/unistd.h
+// go run linux/mksysnum.go -Wall -Werror -static -I/tmp/mips64le/include /tmp/mips64le/include/asm/unistd.h
// Code generated by the command above; see README.md. DO NOT EDIT.
//go:build mips64le && linux
diff --git a/unix/zsysnum_linux_mipsle.go b/unix/zsysnum_linux_mipsle.go
index 2644726..867985f 100644
--- a/unix/zsysnum_linux_mipsle.go
+++ b/unix/zsysnum_linux_mipsle.go
@@ -1,4 +1,4 @@
-// go run linux/mksysnum.go -Wall -Werror -static -I/tmp/include /tmp/include/asm/unistd.h
+// go run linux/mksysnum.go -Wall -Werror -static -I/tmp/mipsle/include /tmp/mipsle/include/asm/unistd.h
// Code generated by the command above; see README.md. DO NOT EDIT.
//go:build mipsle && linux
diff --git a/unix/zsysnum_linux_ppc.go b/unix/zsysnum_linux_ppc.go
index 26aefc1..a8cce69 100644
--- a/unix/zsysnum_linux_ppc.go
+++ b/unix/zsysnum_linux_ppc.go
@@ -1,4 +1,4 @@
-// go run linux/mksysnum.go -Wall -Werror -static -I/tmp/include /tmp/include/asm/unistd.h
+// go run linux/mksysnum.go -Wall -Werror -static -I/tmp/ppc/include /tmp/ppc/include/asm/unistd.h
// Code generated by the command above; see README.md. DO NOT EDIT.
//go:build ppc && linux
diff --git a/unix/zsysnum_linux_ppc64.go b/unix/zsysnum_linux_ppc64.go
index 8d4cd9d..d44c5b3 100644
--- a/unix/zsysnum_linux_ppc64.go
+++ b/unix/zsysnum_linux_ppc64.go
@@ -1,4 +1,4 @@
-// go run linux/mksysnum.go -Wall -Werror -static -I/tmp/include /tmp/include/asm/unistd.h
+// go run linux/mksysnum.go -Wall -Werror -static -I/tmp/ppc64/include /tmp/ppc64/include/asm/unistd.h
// Code generated by the command above; see README.md. DO NOT EDIT.
//go:build ppc64 && linux
diff --git a/unix/zsysnum_linux_ppc64le.go b/unix/zsysnum_linux_ppc64le.go
index 3b405d1..4214dd9 100644
--- a/unix/zsysnum_linux_ppc64le.go
+++ b/unix/zsysnum_linux_ppc64le.go
@@ -1,4 +1,4 @@
-// go run linux/mksysnum.go -Wall -Werror -static -I/tmp/include /tmp/include/asm/unistd.h
+// go run linux/mksysnum.go -Wall -Werror -static -I/tmp/ppc64le/include /tmp/ppc64le/include/asm/unistd.h
// Code generated by the command above; see README.md. DO NOT EDIT.
//go:build ppc64le && linux
diff --git a/unix/zsysnum_linux_riscv64.go b/unix/zsysnum_linux_riscv64.go
index 3a9c96b..3e594a8 100644
--- a/unix/zsysnum_linux_riscv64.go
+++ b/unix/zsysnum_linux_riscv64.go
@@ -1,4 +1,4 @@
-// go run linux/mksysnum.go -Wall -Werror -static -I/tmp/include /tmp/include/asm/unistd.h
+// go run linux/mksysnum.go -Wall -Werror -static -I/tmp/riscv64/include /tmp/riscv64/include/asm/unistd.h
// Code generated by the command above; see README.md. DO NOT EDIT.
//go:build riscv64 && linux
diff --git a/unix/zsysnum_linux_s390x.go b/unix/zsysnum_linux_s390x.go
index 8ffa664..7ea4652 100644
--- a/unix/zsysnum_linux_s390x.go
+++ b/unix/zsysnum_linux_s390x.go
@@ -1,4 +1,4 @@
-// go run linux/mksysnum.go -Wall -Werror -static -I/tmp/include -fsigned-char /tmp/include/asm/unistd.h
+// go run linux/mksysnum.go -Wall -Werror -static -I/tmp/s390x/include -fsigned-char /tmp/s390x/include/asm/unistd.h
// Code generated by the command above; see README.md. DO NOT EDIT.
//go:build s390x && linux
diff --git a/unix/zsysnum_linux_sparc64.go b/unix/zsysnum_linux_sparc64.go
index 6a39640..92f628e 100644
--- a/unix/zsysnum_linux_sparc64.go
+++ b/unix/zsysnum_linux_sparc64.go
@@ -1,4 +1,4 @@
-// go run linux/mksysnum.go -Wall -Werror -static -I/tmp/include /tmp/include/asm/unistd.h
+// go run linux/mksysnum.go -Wall -Werror -static -I/tmp/sparc64/include /tmp/sparc64/include/asm/unistd.h
// Code generated by the command above; see README.md. DO NOT EDIT.
//go:build sparc64 && linux
diff --git a/unix/ztypes_linux_386.go b/unix/ztypes_linux_386.go
index 7551af4..2636044 100644
--- a/unix/ztypes_linux_386.go
+++ b/unix/ztypes_linux_386.go
@@ -1,4 +1,4 @@
-// cgo -godefs -- -Wall -Werror -static -I/tmp/include -m32 linux/types.go | go run mkpost.go
+// cgo -godefs -objdir=/tmp/386/cgo -- -Wall -Werror -static -I/tmp/386/include -m32 linux/types.go | go run mkpost.go
// Code generated by the command above; see README.md. DO NOT EDIT.
//go:build 386 && linux
diff --git a/unix/ztypes_linux_amd64.go b/unix/ztypes_linux_amd64.go
index 3e738ac..8187489 100644
--- a/unix/ztypes_linux_amd64.go
+++ b/unix/ztypes_linux_amd64.go
@@ -1,4 +1,4 @@
-// cgo -godefs -- -Wall -Werror -static -I/tmp/include -m64 linux/types.go | go run mkpost.go
+// cgo -godefs -objdir=/tmp/amd64/cgo -- -Wall -Werror -static -I/tmp/amd64/include -m64 linux/types.go | go run mkpost.go
// Code generated by the command above; see README.md. DO NOT EDIT.
//go:build amd64 && linux
diff --git a/unix/ztypes_linux_arm.go b/unix/ztypes_linux_arm.go
index 6183eef..d161233 100644
--- a/unix/ztypes_linux_arm.go
+++ b/unix/ztypes_linux_arm.go
@@ -1,4 +1,4 @@
-// cgo -godefs -- -Wall -Werror -static -I/tmp/include linux/types.go | go run mkpost.go
+// cgo -godefs -objdir=/tmp/arm/cgo -- -Wall -Werror -static -I/tmp/arm/include linux/types.go | go run mkpost.go
// Code generated by the command above; see README.md. DO NOT EDIT.
//go:build arm && linux
diff --git a/unix/ztypes_linux_arm64.go b/unix/ztypes_linux_arm64.go
index 968cecb..c28e555 100644
--- a/unix/ztypes_linux_arm64.go
+++ b/unix/ztypes_linux_arm64.go
@@ -1,4 +1,4 @@
-// cgo -godefs -- -Wall -Werror -static -I/tmp/include -fsigned-char linux/types.go | go run mkpost.go
+// cgo -godefs -objdir=/tmp/arm64/cgo -- -Wall -Werror -static -I/tmp/arm64/include -fsigned-char linux/types.go | go run mkpost.go
// Code generated by the command above; see README.md. DO NOT EDIT.
//go:build arm64 && linux
diff --git a/unix/ztypes_linux_loong64.go b/unix/ztypes_linux_loong64.go
index 8fe4c52..187061f 100644
--- a/unix/ztypes_linux_loong64.go
+++ b/unix/ztypes_linux_loong64.go
@@ -1,4 +1,4 @@
-// cgo -godefs -- -Wall -Werror -static -I/tmp/include linux/types.go | go run mkpost.go
+// cgo -godefs -objdir=/tmp/loong64/cgo -- -Wall -Werror -static -I/tmp/loong64/include linux/types.go | go run mkpost.go
// Code generated by the command above; see README.md. DO NOT EDIT.
//go:build loong64 && linux
diff --git a/unix/ztypes_linux_mips.go b/unix/ztypes_linux_mips.go
index 11426a3..3691299 100644
--- a/unix/ztypes_linux_mips.go
+++ b/unix/ztypes_linux_mips.go
@@ -1,4 +1,4 @@
-// cgo -godefs -- -Wall -Werror -static -I/tmp/include linux/types.go | go run mkpost.go
+// cgo -godefs -objdir=/tmp/mips/cgo -- -Wall -Werror -static -I/tmp/mips/include linux/types.go | go run mkpost.go
// Code generated by the command above; see README.md. DO NOT EDIT.
//go:build mips && linux
diff --git a/unix/ztypes_linux_mips64.go b/unix/ztypes_linux_mips64.go
index ad1c3b3..7473468 100644
--- a/unix/ztypes_linux_mips64.go
+++ b/unix/ztypes_linux_mips64.go
@@ -1,4 +1,4 @@
-// cgo -godefs -- -Wall -Werror -static -I/tmp/include linux/types.go | go run mkpost.go
+// cgo -godefs -objdir=/tmp/mips64/cgo -- -Wall -Werror -static -I/tmp/mips64/include linux/types.go | go run mkpost.go
// Code generated by the command above; see README.md. DO NOT EDIT.
//go:build mips64 && linux
diff --git a/unix/ztypes_linux_mips64le.go b/unix/ztypes_linux_mips64le.go
index 15fd84e..ed94485 100644
--- a/unix/ztypes_linux_mips64le.go
+++ b/unix/ztypes_linux_mips64le.go
@@ -1,4 +1,4 @@
-// cgo -godefs -- -Wall -Werror -static -I/tmp/include linux/types.go | go run mkpost.go
+// cgo -godefs -objdir=/tmp/mips64le/cgo -- -Wall -Werror -static -I/tmp/mips64le/include linux/types.go | go run mkpost.go
// Code generated by the command above; see README.md. DO NOT EDIT.
//go:build mips64le && linux
diff --git a/unix/ztypes_linux_mipsle.go b/unix/ztypes_linux_mipsle.go
index 49c4982..0892a73 100644
--- a/unix/ztypes_linux_mipsle.go
+++ b/unix/ztypes_linux_mipsle.go
@@ -1,4 +1,4 @@
-// cgo -godefs -- -Wall -Werror -static -I/tmp/include linux/types.go | go run mkpost.go
+// cgo -godefs -objdir=/tmp/mipsle/cgo -- -Wall -Werror -static -I/tmp/mipsle/include linux/types.go | go run mkpost.go
// Code generated by the command above; see README.md. DO NOT EDIT.
//go:build mipsle && linux
diff --git a/unix/ztypes_linux_ppc.go b/unix/ztypes_linux_ppc.go
index cd36d0d..e1dd483 100644
--- a/unix/ztypes_linux_ppc.go
+++ b/unix/ztypes_linux_ppc.go
@@ -1,4 +1,4 @@
-// cgo -godefs -- -Wall -Werror -static -I/tmp/include linux/types.go | go run mkpost.go
+// cgo -godefs -objdir=/tmp/ppc/cgo -- -Wall -Werror -static -I/tmp/ppc/include linux/types.go | go run mkpost.go
// Code generated by the command above; see README.md. DO NOT EDIT.
//go:build ppc && linux
diff --git a/unix/ztypes_linux_ppc64.go b/unix/ztypes_linux_ppc64.go
index 8c6fce0..d9f654c 100644
--- a/unix/ztypes_linux_ppc64.go
+++ b/unix/ztypes_linux_ppc64.go
@@ -1,4 +1,4 @@
-// cgo -godefs -- -Wall -Werror -static -I/tmp/include linux/types.go | go run mkpost.go
+// cgo -godefs -objdir=/tmp/ppc64/cgo -- -Wall -Werror -static -I/tmp/ppc64/include linux/types.go | go run mkpost.go
// Code generated by the command above; see README.md. DO NOT EDIT.
//go:build ppc64 && linux
diff --git a/unix/ztypes_linux_ppc64le.go b/unix/ztypes_linux_ppc64le.go
index 20910f2..74acda9 100644
--- a/unix/ztypes_linux_ppc64le.go
+++ b/unix/ztypes_linux_ppc64le.go
@@ -1,4 +1,4 @@
-// cgo -godefs -- -Wall -Werror -static -I/tmp/include linux/types.go | go run mkpost.go
+// cgo -godefs -objdir=/tmp/ppc64le/cgo -- -Wall -Werror -static -I/tmp/ppc64le/include linux/types.go | go run mkpost.go
// Code generated by the command above; see README.md. DO NOT EDIT.
//go:build ppc64le && linux
diff --git a/unix/ztypes_linux_riscv64.go b/unix/ztypes_linux_riscv64.go
index 71b7b33..50ebe69 100644
--- a/unix/ztypes_linux_riscv64.go
+++ b/unix/ztypes_linux_riscv64.go
@@ -1,4 +1,4 @@
-// cgo -godefs -- -Wall -Werror -static -I/tmp/include linux/types.go | go run mkpost.go
+// cgo -godefs -objdir=/tmp/riscv64/cgo -- -Wall -Werror -static -I/tmp/riscv64/include linux/types.go | go run mkpost.go
// Code generated by the command above; see README.md. DO NOT EDIT.
//go:build riscv64 && linux
diff --git a/unix/ztypes_linux_s390x.go b/unix/ztypes_linux_s390x.go
index 71184cc..75b34c2 100644
--- a/unix/ztypes_linux_s390x.go
+++ b/unix/ztypes_linux_s390x.go
@@ -1,4 +1,4 @@
-// cgo -godefs -- -Wall -Werror -static -I/tmp/include -fsigned-char linux/types.go | go run mkpost.go
+// cgo -godefs -objdir=/tmp/s390x/cgo -- -Wall -Werror -static -I/tmp/s390x/include -fsigned-char linux/types.go | go run mkpost.go
// Code generated by the command above; see README.md. DO NOT EDIT.
//go:build s390x && linux
diff --git a/unix/ztypes_linux_sparc64.go b/unix/ztypes_linux_sparc64.go
index 0615628..429c3bf 100644
--- a/unix/ztypes_linux_sparc64.go
+++ b/unix/ztypes_linux_sparc64.go
@@ -1,4 +1,4 @@
-// cgo -godefs -- -Wall -Werror -static -I/tmp/include linux/types.go | go run mkpost.go
+// cgo -godefs -objdir=/tmp/sparc64/cgo -- -Wall -Werror -static -I/tmp/sparc64/include linux/types.go | go run mkpost.go
// Code generated by the command above; see README.md. DO NOT EDIT.
//go:build sparc64 && linux