Strings have relocations, and data relocations are bad.
Other literals are fine.
Fixes build failure in pending CL 628776.
Change-Id: I7a38bbff9776a365c5823d54c4a00e068dda5d9a
Reviewed-on: https://go-review.googlesource.com/c/go/+/628915
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: Robert Griesemer <gri@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Russ Cox <rsc@golang.org>
if ir.IsZero(r) {
return true
}
+ if disableGlobalAddrs && r.Type().IsString() {
+ return false
+ }
staticdata.InitConst(l, loff, r, int(typ.Size()))
return true
func getdyn(n ir.Node, top bool) initGenType {
switch n.Op() {
default:
- if ir.IsConstNode(n) {
+ // Handle constants in linker, except that linker cannot do
+ // the relocations necessary for string constants in FIPS packages.
+ if ir.IsConstNode(n) && (!n.Type().IsString() || !base.Ctxt.IsFIPS()) {
return initConst
}
return initDynamic