On Tue, 29 Jan 2019 at 13:24, Rainer Orth <r...@cebitec.uni-bielefeld.de> wrote:
>
> 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
>
> --
> -----------------------------------------------------------------------------
> Rainer Orth, Center for Biotechnology, Bielefeld University
>
>
> 2018-11-20  Rainer Orth  <r...@cebitec.uni-bielefeld.de>
>
>         libphobos:
>         PR d/87864
>         * configure.ac [!DCFG_MINFO_BRACKETING] (DRTSTUFF_SPEC): New variable.
>         Substitute it.
>         * libdruntime/m4/druntime/os.m4 (DRUNTIME_OS_MINFO_BRACKETING):
>         New automake conditional.
>         * configure: Regenerate.
>         * libdruntime/gcc/drtstuff.c: New file.
>         * libdruntime/Makefile.am [!DRUNTIME_OS_MINFO_BRACKETING]
>         (DRTSTUFF, toolexeclib_DATA): New variables.
>         (gcc/drtbegin.lo, gcc/drtend.lo): New rules.
>         (libgdruntime_la_LDFLAGS): Add -dstartfiles -Bgcc -B../src.
>         (libgdruntime_la_DEPENDENCIES): New variable.
>         * src/Makefile.am (libgphobos_la_LDFLAGS): Add -dstartfiles
>         -B../libdruntime/gcc.
>         * libdruntime/Makefile.in, src/Makefile.in: Regenerate.
>         * Makefile.in, testsuite/Makefile.in: Regenerate.
>         * libdruntime/rt/sections_elf_shared.d (Minfo_Bracketing): Don't
>         assert.
>         * src/drtstuff.spec: New file.
>         * src/libgphobos.spec.in (DRTSTUFF_SPEC): Substitute.
>         (*lib): Only pass SPEC_PHOBOS_DEPS without -debuglib, -defaultlib,
>         -nophoboslib.
>         * testsuite/testsuite_flags.in <--gdcldflags> (GDCLDFLAGS): Add
>         -B${BUILD_DIR}/libdruntime/gcc.
>
>         * libdruntime/Makefile.am (unittest_static_LDFLAGS): Use -Wc
>         instead of -Xcompiler.
>         (libgdruntime_t_la_LDFLAGS): Likewise.
>         (unittest_LDFLAGS): Likewise.
>         * src/Makefile.am (unittest_static_LDFLAGS): Likewise.
>         (libgphobos_t_la_LDFLAGS): Likewise.
>         (unittest_LDFLAGS): Likewise.
>
>         gcc/d:
>         PR d/87864
>         * lang.opt (dstartfiles): New option.
>         * d-spec.cc (need_spec): New variable.
>         (lang_specific_driver) <OPT_dstartfiles>: Enable need_spec.
>         (lang_specific_pre_link): Also load libgphobos.spec if need_spec.
>
>         gcc/testsuite:
>         PR d/87864
>         * lib/gdc.exp (gdc_link_flags): Add path to drtbegin.o/drtend.o if
>         present.
>

I'd say go for it.  I see that there's a tab that found its way into
lib/gdc.exp, and there's a copyright notice that needs fixing up.

I'd make another change after this, and move / remove the
rt/sections_*.d modules to gcc/sections/*.d, as those modules mirrored
from upstream are all very specific to the dmd compiler itself, and I
don't think will be able to use sections_osx or sections_win32
verbatim in the same way as sections_elf_shared.

-- 
Iain

Reply via email to