From 0b6e3127e8a003ad01b9cfb6896dee14c637701b Mon Sep 17 00:00:00 2001 From: Rainer Orth Date: Thu, 14 Feb 2019 17:47:49 +0000 Subject: Provide __start_minfo/__stop_minfo for linkers that don't (PR d/87864) libphobos: PR d/87864 * configure.ac (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): Use -Wc instead of -Xcompiler. Add -dstartfiles -B../src -Bgcc. (libgdruntime_la_DEPENDENCIES): New variable. (unittest_static_LDFLAGS): Use -Wc instead of -Xcompiler. (libgdruntime_t_la_LDFLAGS): Likewise. (unittest_LDFLAGS): Likewise. * src/Makefile.am (libgphobos_la_LDFLAGS): Use -Wc instead of -Xcompiler. Add -dstartfiles -B../libdruntime/gcc. (unittest_static_LDFLAGS): Use -Wc instead of -Xcompiler. (libgphobos_t_la_LDFLAGS): Likewise. (unittest_LDFLAGS): Likewise. * libdruntime/Makefile.in, src/Makefile.in: Regenerate. * Makefile.in, testsuite/Makefile.in: Regenerate. * libdruntime/rt/sections_elf_shared.d (Minfo_Bracketing): Don't assert. * libdruntime/gcc/config.d.in (Minfo_Bracketing): Remove. * 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. gcc/d: PR d/87864 * lang.opt (dstartfiles): New option. * d-spec.cc (need_spec): New variable. (lang_specific_driver) : 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. From-SVN: r268886 --- gcc/d/ChangeLog | 8 ++++++++ gcc/d/d-spec.cc | 9 ++++++++- gcc/d/lang.opt | 4 ++++ gcc/testsuite/ChangeLog | 6 ++++++ gcc/testsuite/lib/gdc.exp | 4 ++++ 5 files changed, 30 insertions(+), 1 deletion(-) (limited to 'gcc') diff --git a/gcc/d/ChangeLog b/gcc/d/ChangeLog index 151fe1c..6eb2ac4 100644 --- a/gcc/d/ChangeLog +++ b/gcc/d/ChangeLog @@ -1,3 +1,11 @@ +2019-02-14 Rainer Orth + + PR d/87864 + * lang.opt (dstartfiles): New option. + * d-spec.cc (need_spec): New variable. + (lang_specific_driver) : Enable need_spec. + (lang_specific_pre_link): Also load libgphobos.spec if need_spec. + 2019-01-26 Iain Buclaw PR d/89042 diff --git a/gcc/d/d-spec.cc b/gcc/d/d-spec.cc index 724e5d2..3d491f5 100644 --- a/gcc/d/d-spec.cc +++ b/gcc/d/d-spec.cc @@ -72,6 +72,9 @@ static phobos_action phobos_library = PHOBOS_DEFAULT; standard libraries. */ static bool need_phobos = true; +/* If true, do load libgphobos.spec even if not needed otherwise. */ +static bool need_spec = false; + void lang_specific_driver (cl_decoded_option **in_decoded_options, unsigned int *in_decoded_options_count, @@ -144,6 +147,10 @@ lang_specific_driver (cl_decoded_option **in_decoded_options, switch (decoded_options[i].opt_index) { + case OPT_dstartfiles: + need_spec = true; + break; + case OPT_nostdlib: case OPT_nodefaultlibs: phobos_library = PHOBOS_NOLINK; @@ -491,7 +498,7 @@ lang_specific_driver (cl_decoded_option **in_decoded_options, int lang_specific_pre_link (void) { - if (phobos_library != PHOBOS_NOLINK && need_phobos) + if ((phobos_library != PHOBOS_NOLINK && need_phobos) || need_spec) do_spec ("%:include(libgphobos.spec)"); return 0; diff --git a/gcc/d/lang.opt b/gcc/d/lang.opt index 83d3d21..523f73c 100644 --- a/gcc/d/lang.opt +++ b/gcc/d/lang.opt @@ -162,6 +162,10 @@ defaultlib= Driver Joined Default library to use instead of phobos. +dstartfiles +Driver +Do link the standard D startup files in the compilation. + -verbose D Alias(v) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 4d2a236..bec48f2 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2019-02-14 Rainer Orth + + PR d/87864 + * lib/gdc.exp (gdc_link_flags): Add path to drtbegin.o/drtend.o if + present. + 2019-02-14 Tamar Christina PR target/88850 diff --git a/gcc/testsuite/lib/gdc.exp b/gcc/testsuite/lib/gdc.exp index c749c4c..1bc45b9 100644 --- a/gcc/testsuite/lib/gdc.exp +++ b/gcc/testsuite/lib/gdc.exp @@ -120,6 +120,10 @@ proc gdc_link_flags { paths } { if { $gccpath != "" } { # Path to libgphobos.spec. append flags "-B${gccpath}/libphobos/src " + # Path to drtbegin.o/drtend.o. + if { [file exists "${gccpath}/libphobos/libdruntime/gcc/drtbegin.o"] } { + append flags "-B${gccpath}/libphobos/libdruntime/gcc " + } if { [file exists "${gccpath}/libphobos/src/.libs/libgphobos.a"] \ || [file exists "${gccpath}/libphobos/src/.libs/libgphobos.${shlib_ext}"] } { -- cgit v1.1