From 4c47c59746e017d32bcb8104d4bf05819551b86a Mon Sep 17 00:00:00 2001 From: lystopad Date: Fri, 18 Oct 2024 18:17:49 +0200 Subject: [PATCH] Introduce GOAMD64 variable with default=v2 for AMD64 arch. (#12371) See https://github.com/erigontech/erigon/issues/11715 --- Makefile | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 33763e88bc6..65f5e6fe627 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,5 @@ GO ?= go # if using docker, should not need to be installed/linked +GOAMD64_VERSION ?= v2 # See https://go.dev/wiki/MinimumRequirements#microarchitecture-support GOBINREL = build/bin GOBIN = $(CURDIR)/$(GOBINREL) UNAME = $(shell uname) # Supported: Darwin, Linux @@ -32,6 +33,10 @@ ifeq ($(shell uname -m), aarch64) CGO_CFLAGS += -D__BLST_PORTABLE__ endif +# Configure GOAMD64 env.variable for AMD64 architecture: +ifeq ($(shell uname -m),x86_64) + CPU_ARCH= GOAMD64=${GOAMD64_VERSION} +endif CGO_CFLAGS += -Wno-unknown-warning-option -Wno-enum-int-mismatch -Wno-strict-prototypes -Wno-unused-but-set-variable -O3 @@ -58,9 +63,9 @@ PACKAGE = github.com/erigontech/erigon GO_FLAGS += -trimpath -tags $(BUILD_TAGS) -buildvcs=false GO_FLAGS += -ldflags "-X ${PACKAGE}/params.GitCommit=${GIT_COMMIT} -X ${PACKAGE}/params.GitBranch=${GIT_BRANCH} -X ${PACKAGE}/params.GitTag=${GIT_TAG}" -GOBUILD = CGO_CFLAGS="$(CGO_CFLAGS)" CGO_LDFLAGS="$(CGO_LDFLAGS)" GOPRIVATE="$(GOPRIVATE)" $(GO) build $(GO_FLAGS) -GO_DBG_BUILD = CGO_CFLAGS="$(CGO_CFLAGS) -DMDBX_DEBUG=1" CGO_LDFLAGS="$(CGO_LDFLAGS)" GOPRIVATE="$(GOPRIVATE)" $(GO) build -tags $(BUILD_TAGS),debug -gcflags=all="-N -l" # see delve docs -GOTEST = CGO_CFLAGS="$(CGO_CFLAGS)" CGO_LDFLAGS="$(CGO_LDFLAGS)" GOPRIVATE="$(GOPRIVATE)" GODEBUG=cgocheck=0 GOTRACEBACK=1 $(GO) test $(GO_FLAGS) ./... -p 2 +GOBUILD = ${CPU_ARCH} CGO_CFLAGS="$(CGO_CFLAGS)" CGO_LDFLAGS="$(CGO_LDFLAGS)" GOPRIVATE="$(GOPRIVATE)" $(GO) build $(GO_FLAGS) +GO_DBG_BUILD = ${CPU_ARCH} CGO_CFLAGS="$(CGO_CFLAGS) -DMDBX_DEBUG=1" CGO_LDFLAGS="$(CGO_LDFLAGS)" GOPRIVATE="$(GOPRIVATE)" $(GO) build -tags $(BUILD_TAGS),debug -gcflags=all="-N -l" # see delve docs +GOTEST = ${CPU_ARCH} CGO_CFLAGS="$(CGO_CFLAGS)" CGO_LDFLAGS="$(CGO_LDFLAGS)" GOPRIVATE="$(GOPRIVATE)" GODEBUG=cgocheck=0 GOTRACEBACK=1 $(GO) test $(GO_FLAGS) ./... -p 2 default: all