Looks good to me, although ultimately Iain has to decide of course.
One nitpick: wouldn't you have to somehow mark __start/__stop _minfo as hidden? This is important in the case where you have multiple shared libraries and each library should have its own __start/__stop symbold to braket the library's minfo section.
Also 'if !DRUNTIME_OS_MINFO_BRACKETING' might be the wrong condition/name in Makefile.am if we add back support for per-module constructor-based module registration (instead of calling _d_dso_registry once per shared library passing all ModuleInfos in that library, call another hook _d_register_module once per module and pass only one ModuleInfo). But we can fix that if we ever need to add back support for that second approach. (If this startfile/endfile approach is portable enough, we may be able to avoid that).
Best regards, Johannes Am 29.01.19 um 13:24 schrieb Rainer Orth:
Solaris ld only gained support for section bracketing in Solaris 11.4. Fortunately, in gdc it is only used for the minfo section, so it's easy to provide a workaround by adding two additional startup files drt{begin,end}.o which define __start_minfo and __stop_minfo. This patch does just that. I've raised a couple of questions in the PR already: * I've introduced a new -dstartfiles option which triggers the use of libgphobos.spec even with -nophoboslib. Since it's effectively internal to the build system, I'm not currently documenting it. * I'm reading the spec file addition from a file: keeping it in a make variable would be extremely messy due to the necessary quoting. * I've chosen to use -Wc instead of -Xcompiler throughout: it's way shorter when more options need to be passed and it can take several comma-separated options at once. * libdruntime/gcc/drtstuff.c needs a copyright notice unless one wants to keep it in the public domain (also plausible). Effectively something for Iain to decide. Bootstrapped without regressions on i386-pc-solaris2.11 (Solaris 11.3), no regressions compared to Solaris 11.4 test results. Rainer