cmd/link: call moduledata symbols "local.moduledata" if they are created by the linker
This was always a bit confusing, but it also fixes a problem: runtime.firstmoduledata
was always overridden in the linker to be a local symbol but cmd/internal/obj had
already rewritten code accessing it to access it via the GOT. This works on amd64, but
causes link failures on other platforms (e.g. arm64).
Change-Id: I9b8153af74b4d0f092211d63a000d15818f39773
Reviewed-on: https://go-review.googlesource.com/13786
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
diff --git a/src/cmd/link/internal/ld/link.go b/src/cmd/link/internal/ld/link.go
index 33b17c5..5415434 100644
--- a/src/cmd/link/internal/ld/link.go
+++ b/src/cmd/link/internal/ld/link.go
@@ -121,31 +121,32 @@
}
type Link struct {
- Thechar int32
- Thestring string
- Goarm int32
- Headtype int
- Arch *LinkArch
- Debugasm int32
- Debugvlog int32
- Bso *obj.Biobuf
- Windows int32
- Goroot string
- Hash map[symVer]*LSym
- Allsym *LSym
- Nsymbol int32
- Tlsg *LSym
- Libdir []string
- Library []*Library
- Shlibs []Shlib
- Tlsoffset int
- Diag func(string, ...interface{})
- Cursym *LSym
- Version int
- Textp *LSym
- Etextp *LSym
- Nhistfile int32
- Filesyms *LSym
+ Thechar int32
+ Thestring string
+ Goarm int32
+ Headtype int
+ Arch *LinkArch
+ Debugasm int32
+ Debugvlog int32
+ Bso *obj.Biobuf
+ Windows int32
+ Goroot string
+ Hash map[symVer]*LSym
+ Allsym *LSym
+ Nsymbol int32
+ Tlsg *LSym
+ Libdir []string
+ Library []*Library
+ Shlibs []Shlib
+ Tlsoffset int
+ Diag func(string, ...interface{})
+ Cursym *LSym
+ Version int
+ Textp *LSym
+ Etextp *LSym
+ Nhistfile int32
+ Filesyms *LSym
+ Moduledata *LSym
}
type LinkArch struct {