From 19d792c1eb4342895f9d41d03ab931e9e26c7d78 Mon Sep 17 00:00:00 2001 From: Austin Clements Date: Wed, 7 Sep 2022 12:19:53 -0400 Subject: [PATCH] [release-branch.go1.19] 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 #54764 (Original fix by Ian Lance Taylor ) Change-Id: I2d8cb7fb780de4cd37314af3957b8f429b1e4b70 Reviewed-on: https://go-review.googlesource.com/c/go/+/429138 Run-TryBot: Austin Clements TryBot-Result: Gopher Robot Reviewed-by: Ian Lance Taylor --- 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 298aa63675..4b7046e2cc 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 -- 2.50.0