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 <dmitshur@golang.org>
Auto-Submit: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
This commit is contained in:
Ian Lance Taylor 2022-08-07 19:21:15 -07:00 committed by Gopher Robot
parent 3315066f46
commit 365ca69472
1 changed files with 3 additions and 1 deletions

View File

@ -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