Skip to content

Commit 4338e5a

Browse files
committed
cmd/link/internal: remove global Ctxt variable
This change threads the *ld.Link Ctxt variable through code in arch-specific packages. This removes all remaining uses of Ctxt, so remove the global variable too. This CL continues the work in golang.org/cl/27408 Updates #16818 Change-Id: I5f4536847a1825fd0b944824e8ae4e122ec0fb78 Reviewed-on: https://go-review.googlesource.com/27459 Run-TryBot: Michael Matloob <[email protected]> Reviewed-by: Brad Fitzpatrick <[email protected]> TryBot-Result: Gobot Gobot <[email protected]>
1 parent e2b30e9 commit 4338e5a

File tree

20 files changed

+511
-521
lines changed

20 files changed

+511
-521
lines changed

src/cmd/link/internal/amd64/asm.go

Lines changed: 102 additions & 102 deletions
Large diffs are not rendered by default.

src/cmd/link/internal/amd64/obj.go

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -82,9 +82,7 @@ func linkarchinit() {
8282
ld.Thearch.Solarisdynld = "/lib/amd64/ld.so.1"
8383
}
8484

85-
func archinit() {
86-
ctxt := ld.Ctxt
87-
85+
func archinit(ctxt *ld.Link) {
8886
// getgoextlinkenabled is based on GO_EXTLINK_ENABLED when
8987
// Go was built; see ../../make.bash.
9088
if ld.Linkmode == ld.LinkAuto && obj.Getgoextlinkenabled() == "0" {
@@ -153,7 +151,7 @@ func archinit() {
153151
obj.Hopenbsd, /* openbsd */
154152
obj.Hdragonfly, /* dragonfly */
155153
obj.Hsolaris: /* solaris */
156-
ld.Elfinit(ld.Ctxt)
154+
ld.Elfinit(ctxt)
157155

158156
ld.HEADR = ld.ELFRESERVE
159157
if ld.INITTEXT == -1 {
@@ -167,7 +165,7 @@ func archinit() {
167165
}
168166

169167
case obj.Hnacl:
170-
ld.Elfinit(ld.Ctxt)
168+
ld.Elfinit(ctxt)
171169
ld.Debug['w']++ // disable dwarf, which gets confused and is useless anyway
172170
ld.HEADR = 0x10000
173171
ld.Funcalign = 32

0 commit comments

Comments
 (0)