if !ctxt.Loaded {
panic("DynlinkingGo called before all symbols loaded")
}
- return ctxt.BuildMode == BuildModeShared || ctxt.linkShared || ctxt.BuildMode == BuildModePlugin || ctxt.CanUsePlugins()
+ return ctxt.BuildMode == BuildModeShared || ctxt.linkShared || ctxt.BuildMode == BuildModePlugin || ctxt.canUsePlugins
}
// CanUsePlugins reports whether a plugins can be used
func (ctxt *Link) CanUsePlugins() bool {
- return ctxt.Syms.ROLookup("plugin.Open", sym.SymVerABIInternal) != nil
+ if !ctxt.Loaded {
+ panic("CanUsePlugins called before all symbols loaded")
+ }
+ return ctxt.canUsePlugins
}
// UseRelro reports whether to make use of "read only relocations" aka
// We've loaded all the code now.
ctxt.Loaded = true
+ // Record whether we can use plugins.
+ ctxt.canUsePlugins = (ctxt.Syms.ROLookup("plugin.Open", sym.SymVerABIInternal) != nil)
+
// If there are no dynamic libraries needed, gcc disables dynamic linking.
// Because of this, glibc's dynamic ELF loader occasionally (like in version 2.13)
// assumes that a dynamic binary always refers to at least one dynamic library.