aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/internal/obj
diff options
context:
space:
mode:
Diffstat (limited to 'src/cmd/internal/obj')
-rw-r--r--src/cmd/internal/obj/ppc64/obj9.go19
1 files changed, 18 insertions, 1 deletions
diff --git a/src/cmd/internal/obj/ppc64/obj9.go b/src/cmd/internal/obj/ppc64/obj9.go
index ab7e0f6a77..5b7612429e 100644
--- a/src/cmd/internal/obj/ppc64/obj9.go
+++ b/src/cmd/internal/obj/ppc64/obj9.go
@@ -38,6 +38,7 @@ import (
"internal/buildcfg"
"log"
"math/bits"
+ "strings"
)
// Test if this value can encoded as a mask for
@@ -73,6 +74,22 @@ func encodePPC64RLDCMask(mask int64) (mb, me int) {
return mb, me - 1
}
+// Is this a symbol which should never have a TOC prologue generated?
+// These are special functions which should not have a TOC regeneration
+// prologue.
+func isNOTOCfunc(name string) bool {
+ switch {
+ case name == "runtime.duffzero":
+ return true
+ case name == "runtime.duffcopy":
+ return true
+ case strings.HasPrefix(name, "runtime.elf_"):
+ return true
+ default:
+ return false
+ }
+}
+
func progedit(ctxt *obj.Link, p *obj.Prog, newprog obj.ProgAlloc) {
p.From.Class = 0
p.To.Class = 0
@@ -794,7 +811,7 @@ func preprocess(ctxt *obj.Link, cursym *obj.LSym, newprog obj.ProgAlloc) {
q = p
- if NeedTOCpointer(c.ctxt) && c.cursym.Name != "runtime.duffzero" && c.cursym.Name != "runtime.duffcopy" {
+ if NeedTOCpointer(c.ctxt) && !isNOTOCfunc(c.cursym.Name) {
// When compiling Go into PIC, without PCrel support, all functions must start
// with instructions to load the TOC pointer into r2:
//