aboutsummaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authorzoulasc <christos@zoulas.com>2017-10-28 13:45:18 -0400
committerDmitry Vyukov <dvyukov@google.com>2017-11-06 11:27:45 +0300
commit7afa56efb4b575469f313a18b561bc036a2becb5 (patch)
treee6cecf446e79a4bf624016e44cd9e4ef4267ebe4 /sys
parent0460a8dda0310fada7233bb0cf0574493e9d135b (diff)
syz-extract: Add missing symlink for NetBSD and refactor symlink code.
Diffstat (limited to 'sys')
-rw-r--r--sys/syz-extract/netbsd.go24
1 files changed, 19 insertions, 5 deletions
diff --git a/sys/syz-extract/netbsd.go b/sys/syz-extract/netbsd.go
index 04785d8b4..2be626249 100644
--- a/sys/syz-extract/netbsd.go
+++ b/sys/syz-extract/netbsd.go
@@ -25,17 +25,31 @@ func (*netbsd) prepare(sourcedir string, build bool, arches []string) error {
}
func (*netbsd) prepareArch(arch *Arch) error {
- if err := os.Symlink(filepath.Join(arch.sourceDir, "sys", "arch", "amd64", "include"),
- filepath.Join(arch.buildDir, "machine")); err != nil {
- return fmt.Errorf("failed to create link: %v", err)
+ links := [][2]string{
+ {"amd64", "machine"},
+ {"amd64", "amd64"},
+ {"x86", "x86"},
+ }
+ for _, v := range links {
+ if err := machineLink(arch, v[0], v[1]); err != nil {
+ return err
+ }
}
- if err := os.Symlink(filepath.Join(arch.sourceDir, "sys", "arch", "x86", "include"),
- filepath.Join(arch.buildDir, "x86")); err != nil {
+ return nil
+}
+
+func machineLink(arch *Arch, machine string, dest string) error {
+ if err := os.Symlink(machineInclude(arch, machine),
+ filepath.Join(arch.buildDir, dest)); err != nil {
return fmt.Errorf("failed to create link: %v", err)
}
return nil
}
+func machineInclude(arch *Arch, machine string) string {
+ return filepath.Join(arch.sourceDir, "sys", "arch", machine, "include")
+}
+
func (*netbsd) processFile(arch *Arch, info *compiler.ConstInfo) (map[string]uint64, map[string]bool, error) {
args := []string{
"-fmessage-length=0",