From 5ce1fb94791ddae660818a03437fc17931a1eaab Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Sun, 7 Aug 2022 19:21:15 -0700 Subject: [PATCH] runtime/cgo: add -fno-stack-protector to CFLAGS Some compilers default to having -fstack-protector on, which breaks when using internal linking because the linker doesn't know how to find the support functions. Fixes #52919 Fixes #54313 Change-Id: I6f51d5e906503f61fc768ad8e30c163bad135087 Reviewed-on: https://go-review.googlesource.com/c/go/+/421935 Reviewed-by: Dmitri Shuralyov Auto-Submit: Ian Lance Taylor TryBot-Result: Gopher Robot Run-TryBot: Ian Lance Taylor Run-TryBot: Ian Lance Taylor Reviewed-by: Ian Lance Taylor Reviewed-by: Dmitri Shuralyov --- src/runtime/cgo/cgo.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/runtime/cgo/cgo.go b/src/runtime/cgo/cgo.go index 298aa6367530cc..4b7046e2cc62db 100644 --- a/src/runtime/cgo/cgo.go +++ b/src/runtime/cgo/cgo.go @@ -23,7 +23,9 @@ package cgo #cgo solaris LDFLAGS: -lxnet #cgo solaris LDFLAGS: -lsocket -#cgo CFLAGS: -Wall -Werror +// We use -fno-stack-protector because internal linking won't find +// the support functions. See issues #52919 and #54313. +#cgo CFLAGS: -Wall -Werror -fno-stack-protector #cgo solaris CPPFLAGS: -D_POSIX_PTHREAD_SEMANTICS