aboutsummaryrefslogtreecommitdiffstats
path: root/sys/syz-extract
diff options
context:
space:
mode:
authorAndrew Turner <andrew@fubar.geek.nz>2021-05-17 15:16:25 +0000
committerMark Johnston <markjdb@gmail.com>2021-05-17 16:03:35 -0400
commite49a71c6b4816329720ebec3eed3523259e604bb (patch)
treebfc4a0124578f0737390da5eb0987c942abac3ad /sys/syz-extract
parent043c1c84f179fd7d6cd787340196527d2d4ca048 (diff)
sys/syz-extract: clean up const generation on FreeBSD
* Create the correct machine symlink on non-amd64 architectures * Remove an unneeded amd64 include directory * Pass the compiler and C flags from the target to the compiler
Diffstat (limited to 'sys/syz-extract')
-rw-r--r--sys/syz-extract/freebsd.go12
1 files changed, 9 insertions, 3 deletions
diff --git a/sys/syz-extract/freebsd.go b/sys/syz-extract/freebsd.go
index 0c3e8fd8d..f1537e2a0 100644
--- a/sys/syz-extract/freebsd.go
+++ b/sys/syz-extract/freebsd.go
@@ -25,7 +25,12 @@ func (*freebsd) prepare(sourcedir string, build bool, arches []*Arch) error {
}
func (*freebsd) prepareArch(arch *Arch) error {
- if err := os.Symlink(filepath.Join(arch.sourceDir, "sys", "amd64", "include"),
+ archName := arch.target.Arch
+ // Use the the correct name for FreeBSD/i386
+ if archName == "386" {
+ archName = "i386"
+ }
+ if err := os.Symlink(filepath.Join(arch.sourceDir, "sys", archName, "include"),
filepath.Join(arch.buildDir, "machine")); err != nil {
return fmt.Errorf("failed to create link: %v", err)
}
@@ -45,7 +50,6 @@ func (*freebsd) processFile(arch *Arch, info *compiler.ConstInfo) (map[string]ui
"-D__BSD_VISIBLE=1",
"-I", filepath.Join(arch.sourceDir, "sys"),
"-I", filepath.Join(arch.sourceDir, "sys", "sys"),
- "-I", filepath.Join(arch.sourceDir, "sys", "amd64"),
"-I", arch.buildDir,
}
for _, incdir := range info.Incdirs {
@@ -56,10 +60,12 @@ func (*freebsd) processFile(arch *Arch, info *compiler.ConstInfo) (map[string]ui
args = append(args, "-I"+dir)
}
}
+ args = append(args, arch.target.CFlags...)
params := &extractParams{
AddSource: "#include <sys/syscall.h>",
DeclarePrintf: true,
TargetEndian: arch.target.HostEndian,
}
- return extract(info, "gcc", args, params)
+ cc := arch.target.CCompiler
+ return extract(info, cc, args, params)
}