From 79910ad71b16dbf22e70717166c21361b5cf9bf0 Mon Sep 17 00:00:00 2001 From: Dmitry Vyukov Date: Thu, 23 Jan 2025 09:31:50 +0100 Subject: sys/syz-sysgen: serialize descriptions as gob and embed Instead of generating Go files with descriptions serialize them as gob and compress with flate. This significantly reduces build time, go vet time, and solves scalability problems with some static analysis tools. Reference times (all after rm -rf ~/.cache/go-build) before: TIME="%e %P %M" time go install ./syz-manager 48.29 577% 4824820 TIME="%e %P %M" time go test -c ./prog 56.28 380% 6973292 After: TIME="%e %P %M" time go install ./syz-manager 22.81 865% 859788 TIME="%e %P %M" time go test -c ./prog 12.74 565% 267760 syz-manager size before/after: 194712597 -> 83418407 -57% even provided we now embed all descriptions instead of just a single arch. Deflate/decoding time for a single Linux arch is ~330ms. Fixes #5542 --- Makefile | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index 95eb15ba0..07716b436 100644 --- a/Makefile +++ b/Makefile @@ -74,13 +74,12 @@ GITREVDATE=$(shell git log -n 1 --format="%cd" --date=format:%Y%m%d-%H%M%S) # That's only needed if you use gdb or nm. # If you need that, build manually without these flags. GOFLAGS := "-ldflags=-s -w -X github.com/google/syzkaller/prog.GitRevision=$(REV) -X 'github.com/google/syzkaller/prog.gitRevisionDate=$(GITREVDATE)'" +ifneq ("$(GOTAGS)", "") + GOFLAGS += " -tags=$(GOTAGS)" +endif GOHOSTFLAGS ?= $(GOFLAGS) GOTARGETFLAGS ?= $(GOFLAGS) -ifneq ("$(GOTAGS)", "") - GOHOSTFLAGS += "-tags=$(GOTAGS)" -endif -GOTARGETFLAGS += "-tags=syz_target syz_os_$(TARGETOS) syz_arch_$(TARGETVMARCH) $(GOTAGS)" ifeq ("$(TARGETOS)", "test") TARGETGOOS := $(HOSTOS) @@ -149,7 +148,6 @@ descriptions: .descriptions: sys/*/*.txt sys/*/*.const bin/syz-sysgen bin/syz-sysgen - $(GO) fmt ./sys/... >/dev/null touch .descriptions manager: descriptions -- cgit mrf-deployment