From f9735b5f3c6c396a23e01925aeb398f3f8885998 Mon Sep 17 00:00:00 2001 From: luofeng14 Date: Tue, 9 Apr 2024 19:40:30 +0800 Subject: [PATCH] Avoid using C ldflags with Go compiler --- containernetworking-plugins.spec | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/containernetworking-plugins.spec b/containernetworking-plugins.spec index e4a0077..f4e6ae8 100644 --- a/containernetworking-plugins.spec +++ b/containernetworking-plugins.spec @@ -16,7 +16,7 @@ Name: %{project}-%{repo} Version: 1.2.0 -Release: 2 +Release: 3 Summary: Libraries for use by writing CNI plugin License: ASL 2.0 URL: https://github.com/containernetworking/plugins @@ -119,7 +119,7 @@ for d in $PLUGINS; do if [ -d "$d" ]; then plugin="$(basename "$d")" echo " $plugin" - go build -buildmode pie -compiler gc -tags="rpm_crashtraceback ${BUILDTAGS:-}" -ldflags "${LDFLAGS:-} -B 0x$(head -c20 /dev/urandom|od -An -tx1|tr -d ' \n') -s -w -linkmode=external -extldflags '%__global_ldflags %{?__golang_extldflags} -Wl,-z,now ' " -a -v -x -o "${PWD}/bin/$plugin" "$@" github.com/containernetworking/plugins/$d + go build -buildmode pie -compiler gc -tags="rpm_crashtraceback ${BUILDTAGS:-}" -ldflags " -B 0x$(head -c20 /dev/urandom|od -An -tx1|tr -d ' \n') -s -w -linkmode=external -extldflags '%__global_ldflags %{?__golang_extldflags} -Wl,-z,now ' " -a -v -x -o "${PWD}/bin/$plugin" "$@" github.com/containernetworking/plugins/$d fi done @@ -192,7 +192,7 @@ VERSIONFLAGS=" " TAGS="apparmor seccomp netcgo osusergo providerless" STATIC="-extldflags '-static -lm -ldl -lz -lpthread'" -GO111MODULE=off CGO_ENABLED=0 GOPATH=$TMPDIR go build -tags "$TAGS" -buildmode=pie -ldflags "$VERSIONFLAGS $LDFLAGS $STATIC -s -w -linkmode=external -extldflags '-Wl,-z,relro -Wl,-z,now ' " -o %{_builddir}/cni +GO111MODULE=off CGO_ENABLED=0 GOPATH=$TMPDIR go build -tags "$TAGS" -buildmode=pie -ldflags "$VERSIONFLAGS $STATIC -s -w -linkmode=external -extldflags '-Wl,-z,relro -Wl,-z,now ' " -o %{_builddir}/cni %install install -d -p %{buildroot}%{_libexecdir}/cni/ @@ -313,6 +313,9 @@ export GOPATH=%{buildroot}/%{gopath}:$(pwd)/vendor:%{gopath} %changelog +* Fri Mar 1 2024 luofeng - 1.2.0-3 +- Avoid using C ldflags with Go compiler + * Thu Dec 28 2023 yaoxin - 1.2.0-2 - Rebuild for golang cves: CVE-2023-24534,CVE-2023-24536,CVE-2023-24537 and CVE-2023-24538 -- Gitee