mirror of
https://github.com/golang/go
synced 2024-11-15 02:40:32 -07:00
b675a75c3d
On ARM64, in -dynlink mode (building a shared library or a plugin), accessing global variable is made using the GOT. Currently, the GOT accessing instruction sequence our assembler generates doesn't handle large offset well, so we don't fold the offset into loads and stores in the compiler. Currently, the rewrite rules are guarded with the -shared flag. However, the GOT access instructions are only generated in the -dynlink mode (which implies -shared, but not the other direction). CL 445535 attempted to remove the guard althgether. But that causes build failure for -dynlink mode for the reason above. This CL changes it to guard specifically on -dynlink mode, allowing the optimization in more cases (-shared but not -dynlink build modes). Updates #58826. Change-Id: I1391db6a33e8d0455a304e7cae7fcfdeb49bfdab Reviewed-on: https://go-review.googlesource.com/c/go/+/473999 Run-TryBot: Cherry Mui <cherryyz@google.com> Reviewed-by: Keith Randall <khr@golang.org> Reviewed-by: Keith Randall <khr@google.com> TryBot-Result: Gopher Robot <gobot@golang.org>
24 lines
478 B
Go
24 lines
478 B
Go
// compile -dynlink
|
|
|
|
//go:build 386 || amd64 || arm || arm64 || ppc64le || s390x
|
|
// (platforms that support -dynlink flag)
|
|
|
|
// Copyright 2023 The Go Authors. All rights reserved.
|
|
// Use of this source code is governed by a BSD-style
|
|
// license that can be found in the LICENSE file.
|
|
|
|
// Issue 58826: assembler cannot handle global access with large
|
|
// offset in -dynlink mode on ARM64.
|
|
|
|
package p
|
|
|
|
var x [2197]uint8
|
|
|
|
func F() {
|
|
for _, i := range x {
|
|
G(i)
|
|
}
|
|
}
|
|
|
|
func G(uint8)
|