From ed51f4be525cbaf5d2fa508260e1ecc80c95dd25 Mon Sep 17 00:00:00 2001 From: liuxu Date: Fri, 26 Apr 2024 10:30:18 +0800 Subject: [PATCH] fix compile options Signed-off-by: liuxu --- 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 f3466ff7..0cc59787 100755 --- a/hack/lib/golang.sh +++ b/hack/lib/golang.sh @@ -781,6 +781,7 @@ kube::golang::build_binaries_for_platform() { -installsuffix=static ${goflags:+"${goflags[@]}"} -gcflags="${gogcflags}" + -buildmode=pie -asmflags="${goasmflags}" -ldflags="${goldflags}" -tags="${gotags:-}" @@ -792,6 +793,7 @@ kube::golang::build_binaries_for_platform() { build_args=( ${goflags:+"${goflags[@]}"} -gcflags="${gogcflags}" + -buildmode=pie -asmflags="${goasmflags}" -ldflags="${goldflags}" -tags="${gotags:-}" @@ -881,7 +883,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.34.1