From 8b6e01840163b12f1872a922f8fe9ed8d010885f Mon Sep 17 00:00:00 2001 From: Guillaume Ballet <3272758+gballet@users.noreply.github.com> Date: Mon, 11 Oct 2021 15:48:41 +0200 Subject: [PATCH] build: increase C thread stack size on linux (#23676) * build: increase thread stack size when running alpine linux * review feedback: force a stack size of 8M on all linux distribs * fix missing extldflags --- build/ci.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/build/ci.go b/build/ci.go index 32e4a5273a..7bba489573 100644 --- a/build/ci.go +++ b/build/ci.go @@ -260,6 +260,11 @@ func buildFlags(env build.Environment) (flags []string) { if runtime.GOOS == "darwin" { ld = append(ld, "-s") } + // Enforce the stacksize to 8M, which is the case on most platforms apart from + // alpine Linux. + if runtime.GOOS == "linux" { + ld = append(ld, "-extldflags", "-Wl,-z,stack-size=0x800000") + } if len(ld) > 0 { flags = append(flags, "-ldflags", strings.Join(ld, " ")) }