43 lines
1.3 KiB
Diff
43 lines
1.3 KiB
Diff
From d49390e67b2d3027c8c0ad799bf294a89d4d149f Mon Sep 17 00:00:00 2001
|
|
From: zhangxiaoyu <zhangxiaoyu58@huawei.com>
|
|
Date: Thu, 20 Jul 2023 17:27:05 +0800
|
|
Subject: [PATCH] fix compile options
|
|
|
|
Signed-off-by: zhangxiaoyu <zhangxiaoyu58@huawei.com>
|
|
---
|
|
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 232c17b3..c6cbce44 100755
|
|
--- a/hack/lib/golang.sh
|
|
+++ b/hack/lib/golang.sh
|
|
@@ -744,6 +744,7 @@ kube::golang::build_binaries_for_platform() {
|
|
-installsuffix=static
|
|
${goflags:+"${goflags[@]}"}
|
|
-gcflags="${gogcflags}"
|
|
+ -buildmode=pie
|
|
-asmflags="${goasmflags}"
|
|
-ldflags="${goldflags}"
|
|
-tags="${gotags:-}"
|
|
@@ -755,6 +756,7 @@ kube::golang::build_binaries_for_platform() {
|
|
build_args=(
|
|
${goflags:+"${goflags[@]}"}
|
|
-gcflags="${gogcflags}"
|
|
+ -buildmode=pie
|
|
-asmflags="${goasmflags}"
|
|
-ldflags="${goldflags}"
|
|
-tags="${gotags:-}"
|
|
@@ -844,7 +846,7 @@ kube::golang::build_binaries() {
|
|
goasmflags=""
|
|
fi
|
|
|
|
- goldflags="all=$(kube::version::ldflags) ${GOLDFLAGS:-}"
|
|
+ goldflags="all=$(kube::version::ldflags) ${GOLDFLAGS:-} -linkmode=external"
|
|
if [[ "${DBG:-}" != 1 ]]; then
|
|
# Not debugging - disable symbols and DWARF.
|
|
goldflags="${goldflags} -s -w"
|
|
--
|
|
2.25.1
|
|
|