mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
cmd/internal/obj, cmd/link, runtime: lots of TLS cleanup
It's particularly nice to get rid of the android special cases in the linker. Change-Id: I516363af7ce8a6b2f196fe49cb8887ac787a6dad Reviewed-on: https://go-review.googlesource.com/14197 Run-TryBot: Michael Hudson-Doyle <michael.hudson@canonical.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
This commit is contained in:
parent
1ef9b5a5b9
commit
a5cb76243a
15 changed files with 27 additions and 132 deletions
|
|
@ -307,7 +307,7 @@ func (mode *BuildMode) Set(s string) error {
|
|||
}
|
||||
*mode = BuildmodeCShared
|
||||
case "shared":
|
||||
if goos != "linux" || goarch != "amd64" {
|
||||
if goos != "linux" || (goarch != "amd64" && goarch != "arm") {
|
||||
return badmode()
|
||||
}
|
||||
*mode = BuildmodeShared
|
||||
|
|
@ -549,17 +549,14 @@ func loadlib() {
|
|||
|
||||
tlsg := Linklookup(Ctxt, "runtime.tlsg", 0)
|
||||
|
||||
// For most ports, runtime.tlsg is a placeholder symbol for TLS
|
||||
// relocation. However, the Android and Darwin arm ports need it
|
||||
// to be a real variable.
|
||||
//
|
||||
// TODO(crawshaw): android should require leaving the tlsg->type
|
||||
// alone (as the runtime-provided SNOPTRBSS) just like darwin/arm.
|
||||
// But some other part of the linker is expecting STLSBSS.
|
||||
if tlsg.Type != obj.SDYNIMPORT && (goos != "darwin" || Thearch.Thechar != '5') {
|
||||
// runtime.tlsg is used for external linking on platforms that do not define
|
||||
// a variable to hold g in assembly (currently only intel).
|
||||
if tlsg.Type == 0 {
|
||||
tlsg.Type = obj.STLSBSS
|
||||
tlsg.Size = int64(Thearch.Ptrsize)
|
||||
} else if tlsg.Type != obj.SDYNIMPORT {
|
||||
Diag("internal error: runtime declared tlsg variable %d", tlsg.Type)
|
||||
}
|
||||
tlsg.Size = int64(Thearch.Ptrsize)
|
||||
tlsg.Reachable = true
|
||||
Ctxt.Tlsg = tlsg
|
||||
|
||||
|
|
@ -1821,13 +1818,7 @@ func genasmsym(put func(*LSym, string, int, int64, int64, int, *LSym)) {
|
|||
|
||||
case obj.STLSBSS:
|
||||
if Linkmode == LinkExternal && HEADTYPE != obj.Hopenbsd {
|
||||
var type_ int
|
||||
if goos == "android" {
|
||||
type_ = 'B'
|
||||
} else {
|
||||
type_ = 't'
|
||||
}
|
||||
put(s, s.Name, type_, Symaddr(s), s.Size, int(s.Version), s.Gotype)
|
||||
put(s, s.Name, 't', Symaddr(s), s.Size, int(s.Version), s.Gotype)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue