From 254abe865f09a6295003043f5eb68a087010c667 Mon Sep 17 00:00:00 2001 From: WangFengTu Date: Mon, 22 Mar 2021 11:27:26 +0800 Subject: [PATCH] fix compile options Signed-off-by: WangFengTu --- 0002-fix-compile-options.patch | 42 ++++++++++++++++++++++++++++++++++ kubernetes.spec | 1 + 2 files changed, 43 insertions(+) create mode 100644 0002-fix-compile-options.patch diff --git a/0002-fix-compile-options.patch b/0002-fix-compile-options.patch new file mode 100644 index 0000000..00d6ab4 --- /dev/null +++ b/0002-fix-compile-options.patch @@ -0,0 +1,42 @@ +From 6a391681438e9b48b898f4e7eff532232047a327 Mon Sep 17 00:00:00 2001 +From: WangFengTu +Date: Mon, 22 Mar 2021 11:24:29 +0800 +Subject: [PATCH] fix compile options + +Signed-off-by: WangFengTu +--- + hack/lib/golang.sh | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +diff --git a/hack/lib/golang.sh b/hack/lib/golang.sh +index bef1d837..c628ec3f 100755 +--- a/hack/lib/golang.sh ++++ b/hack/lib/golang.sh +@@ -701,6 +701,7 @@ kube::golang::build_binaries_for_platform() { + -installsuffix static + ${goflags:+"${goflags[@]}"} + -gcflags "${gogcflags:-}" ++ -buildmode=pie + -asmflags "${goasmflags:-}" + -ldflags "${goldflags:-}" + -tags "${gotags:-}" +@@ -712,6 +713,7 @@ kube::golang::build_binaries_for_platform() { + build_args=( + ${goflags:+"${goflags[@]}"} + -gcflags "${gogcflags:-}" ++ -buildmode=pie + -asmflags "${goasmflags:-}" + -ldflags "${goldflags:-}" + -tags "${gotags:-}" +@@ -787,7 +789,7 @@ kube::golang::build_binaries() { + # Disable SC2153 for this, as it will throw a warning that the local + # variable goldflags will exist, and it suggest changing it to this. + # shellcheck disable=SC2153 +- goldflags="${GOLDFLAGS=-s -w -buildid=} $(kube::version::ldflags)" ++ goldflags="${GOLDFLAGS=-s -w -buildid=} $(kube::version::ldflags) -extldflags -zrelro -extldflags -znow" + goasmflags="-trimpath=${KUBE_ROOT}" + gogcflags="${GOGCFLAGS:-} -trimpath=${KUBE_ROOT}" + +-- +2.25.1 + diff --git a/kubernetes.spec b/kubernetes.spec index 8a956b1..b7f2c16 100644 --- a/kubernetes.spec +++ b/kubernetes.spec @@ -25,6 +25,7 @@ Source14: kubeadm.conf Source15: kubernetes.conf Patch6000: 0001-kubelet-support-exec-websocket-protocol.patch +Patch6001: 0002-fix-compile-options.patch %description Container cluster management. -- Gitee