@@ -155,7 +155,7 @@ type Section struct {
155155
156156// DynlinkingGo returns whether we are producing Go code that can live
157157// in separate shared libraries linked together at runtime.
158- func DynlinkingGo () bool {
158+ func ( ctxt * Link ) DynlinkingGo () bool {
159159 return Buildmode == BuildmodeShared || * FlagLinkshared
160160}
161161
@@ -307,7 +307,7 @@ func libinit(ctxt *Link) {
307307 }
308308 }
309309
310- if ! DynlinkingGo () {
310+ if ! ctxt . DynlinkingGo () {
311311 Linklookup (ctxt , * flagEntrySymbol , 0 ).Type = obj .SXREF
312312 }
313313}
@@ -466,7 +466,7 @@ func (ctxt *Link) loadlib() {
466466 if ctxt .Library [i ].Shlib != "" {
467467 ldshlibsyms (ctxt , ctxt .Library [i ].Shlib )
468468 } else {
469- if DynlinkingGo () {
469+ if ctxt . DynlinkingGo () {
470470 Exitf ("cannot implicitly include runtime/cgo in a shared library" )
471471 }
472472 objfile (ctxt , ctxt .Library [i ])
@@ -998,7 +998,7 @@ func (l *Link) hostlink() {
998998 argv = append (argv , "-shared" )
999999 }
10001000
1001- if Iself && DynlinkingGo () {
1001+ if Iself && l . DynlinkingGo () {
10021002 // We force all symbol resolution to be done at program startup
10031003 // because lazy PLT resolution can use large amounts of stack at
10041004 // times we cannot allow it to do so.
@@ -1639,7 +1639,7 @@ func stkcheck(ctxt *Link, up *chain, depth int) int {
16391639 // should never be called directly.
16401640 // onlyctxt.Diagnose the direct caller.
16411641 // TODO(mwhudson): actually think about this.
1642- if depth == 1 && s .Type != obj .SXREF && ! DynlinkingGo () &&
1642+ if depth == 1 && s .Type != obj .SXREF && ! ctxt . DynlinkingGo () &&
16431643 Buildmode != BuildmodeCArchive && Buildmode != BuildmodePIE && Buildmode != BuildmodeCShared {
16441644 ctxt .Diag ("call to external function %s" , s .Name )
16451645 }
0 commit comments