blob: cc92a444a7bae3bf40b761586df0cd02e45f6503 [file] [log] [blame]
Patrick Williams92b42cb2022-09-03 06:53:57 -05001From c537b87782293fe222f2ef5eb1ae818092118e97 Mon Sep 17 00:00:00 2001
2From: Ian Lance Taylor <iant@golang.org>
3Date: Sun, 07 Aug 2022 19:21:15 -0700
4Subject: [PATCH] runtime/cgo: add -fno-stack-protector to CFLAGS
5
6Some compilers default to having -fstack-protector on, which breaks
7when using internal linking because the linker doesn't know how to
8find the support functions.
9
10Fixes #52919
11Fixes #54313
12
13Change-Id: I6f51d5e906503f61fc768ad8e30c163bad135087
14Upstream-Status: Submitted [https://github.com/golang/go/issues/54313]
15Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com>
16---
17
18diff --git a/src/runtime/cgo/cgo.go b/src/runtime/cgo/cgo.go
19index 298aa63..4b7046e 100644
20--- a/src/runtime/cgo/cgo.go
21+++ b/src/runtime/cgo/cgo.go
22@@ -23,7 +23,9 @@
23 #cgo solaris LDFLAGS: -lxnet
24 #cgo solaris LDFLAGS: -lsocket
25
26-#cgo CFLAGS: -Wall -Werror
27+// We use -fno-stack-protector because internal linking won't find
28+// the support functions. See issues #52919 and #54313.
29+#cgo CFLAGS: -Wall -Werror -fno-stack-protector
30
31 #cgo solaris CPPFLAGS: -D_POSIX_PTHREAD_SEMANTICS
32