mirror of
https://github.com/golang/go.git
synced 2025-05-16 04:44:39 +00:00
Revert "cmd/link: only embed runtime.goarm in the module that contains the runtime package"
This reverts commit bf99d8f843ae3dfa7a3a4cd5c17aec79e2b9997f. Change-Id: Id4374ed35802cfbfe11e015ccd9526d3497dc8cc Reviewed-on: https://go-review.googlesource.com/14239 Reviewed-by: Dave Cheney <dave@cheney.net>
This commit is contained in:
parent
37025536c3
commit
c788a8e05d
@ -169,4 +169,10 @@ func archinit() {
|
|||||||
if ld.INITDAT != 0 && ld.INITRND != 0 {
|
if ld.INITDAT != 0 && ld.INITRND != 0 {
|
||||||
fmt.Printf("warning: -D0x%x is ignored because of -R0x%x\n", uint64(ld.INITDAT), uint32(ld.INITRND))
|
fmt.Printf("warning: -D0x%x is ignored because of -R0x%x\n", uint64(ld.INITDAT), uint32(ld.INITRND))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// embed goarm to runtime.goarm
|
||||||
|
s := ld.Linklookup(ld.Ctxt, "runtime.goarm", 0)
|
||||||
|
|
||||||
|
s.Type = obj.SRODATA
|
||||||
|
ld.Adduint8(ld.Ctxt, s, uint8(ld.Ctxt.Goarm))
|
||||||
}
|
}
|
||||||
|
@ -558,30 +558,19 @@ func loadlib() {
|
|||||||
Ctxt.Tlsg = tlsg
|
Ctxt.Tlsg = tlsg
|
||||||
|
|
||||||
moduledata := Linklookup(Ctxt, "runtime.firstmoduledata", 0)
|
moduledata := Linklookup(Ctxt, "runtime.firstmoduledata", 0)
|
||||||
if moduledata.Type != 0 && moduledata.Type != obj.SDYNIMPORT {
|
if moduledata.Type == 0 || moduledata.Type == obj.SDYNIMPORT {
|
||||||
// If the module (toolchain-speak for "executable or shared
|
// If the module we are linking does not define the
|
||||||
// library") we are linking contains the runtime package, it
|
// runtime.firstmoduledata symbol, create a local symbol for
|
||||||
// will define the runtime.firstmoduledata symbol and we
|
// the moduledata.
|
||||||
// truncate it back to 0 bytes so we can define its entire
|
|
||||||
// contents in symtab.go:symtab().
|
|
||||||
moduledata.Size = 0
|
|
||||||
|
|
||||||
// In addition, on ARM, the runtime depends on the linker
|
|
||||||
// recording the value of GOARM.
|
|
||||||
if Thearch.Thechar == '5' {
|
|
||||||
s := Linklookup(Ctxt, "runtime.goarm", 0)
|
|
||||||
|
|
||||||
s.Type = obj.SRODATA
|
|
||||||
Adduint8(Ctxt, s, uint8(Ctxt.Goarm))
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
// If OTOH the module does not contain the runtime package,
|
|
||||||
// create a local symbol for the moduledata.
|
|
||||||
moduledata = Linklookup(Ctxt, "local.moduledata", 0)
|
moduledata = Linklookup(Ctxt, "local.moduledata", 0)
|
||||||
moduledata.Local = true
|
moduledata.Local = true
|
||||||
|
} else {
|
||||||
|
// If OTOH the module does define the symbol, we truncate the
|
||||||
|
// symbol back to 0 bytes so we can define its entire
|
||||||
|
// contents.
|
||||||
|
moduledata.Size = 0
|
||||||
}
|
}
|
||||||
// In all cases way we mark the moduledata as noptrdata to hide it from
|
// Either way we mark it as noptrdata to hide it from the GC.
|
||||||
// the GC.
|
|
||||||
moduledata.Type = obj.SNOPTRDATA
|
moduledata.Type = obj.SNOPTRDATA
|
||||||
moduledata.Reachable = true
|
moduledata.Reachable = true
|
||||||
Ctxt.Moduledata = moduledata
|
Ctxt.Moduledata = moduledata
|
||||||
|
Loading…
x
Reference in New Issue
Block a user