diff --git a/0002-enable-external-linkmode-for-cgo-build.patch b/0002-enable-external-linkmode-for-cgo-build.patch new file mode 100644 index 0000000000000000000000000000000000000000..b40b306224b3d238ad64669230b8031d52ca5c1d --- /dev/null +++ b/0002-enable-external-linkmode-for-cgo-build.patch @@ -0,0 +1,39 @@ +From 1d3927ed6a300498bd1384ad961a2029ab18be45 Mon Sep 17 00:00:00 2001 +From: zhangsong234 +Date: Thu, 2 Sep 2021 21:18:50 +0800 +Subject: [PATCH] enable external linkmode for cgo build + +Signed-off-by: zhangsong234 +--- + Makefile | 11 +++-------- + 1 file changed, 3 insertions(+), 8 deletions(-) + +diff --git a/Makefile b/Makefile +index a597ff4..6507429 100644 +--- a/Makefile ++++ b/Makefile +@@ -20,18 +20,13 @@ TAGS="cgo static_build" + BEP_DIR=/tmp/lxcfs-tools-build-bep + BEP_FLAGS=-tmpdir=/tmp/lxcfs-tools-build-bep + +-GO_LDFLAGS="-buildid=IdByiSula $(BEP_FLAGS) -extldflags=-static -extldflags=-Wl,-z,relro,-z,now -X main.gitCommit=${COMMIT} -X main.version=${VERSION}" +-DEF_GOPATH=${GOPATH} +-ifneq ($(GOPATH), ) +-CUS_GOPATH=${GOPATH}:${PWD} +-ENV = GOPATH=${CUS_GOPATH} \ ++GO_LDFLAGS="-buildid=IdByiSula $(BEP_FLAGS) -linkmode=external -extldflags=-static -extldflags=-Wl,-z,relro,-z,now -X main.gitCommit=${COMMIT} -X main.version=${VERSION}" ++ ++ENV = GOPATH=${GOPATH} \ + CGO_ENABLED=1 \ + CGO_CFLAGS="-fstack-protector-strong -fPIE" \ + CGO_LDFLAGS_ALLOW='-Wl,-z,relro,-z,now' \ + CGO_LDFLAGS="-Wl,-z,relro,-z,now -Wl,-z,noexecstack" +-else +-ENV = CGO_ENABLED=1 +-endif + + all: dep toolkit lxcfs-hook + dep: +-- +1.8.3.1 + diff --git a/lxcfs-tools.spec b/lxcfs-tools.spec index b1595e8ba5efdae2eecabd162d6a4190b3e172d2..71c49b82fda3cc307e7ca9b5741a051acff45981 100644 --- a/lxcfs-tools.spec +++ b/lxcfs-tools.spec @@ -1,9 +1,7 @@ -%define debug_package %{nil} - #Basic Information Name: lxcfs-tools Version: 0.3 -Release: 24 +Release: 25 Summary: toolkit for lxcfs to remount a running isulad License: Mulan PSL v2 URL: https://gitee.com/openeuler/lxcfs-tools @@ -11,6 +9,7 @@ Source0: https://gitee.com/openeuler/lxcfs-tools/repository/archive/v%{version}. BuildRoot: %{_tmppath}/%{name}-root Patch1: 0001-lxcfs-tools-build-security-option.patch +Patch2: 0002-enable-external-linkmode-for-cgo-build.patch #Dependency BuildRequires: golang > 1.7 @@ -22,8 +21,7 @@ A toolkit for lxcfs to remount a running isulad when crashes recover #Build sections %prep -%setup -n %{name} -q -%patch1 -p1 +%autosetup -n %{name} -p1 %build make @@ -93,6 +91,9 @@ rm -rfv %{buildroot} %changelog +* Thu Sep 02 2021 zhangsong234 - 0.3-25 +- enable external linkmode for cgo build + * Mon Feb 08 2021 zhangsong234 - 0.3-24 - update version to 0.3-24