diff --git a/0002-Etcd-on-unsupported-platform-without-ETCD_UNSUPPORTED_ARCH=arm64-set.patch b/0002-Etcd-on-unsupported-platform-without-ETCD_UNSUPPORTED_ARCH=arm64-set.patch new file mode 100644 index 0000000000000000000000000000000000000000..fbbe95875be45fadc6f06c410e6a506d23532e15 --- /dev/null +++ b/0002-Etcd-on-unsupported-platform-without-ETCD_UNSUPPORTED_ARCH=arm64-set.patch @@ -0,0 +1,28 @@ +From b84b5ff496fd1f815c89f8431aeca5cfa9c3e390 Mon Sep 17 00:00:00 2001 +From: jiangxinyu +Date: Wed, 2 Jun 2021 17:04:36 +0800 +Subject: [PATCH] =?UTF-8?q?=E5=85=BC=E5=AE=B9=E6=9E=B6=E6=9E=84?= +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +--- + etcdmain/etcd.go | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/etcdmain/etcd.go b/etcdmain/etcd.go +index 73328a7..1907f99 100644 +--- a/etcdmain/etcd.go ++++ b/etcdmain/etcd.go +@@ -603,7 +603,7 @@ func identifyDataDirOrDie(lg *zap.Logger, dir string) dirType { + + func checkSupportArch() { + // TODO qualify arm64 +- if runtime.GOARCH == "amd64" || runtime.GOARCH == "ppc64le" { ++ if runtime.GOARCH == "amd64" || runtime.GOARCH == "ppc64le" || runtime.GOARCH == "arm64" { + return + } + // unsupported arch only configured via environment variable +-- +2.27.0 + diff --git a/etcd.spec b/etcd.spec index 95aa4ad882052a1685e15b6d64b887beb1369e79..04a2c395719ef7413d21d03ca63693af2f6120fb 100644 --- a/etcd.spec +++ b/etcd.spec @@ -31,7 +31,7 @@ system.} %global gosupfiles integration/fixtures/* etcdserver/api/v2http/testdata/* Name: etcd -Release: 2 +Release: 4 Summary: Distributed reliable key-value store for the most critical data of a distributed system # Upstream license specification: Apache-2.0 @@ -45,6 +45,7 @@ Source3: man-%{man_version}.tar.gz Source10: genmanpages.sh # update grpc-go version to v1.32.0 Patch1: 0001-Convert-int-to-string-using-strconv.Itoa.patch +Patch2: 0002-Etcd-on-unsupported-platform-without-ETCD_UNSUPPORTED_ARCH=arm64-set.patch BuildRequires: golang BuildRequires: python3-devel @@ -61,6 +62,7 @@ Requires(pre): shadow-utils %setup -q -n man-%{man_version} -T -b 3 %forgesetup %patch1 -p1 +%patch2 -p1 # For compatibility cp -aR etcdserver/api/snap snap cp -aR etcdserver/api/membership etcdserver/membership @@ -76,9 +78,19 @@ cp ../man-%{man_version}/*.1 man/man1/. %if %{without bootstrap} %build -GO111MODULE=on GOFLAGS=-mod=vendor go build -o %{gobuilddir}/bin/etcd %{goipath} +CGO_CFLAGS="-fstack-protector-strong -fPIE -D_FORTIFY_SOURCE=2 -O2" \ +CGO_LDFLAGS_ALLOW="-Wl,-z,relro,-z,now" \ +CGO_LDFLAGS="-Wl,-z,relro,-z,now -Wl,-z,noexecstack" \ +GO111MODULE=on GOFLAGS=-mod=vendor \ +go build -buildmode=pie -ldflags "-linkmode=external -w -s" \ +-o %{gobuilddir}/bin/etcd %{goipath} for cmd in etcdctl; do - GO111MODULE=on GOFLAGS=-mod=vendor go build -o %{gobuilddir}/bin/$(basename $cmd) %{goipath}/$cmd + CGO_CFLAGS="-fstack-protector-strong -fPIE -D_FORTIFY_SOURCE=2 -O2" \ + CGO_LDFLAGS_ALLOW="-Wl,-z,relro,-z,now" \ + CGO_LDFLAGS="-Wl,-z,relro,-z,now -Wl,-z,noexecstack" \ + GO111MODULE=on GOFLAGS=-mod=vendor \ + go build -buildmode=pie -ldflags "-linkmode=external -w -s" \ + -o %{gobuilddir}/bin/$(basename $cmd) %{goipath}/$cmd done %endif @@ -136,6 +148,12 @@ getent passwd %{name} >/dev/null || useradd -r -g %{name} -d %{_sharedstatedir}/ %endif %changelog +* Wed Sep 1 2021 jikui - 3.4.14-4 +- modify build flags for secure compilation options + +* Wed Jun 2 2021 jiangxinyu - 3.4.14-3 +- Solve the problem of etcd on unsupported platform without ETCD_UNSUPPORTED_ARCH=arm64 set + * Thu Mar 04 2021 jiangxinyu - 3.4.14-2 - Remove the BuildRequires: go-compilers package