From 48f4728211c1c4299728b6b3a04a6ddf997d9ec6 Mon Sep 17 00:00:00 2001 From: Than McIntosh Date: Thu, 9 Feb 2023 11:31:57 -0500 Subject: [PATCH] cmd/cgo: add -fno-stack-protector to CFLAGS (again) Add -fno-stack-protector back to the default set of CFLAGS for cgo, so as to avoid problems with internal linking locating the library containing the "__stack_chk_fail_local" support function that some compilers emit (the specific archive can vary based on GOOS). Updates #52919. Updates #54313. Updates #57261. Updates #58385. Change-Id: I4591bfb15501f04b7afe1fcd50c4fb93c86db63d Reviewed-on: https://go-review.googlesource.com/c/go/+/466935 Reviewed-by: Ian Lance Taylor Run-TryBot: Than McIntosh TryBot-Result: Gopher Robot --- 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 6d721bc8ff..1e3a502918 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 +// Use -fno-stack-protector to avoid problems locating the +// proper support functions. See issues #52919, #54313, #58385. +#cgo CFLAGS: -Wall -Werror -fno-stack-protector #cgo solaris CPPFLAGS: -D_POSIX_PTHREAD_SEMANTICS -- 2.51.0