mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
cmd/internal/gc: directly produce importpath of package being compiled
Relying on an importing package being linked at the same time as the imported package does not work in the shared library world. This also lets us remove some obscure code from the linker. Change-Id: I57cd5447b42a1a6129b02951d44efffb10cf64be Reviewed-on: https://go-review.googlesource.com/7797 Reviewed-by: Russ Cox <rsc@golang.org>
This commit is contained in:
parent
8d267b9b59
commit
0de359da30
2 changed files with 19 additions and 23 deletions
|
|
@ -379,24 +379,6 @@ func loadlib() {
|
|||
if i < len(Ctxt.Library) {
|
||||
objfile(Ctxt.Library[i].File, Ctxt.Library[i].Pkg)
|
||||
}
|
||||
|
||||
// Pretend that we really imported the package.
|
||||
s := Linklookup(Ctxt, "go.importpath.runtime/cgo.", 0)
|
||||
|
||||
s.Type = SDATA
|
||||
s.Dupok = 1
|
||||
s.Reachable = true
|
||||
|
||||
// Provided by the code that imports the package.
|
||||
// Since we are simulating the import, we have to provide this string.
|
||||
cgostrsym := "go.string.\"runtime/cgo\""
|
||||
|
||||
if Linkrlookup(Ctxt, cgostrsym, 0) == nil {
|
||||
s := Linklookup(Ctxt, cgostrsym, 0)
|
||||
s.Type = SRODATA
|
||||
s.Reachable = true
|
||||
addstrdata(cgostrsym, "runtime/cgo")
|
||||
}
|
||||
}
|
||||
|
||||
if Linkmode == LinkInternal {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue