Go plugins loading and initialization

When loading plugins (assembled with the -buildmode=plugin option) in the plugin/plugin_dlopen.go code in the ‘func open (name string)’ function after calling C.pluginOpen, which is a wrapper over dlopen () and nothing more, by the time the lastmoduleinit function was called, in the global variable ‘var firstmoduledata moduledata’ a structure appears that describes the plug-in just loaded.
As far as I understand from reading the source code of the runtime, some code reads the .init_array section of the .so file and executes the exported go.link.addmoduledata function, the pointer to which is in the .init_array section.
Tell please, what code in runtime adds a plugin to the variable firstmoduledata when loading .so files?

Thank you.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.