Provide __start_minfo/__stop_minfo for linkers that don't (PR d/87864)
authorRainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
Thu, 14 Feb 2019 17:47:49 +0000 (17:47 +0000)
committerRainer Orth <ro@gcc.gnu.org>
Thu, 14 Feb 2019 17:47:49 +0000 (17:47 +0000)
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) <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.

From-SVN: r268886

19 files changed:
gcc/d/ChangeLog
gcc/d/d-spec.cc
gcc/d/lang.opt
gcc/testsuite/ChangeLog
gcc/testsuite/lib/gdc.exp
libphobos/ChangeLog
libphobos/configure
libphobos/configure.ac
libphobos/libdruntime/Makefile.am
libphobos/libdruntime/Makefile.in
libphobos/libdruntime/gcc/config.d.in
libphobos/libdruntime/gcc/drtstuff.c [new file with mode: 0644]
libphobos/libdruntime/rt/sections_elf_shared.d
libphobos/m4/druntime/os.m4
libphobos/src/Makefile.am
libphobos/src/Makefile.in
libphobos/src/drtstuff.spec [new file with mode: 0644]
libphobos/src/libgphobos.spec.in
libphobos/testsuite/testsuite_flags.in

index 151fe1c6ab1f62b2d6e9fce860dda8f577b8d680..6eb2ac488e66a3b631f3f5c4949cf1f131bd86fa 100644 (file)
@@ -1,3 +1,11 @@
+2019-02-14  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
+
+       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.
+
 2019-01-26  Iain Buclaw  <ibuclaw@gdcproject.org>
 
        PR d/89042
index 724e5d2f5d4c3b04da230ab1393dfc8d02818c8b..3d491f56fa7c8e7fb832d53fddf789d7dc2dc2e2 100644 (file)
@@ -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;
index 83d3d21a1a68b2da753ff572b7f894ea35ded615..523f73c90de06bea8c58da015fb465753692a937 100644 (file)
@@ -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)
 
index 4d2a2363183923a35d74e2efe9d929cd6e9d18c5..bec48f2ab245ee814b2b35d0b8b1869111ef981a 100644 (file)
@@ -1,3 +1,9 @@
+2019-02-14  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
+
+       PR d/87864
+       * lib/gdc.exp (gdc_link_flags): Add path to drtbegin.o/drtend.o if
+       present.
+
 2019-02-14  Tamar Christina  <tamar.christina@arm.com>
 
        PR target/88850
index c749c4c055d6584d1e59de143ea9810a66ad9a2a..1bc45b9206103e25230e1b424441a1449649353f 100644 (file)
@@ -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}"] } {
index e43b8559d27f539579d5a118a691151ba5b2dc1c..4efd97efaaff0a620749cdb957ece23faa6d1d24 100644 (file)
@@ -1,3 +1,39 @@
+2019-02-14  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
+
+       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.
+
 2019-02-13  Iain Buclaw  <ibuclaw@gdcproject.org>
 
        * libdruntime/core/runtime.d (defaultTraceHandler): Give
index 9f96ad5d19067ed15cf999b3aebfcafffccbb8b5..4741c287a44cc1634c5147f00182c55140d2cc5b 100755 (executable)
@@ -3,7 +3,7 @@
 # Generated by GNU Autoconf 2.69 for package-unused version-unused.
 #
 #
-# Copyright (C) 1992-2019 Free Software Foundation, Inc.
+# Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc.
 #
 #
 # This configure script is free software; the Free Software Foundation
@@ -650,6 +650,8 @@ LIBATOMIC
 DCFG_HAVE_LIBATOMIC
 DCFG_HAVE_64BIT_ATOMICS
 DCFG_HAVE_ATOMIC_BUILTINS
+DRUNTIME_OS_MINFO_BRACKETING_FALSE
+DRUNTIME_OS_MINFO_BRACKETING_TRUE
 DCFG_MINFO_BRACKETING
 DRUNTIME_OS_ARM_EABI_UNWINDER_FALSE
 DRUNTIME_OS_ARM_EABI_UNWINDER_TRUE
@@ -801,7 +803,7 @@ PACKAGE_TARNAME
 PACKAGE_NAME
 PATH_SEPARATOR
 SHELL'
-ac_subst_files=''
+ac_subst_files='DRTSTUFF_SPEC'
 ac_user_opts='
 enable_option_checking
 enable_multilib
@@ -1568,7 +1570,7 @@ if $ac_init_version; then
 package-unused configure version-unused
 generated by GNU Autoconf 2.69
 
-Copyright (C) 2012-2019 Free Software Foundation, Inc.
+Copyright (C) 2012 Free Software Foundation, Inc.
 This configure script is free software; the Free Software Foundation
 gives unlimited permission to copy, distribute and modify it.
 _ACEOF
@@ -11496,7 +11498,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 11499 "configure"
+#line 11501 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -11602,7 +11604,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 11605 "configure"
+#line 11607 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
 rm -f core conftest.err conftest.$ac_objext \
     conftest$ac_exeext conftest.$ac_ext
 
+   if test "$DCFG_MINFO_BRACKETING" = "true"; then
+  DRUNTIME_OS_MINFO_BRACKETING_TRUE=
+  DRUNTIME_OS_MINFO_BRACKETING_FALSE='#'
+else
+  DRUNTIME_OS_MINFO_BRACKETING_TRUE='#'
+  DRUNTIME_OS_MINFO_BRACKETING_FALSE=
+fi
+
   ac_ext=c
 ac_cpp='$CPP $CPPFLAGS'
 ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
@@ -14856,6 +14866,14 @@ $as_echo "$version_specific_libs" >&6; }
 
 
 
+# Add drtbegin.o/drtend.o to startfile/endfile specs in libgphobos.spec
+if test "$DCFG_MINFO_BRACKETING" = "false"; then
+    DRTSTUFF_SPEC=$srcdir/src/drtstuff.spec
+else
+    DRTSTUFF_SPEC=/dev/null
+fi
+
+
 # Add dependencies for libgphobos.spec file
 SPEC_PHOBOS_DEPS="$LIBS"
 
@@ -15095,6 +15113,10 @@ if test -z "${DRUNTIME_OS_ARM_EABI_UNWINDER_TRUE}" && test -z "${DRUNTIME_OS_ARM
   as_fn_error $? "conditional \"DRUNTIME_OS_ARM_EABI_UNWINDER\" was never defined.
 Usually this means the macro was only invoked conditionally." "$LINENO" 5
 fi
+if test -z "${DRUNTIME_OS_MINFO_BRACKETING_TRUE}" && test -z "${DRUNTIME_OS_MINFO_BRACKETING_FALSE}"; then
+  as_fn_error $? "conditional \"DRUNTIME_OS_MINFO_BRACKETING\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
 if test -z "${DRUNTIME_ZLIB_SYSTEM_TRUE}" && test -z "${DRUNTIME_ZLIB_SYSTEM_FALSE}"; then
   as_fn_error $? "conditional \"DRUNTIME_ZLIB_SYSTEM\" was never defined.
 Usually this means the macro was only invoked conditionally." "$LINENO" 5
@@ -15566,7 +15588,7 @@ package-unused config.status version-unused
 configured by $0, generated by GNU Autoconf 2.69,
   with options \\"\$ac_cs_config\\"
 
-Copyright (C) 2012-2019 Free Software Foundation, Inc.
+Copyright (C) 2012 Free Software Foundation, Inc.
 This config.status script is free software; the Free Software Foundation
 gives unlimited permission to copy, distribute and modify it."
 
@@ -16099,7 +16121,24 @@ ac_tmp=$tmp
 # This happens for instance with `./config.status config.h'.
 if test -n "$CONFIG_FILES"; then
 
-
+if $AWK 'BEGIN { getline <"/dev/null" }' </dev/null 2>/dev/null; then
+  ac_cs_awk_getline=:
+  ac_cs_awk_pipe_init=
+  ac_cs_awk_read_file='
+      while ((getline aline < (F[key])) > 0)
+       print(aline)
+      close(F[key])'
+  ac_cs_awk_pipe_fini=
+else
+  ac_cs_awk_getline=false
+  ac_cs_awk_pipe_init="print \"cat <<'|#_!!_#|' &&\""
+  ac_cs_awk_read_file='
+      print "|#_!!_#|"
+      print "cat " F[key] " &&"
+      '$ac_cs_awk_pipe_init
+  # The final `:' finishes the AND list.
+  ac_cs_awk_pipe_fini='END { print "|#_!!_#|"; print ":" }'
+fi
 ac_cr=`echo X | tr X '\015'`
 # On cygwin, bash can eat \r inside `` if the user requested igncr.
 # But we know of no other shell where ac_cr would be empty at this
 echo 'BEGIN {' >"$ac_tmp/subs1.awk" &&
 _ACEOF
 
+# Create commands to substitute file output variables.
+{
+  echo "cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1" &&
+  echo 'cat >>"\$ac_tmp/subs1.awk" <<\\_ACAWK &&' &&
+  echo "$ac_subst_files" | sed 's/.*/F["&"]="$&"/' &&
+  echo "_ACAWK" &&
+  echo "_ACEOF"
+} >conf$$files.sh &&
+. ./conf$$files.sh ||
+  as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5
+rm -f conf$$files.sh
 
 {
   echo "cat >conf$$subs.awk <<_ACEOF" &&
@@ -16193,7 +16243,7 @@ _ACAWK
 cat >>"\$ac_tmp/subs1.awk" <<_ACAWK &&
   for (key in S) S_is_set[key] = 1
   FS = "\a"
-
+  \$ac_cs_awk_pipe_init
 }
 {
   line = $ 0
@@ -16211,10 +16261,16 @@ cat >>"\$ac_tmp/subs1.awk" <<_ACAWK &&
     } else
       len += 1 + keylen
   }
-
+  if (nfields == 3 && !substed) {
+    key = field[2]
+    if (F[key] != "" && line ~ /^[      ]*@.*@[         ]*$/) {
+      \$ac_cs_awk_read_file
+      next
+    }
+  }
   print line
 }
-
+\$ac_cs_awk_pipe_fini
 _ACAWK
 _ACEOF
 cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
@@ -16561,7 +16617,12 @@ s&@INSTALL@&$ac_INSTALL&;t t
 s&@MKDIR_P@&$ac_MKDIR_P&;t t
 $ac_datarootdir_hack
 "
-eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$ac_tmp/subs.awk" \
+eval sed \"\$ac_sed_extra\" "$ac_file_inputs" |
+if $ac_cs_awk_getline; then
+  $AWK -f "$ac_tmp/subs.awk"
+else
+  $AWK -f "$ac_tmp/subs.awk" | $SHELL
+fi \
   >$ac_tmp/out || as_fn_error $? "could not create $ac_file" "$LINENO" 5
 
 test -z "$ac_datarootdir_hack$ac_datarootdir_seen" &&
@@ -16674,7 +16735,8 @@ esac ;;
 # Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`:
 # NOTE: Changes made to this file will be lost: look at ltmain.sh.
 #
-#   Copyright (C) 1996-2019 Free Software Foundation, Inc.
+#   Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005,
+#                 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
 #   Written by Gordon Matzigkeit, 1996
 #
 #   This file is part of GNU Libtool.
index 919bc194af4969344bebe805225ea67e8d24c51e..3701a241b8e359644815ce1c3f371a70497012b3 100644 (file)
@@ -143,6 +143,14 @@ DRUNTIME_LIBRARIES_DLOPEN
 DRUNTIME_LIBRARIES_ZLIB
 DRUNTIME_INSTALL_DIRECTORIES
 
+# Add drtbegin.o/drtend.o to startfile/endfile specs in libgphobos.spec
+if test "$DCFG_MINFO_BRACKETING" = "false"; then
+    DRTSTUFF_SPEC=$srcdir/src/drtstuff.spec
+else
+    DRTSTUFF_SPEC=/dev/null
+fi
+AC_SUBST_FILE(DRTSTUFF_SPEC)
+
 # Add dependencies for libgphobos.spec file
 SPEC_PHOBOS_DEPS="$LIBS"
 AC_SUBST(SPEC_PHOBOS_DEPS)
index 8fa0ac104ef63a753d9b40c84c254760e73453ad..eca6c4a56fd3db7603a03f4e2b0a3c24b2d2bc9c 100644 (file)
@@ -74,6 +74,20 @@ endif
 if DRUNTIME_OS_SOLARIS
     ALL_DRUNTIME_COMPILE_DSOURCES += $(DRUNTIME_DSOURCES_SOLARIS)
 endif
+
+# Provide __start_minfo, __stop_minfo if linker doesn't.
+if !DRUNTIME_OS_MINFO_BRACKETING
+    DRTSTUFF = gcc/drtbegin.o gcc/drtend.o
+
+    toolexeclib_DATA = $(DRTSTUFF)
+
+gcc/drtbegin.o: gcc/drtstuff.c
+       $(COMPILE) -DDRT_BEGIN -c -o $@ $<
+
+gcc/drtend.o: gcc/drtstuff.c
+       $(COMPILE) -DDRT_END -c -o $@ $<
+endif
+
 # Generated by configure
 ALL_DRUNTIME_COMPILE_DSOURCES += $(DRUNTIME_DSOURCES_GENERATED)
 
@@ -95,14 +109,16 @@ endif
 toolexeclib_LTLIBRARIES = libgdruntime.la
 libgdruntime_la_SOURCES = $(ALL_DRUNTIME_SOURCES)
 libgdruntime_la_LIBTOOLFLAGS =
-libgdruntime_la_LDFLAGS = -Xcompiler -nophoboslib -version-info $(libtool_VERSION)
+libgdruntime_la_LDFLAGS = -Wc,-nophoboslib,-dstartfiles,-B../src,-Bgcc \
+    -version-info $(libtool_VERSION)
 libgdruntime_la_LIBADD = $(LIBATOMIC) $(LIBBACKTRACE)
+libgdruntime_la_DEPENDENCIES = $(DRTSTUFF)
 
 # For static unittest, link objects directly
 unittest_static_SOURCES = ../testsuite/test_runner.d $(DRUNTIME_CSOURCES) \
     $(DRUNTIME_SSOURCES)
 unittest_static_LIBTOOLFLAGS =
-unittest_static_LDFLAGS = -Xcompiler -nophoboslib
+unittest_static_LDFLAGS = -Wc,-nophoboslib
 unittest_static_LDADD = $(DRUNTIME_TEST_OBJECTS) $(LIBATOMIC) $(LIBBACKTRACE)
 EXTRA_unittest_static_DEPENDENCIES = $(DRUNTIME_TEST_OBJECTS)
 
@@ -111,14 +127,14 @@ libgdruntime_t_la_SOURCES = $(DRUNTIME_CSOURCES) $(DRUNTIME_SSOURCES)
 libgdruntime_t_la_LIBTOOLFLAGS =
 # Automake by default does not generate shared libs for non-installed
 # libraries. Use -rpath to force shared lib generation.
-libgdruntime_t_la_LDFLAGS = -Xcompiler -nophoboslib -rpath /foo -shared
+libgdruntime_t_la_LDFLAGS = -Wc,-nophoboslib -rpath /foo -shared
 libgdruntime_t_la_LIBADD = $(DRUNTIME_TEST_LOBJECTS) $(LIBATOMIC) $(LIBBACKTRACE)
 EXTRA_libgdruntime_t_la_DEPENDENCIES = $(DRUNTIME_TEST_LOBJECTS)
 
 # For unittest
 unittest_SOURCES = ../testsuite/test_runner.d
 unittest_LIBTOOLFLAGS =
-unittest_LDFLAGS = -Xcompiler -nophoboslib
+unittest_LDFLAGS = -Wc,-nophoboslib
 unittest_LDADD = libgdruntime_t.la
 
 # Extra install and clean rules.
index 89daa1c08ffff8b6e3bdb68d3896121343a2cf38..02331af95bd02c309d78bb6e2494f1583d5ede0a 100644 (file)
@@ -31,6 +31,7 @@
 # along with GCC; see the file COPYING3.  If not see
 # <http://www.gnu.org/licenses/>.
 
+
 VPATH = @srcdir@
 am__is_gnu_make = { \
   if test -z '$(MAKELEVEL)'; then \
@@ -172,11 +173,10 @@ am__uninstall_files_from_dir = { \
     || { echo " ( cd '$$dir' && rm -f" $$files ")"; \
          $(am__cd) "$$dir" && rm -f $$files; }; \
   }
-am__installdirs = "$(DESTDIR)$(toolexeclibdir)"
+am__installdirs = "$(DESTDIR)$(toolexeclibdir)" \
+       "$(DESTDIR)$(toolexeclibdir)"
 LTLIBRARIES = $(toolexeclib_LTLIBRARIES)
 am__DEPENDENCIES_1 =
-libgdruntime_la_DEPENDENCIES = $(am__DEPENDENCIES_1) \
-       $(am__DEPENDENCIES_1)
 am__dirstamp = $(am__leading_dot)dirstamp
 am__objects_1 = core/atomic.lo core/attribute.lo core/bitop.lo \
        core/checkedint.lo core/cpuid.lo core/demangle.lo \
@@ -1052,6 +1052,7 @@ am__can_run_installinfo = \
     n|no|NO) false;; \
     *) (install-info --version) >/dev/null 2>&1;; \
   esac
+DATA = $(toolexeclib_DATA)
 am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
 # Read a list of newline-separated strings from the standard input,
 # and print each of them once, without duplicates.  Input order is
@@ -1278,6 +1279,7 @@ ALL_DRUNTIME_INSTALL_DSOURCES = $(DRUNTIME_DSOURCES) \
 
 
 # Setup source files depending on configure
+
 # Generated by configure
 ALL_DRUNTIME_COMPILE_DSOURCES = $(DRUNTIME_DSOURCES) $(am__append_1) \
        $(am__append_2) $(am__append_3) $(am__append_4) \
@@ -1285,6 +1287,10 @@ ALL_DRUNTIME_COMPILE_DSOURCES = $(DRUNTIME_DSOURCES) $(am__append_1) \
        $(am__append_8) $(am__append_9) $(am__append_10) \
        $(am__append_11) $(am__append_12) \
        $(DRUNTIME_DSOURCES_GENERATED)
+
+# Provide __start_minfo, __stop_minfo if linker doesn't.
+@DRUNTIME_OS_MINFO_BRACKETING_FALSE@DRTSTUFF = gcc/drtbegin.o gcc/drtend.o
+@DRUNTIME_OS_MINFO_BRACKETING_FALSE@toolexeclib_DATA = $(DRTSTUFF)
 ALL_DRUNTIME_SOURCES = $(ALL_DRUNTIME_COMPILE_DSOURCES) $(DRUNTIME_CSOURCES) \
        $(DRUNTIME_SSOURCES)
 
@@ -1294,15 +1300,18 @@ DRUNTIME_TEST_OBJECTS = $(ALL_DRUNTIME_COMPILE_DSOURCES:.d=.t.o)
 toolexeclib_LTLIBRARIES = libgdruntime.la
 libgdruntime_la_SOURCES = $(ALL_DRUNTIME_SOURCES)
 libgdruntime_la_LIBTOOLFLAGS = 
-libgdruntime_la_LDFLAGS = -Xcompiler -nophoboslib -version-info $(libtool_VERSION)
+libgdruntime_la_LDFLAGS = -Wc,-nophoboslib,-dstartfiles,-B../src,-Bgcc \
+    -version-info $(libtool_VERSION)
+
 libgdruntime_la_LIBADD = $(LIBATOMIC) $(LIBBACKTRACE)
+libgdruntime_la_DEPENDENCIES = $(DRTSTUFF)
 
 # For static unittest, link objects directly
 unittest_static_SOURCES = ../testsuite/test_runner.d $(DRUNTIME_CSOURCES) \
     $(DRUNTIME_SSOURCES)
 
 unittest_static_LIBTOOLFLAGS = 
-unittest_static_LDFLAGS = -Xcompiler -nophoboslib
+unittest_static_LDFLAGS = -Wc,-nophoboslib
 unittest_static_LDADD = $(DRUNTIME_TEST_OBJECTS) $(LIBATOMIC) $(LIBBACKTRACE)
 EXTRA_unittest_static_DEPENDENCIES = $(DRUNTIME_TEST_OBJECTS)
 
@@ -1311,14 +1320,14 @@ libgdruntime_t_la_SOURCES = $(DRUNTIME_CSOURCES) $(DRUNTIME_SSOURCES)
 libgdruntime_t_la_LIBTOOLFLAGS = 
 # Automake by default does not generate shared libs for non-installed
 # libraries. Use -rpath to force shared lib generation.
-libgdruntime_t_la_LDFLAGS = -Xcompiler -nophoboslib -rpath /foo -shared
+libgdruntime_t_la_LDFLAGS = -Wc,-nophoboslib -rpath /foo -shared
 libgdruntime_t_la_LIBADD = $(DRUNTIME_TEST_LOBJECTS) $(LIBATOMIC) $(LIBBACKTRACE)
 EXTRA_libgdruntime_t_la_DEPENDENCIES = $(DRUNTIME_TEST_LOBJECTS)
 
 # For unittest
 unittest_SOURCES = ../testsuite/test_runner.d
 unittest_LIBTOOLFLAGS = 
-unittest_LDFLAGS = -Xcompiler -nophoboslib
+unittest_LDFLAGS = -Wc,-nophoboslib
 unittest_LDADD = libgdruntime_t.la
 DRUNTIME_DSOURCES_GENERATED = gcc/config.d gcc/libbacktrace.d
 # Source file definitions. Boring stuff, auto-generated with
@@ -2454,6 +2463,27 @@ clean-libtool:
        -rm -rf rt/typeinfo/.libs rt/typeinfo/_libs
        -rm -rf rt/util/.libs rt/util/_libs
        -rm -rf rt/util/container/.libs rt/util/container/_libs
+install-toolexeclibDATA: $(toolexeclib_DATA)
+       @$(NORMAL_INSTALL)
+       @list='$(toolexeclib_DATA)'; test -n "$(toolexeclibdir)" || list=; \
+       if test -n "$$list"; then \
+         echo " $(MKDIR_P) '$(DESTDIR)$(toolexeclibdir)'"; \
+         $(MKDIR_P) "$(DESTDIR)$(toolexeclibdir)" || exit 1; \
+       fi; \
+       for p in $$list; do \
+         if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+         echo "$$d$$p"; \
+       done | $(am__base_list) | \
+       while read files; do \
+         echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(toolexeclibdir)'"; \
+         $(INSTALL_DATA) $$files "$(DESTDIR)$(toolexeclibdir)" || exit $$?; \
+       done
+
+uninstall-toolexeclibDATA:
+       @$(NORMAL_UNINSTALL)
+       @list='$(toolexeclib_DATA)'; test -n "$(toolexeclibdir)" || list=; \
+       files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
+       dir='$(DESTDIR)$(toolexeclibdir)'; $(am__uninstall_files_from_dir)
 
 ID: $(am__tagged_files)
        $(am__define_uniq_tagged_files); mkid -fID $$unique
@@ -2509,9 +2539,9 @@ distclean-tags:
 check-am: all-am
        $(MAKE) $(AM_MAKEFLAGS) $(check_LTLIBRARIES) $(check_PROGRAMS)
 check: check-am
-all-am: Makefile $(LTLIBRARIES)
+all-am: Makefile $(LTLIBRARIES) $(DATA)
 installdirs:
-       for dir in "$(DESTDIR)$(toolexeclibdir)"; do \
+       for dir in "$(DESTDIR)$(toolexeclibdir)" "$(DESTDIR)$(toolexeclibdir)"; do \
          test -z "$$dir" || $(MKDIR_P) "$$dir"; \
        done
 install: install-am
@@ -2614,7 +2644,8 @@ install-dvi: install-dvi-am
 
 install-dvi-am:
 
-install-exec-am: install-toolexeclibLTLIBRARIES
+install-exec-am: install-toolexeclibDATA \
+       install-toolexeclibLTLIBRARIES
 
 install-html: install-html-am
 
@@ -2653,7 +2684,8 @@ ps: ps-am
 
 ps-am:
 
-uninstall-am: uninstall-toolexeclibLTLIBRARIES
+uninstall-am: uninstall-toolexeclibDATA \
+       uninstall-toolexeclibLTLIBRARIES
 
 .MAKE: check-am install-am install-strip
 
@@ -2667,11 +2699,12 @@ uninstall-am: uninstall-toolexeclibLTLIBRARIES
        install-exec install-exec-am install-html install-html-am \
        install-info install-info-am install-man install-pdf \
        install-pdf-am install-ps install-ps-am install-strip \
-       install-toolexeclibLTLIBRARIES installcheck installcheck-am \
-       installdirs maintainer-clean maintainer-clean-generic \
-       mostlyclean mostlyclean-compile mostlyclean-generic \
-       mostlyclean-libtool pdf pdf-am ps ps-am tags tags-am uninstall \
-       uninstall-am uninstall-toolexeclibLTLIBRARIES
+       install-toolexeclibDATA install-toolexeclibLTLIBRARIES \
+       installcheck installcheck-am installdirs maintainer-clean \
+       maintainer-clean-generic mostlyclean mostlyclean-compile \
+       mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
+       tags tags-am uninstall uninstall-am uninstall-toolexeclibDATA \
+       uninstall-toolexeclibLTLIBRARIES
 
 .PRECIOUS: Makefile
 
@@ -2695,6 +2728,12 @@ uninstall-am: uninstall-toolexeclibLTLIBRARIES
 %.t.o : %.t.lo
        @:
 
+@DRUNTIME_OS_MINFO_BRACKETING_FALSE@gcc/drtbegin.o: gcc/drtstuff.c
+@DRUNTIME_OS_MINFO_BRACKETING_FALSE@   $(COMPILE) -DDRT_BEGIN -c -o $@ $<
+
+@DRUNTIME_OS_MINFO_BRACKETING_FALSE@gcc/drtend.o: gcc/drtstuff.c
+@DRUNTIME_OS_MINFO_BRACKETING_FALSE@   $(COMPILE) -DDRT_END -c -o $@ $<
+
 # Extra install and clean rules.
 # This does not delete the .libs/.t.o files, but deleting
 # the .lo is good enough to rerun the rules
index 3a1d493f3c49749dfe6e7e94dc1f72ecf32d789f..1b5d5d9b69248ba6f6689ca7384a9f81fdd0d718 100644 (file)
@@ -35,9 +35,6 @@ enum ThreadModel
 
 enum ThreadModel GNU_Thread_Model = ThreadModel.@DCFG_THREAD_MODEL@;
 
-// Whether the linker provides __start_minfo and __stop_minfo symbols
-enum Minfo_Bracketing = @DCFG_MINFO_BRACKETING@;
-
 // Whether target has support for builtin atomics.
 enum GNU_Have_Atomics = @DCFG_HAVE_ATOMIC_BUILTINS@;
 
diff --git a/libphobos/libdruntime/gcc/drtstuff.c b/libphobos/libdruntime/gcc/drtstuff.c
new file mode 100644 (file)
index 0000000..40edda3
--- /dev/null
@@ -0,0 +1,39 @@
+/* Provide minfo section bracketing for D executables and shared libraries
+   when the linker doesn't provide it.
+   Copyright (C) 2019 Free Software Foundation, Inc.
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify it under
+the terms of the GNU General Public License as published by the Free
+Software Foundation; either version 3, or (at your option) any later
+version.
+
+GCC is distributed in the hope that it will be useful, but WITHOUT ANY
+WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+a copy of the GCC Runtime Library Exception along with this program;
+see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+<http://www.gnu.org/licenses/>.  */
+
+/* Avoid interference with targets without support for named sections.  */
+#ifdef __ELF__
+
+#ifdef DRT_BEGIN
+void *__start_minfo[]
+__attribute__((used, section("minfo"), aligned(sizeof(void *)))) = { };
+#endif
+
+#ifdef DRT_END
+void *__stop_minfo[]
+__attribute__((used, section("minfo"), aligned(sizeof(void *)))) = { };
+#endif
+
+#endif /* __ELF__ */
index 3f43bbd76630f259326dc44a3263fcd650ceb239..d4e1ff076992d6d38f890ee2266e084e74c53cec 100644 (file)
@@ -335,7 +335,6 @@ else
 ///////////////////////////////////////////////////////////////////////////////
 
 import gcc.config;
-static assert(Minfo_Bracketing, "Can't use _d_dso_registry interface");
 
 /*
  * This data structure is generated by the compiler, and then passed to
index 0c711051bfb8c6b4d65e7a9a775a101467121461..92a2ba5cdf82d65d62199a2f6bae96e8049889e7 100644 (file)
@@ -180,5 +180,6 @@ AC_DEFUN([DRUNTIME_OS_MINFO_BRACKETING],
     [AC_MSG_RESULT([no])
      DCFG_MINFO_BRACKETING=false])
   AC_SUBST(DCFG_MINFO_BRACKETING)
+  AM_CONDITIONAL([DRUNTIME_OS_MINFO_BRACKETING], [test "$DCFG_MINFO_BRACKETING" = "true"])
   AC_LANG_POP([C])
 ])
index 30896df1d94f7b1054ecb26632df98276d9796ec..51fd11e5c6cde6192719adde044d4c8310f30153 100644 (file)
@@ -57,14 +57,15 @@ toolexeclib_DATA = libgphobos.spec
 toolexeclib_LTLIBRARIES = libgphobos.la
 libgphobos_la_SOURCES = $(ALL_PHOBOS_SOURCES) $(ZLIB_SRC)
 libgphobos_la_LIBTOOLFLAGS =
-libgphobos_la_LDFLAGS = -Xcompiler -nophoboslib -version-info $(libtool_VERSION)
+libgphobos_la_LDFLAGS = -Wc,-nophoboslib,-dstartfiles,-B../libdruntime/gcc \
+    -version-info $(libtool_VERSION)
 libgphobos_la_LIBADD = ../libdruntime/libgdruntime.la
 libgphobos_la_DEPENDENCIES = libgphobos.spec
 
 # For static unittest, link objects directly
 unittest_static_SOURCES = ../testsuite/test_runner.d $(ZLIB_SRC)
 unittest_static_LIBTOOLFLAGS =
-unittest_static_LDFLAGS = -Xcompiler -nophoboslib -static-libtool-libs
+unittest_static_LDFLAGS = -Wc,-nophoboslib -static-libtool-libs
 unittest_static_LDADD = $(PHOBOS_TEST_OBJECTS) \
     ../libdruntime/libgdruntime.la
 EXTRA_unittest_static_DEPENDENCIES = $(PHOBOS_TEST_OBJECTS)
@@ -72,7 +73,7 @@ EXTRA_unittest_static_DEPENDENCIES = $(PHOBOS_TEST_OBJECTS)
 # For unittest with dynamic library
 libgphobos_t_la_SOURCES = $(ZLIB_SRC)
 libgphobos_t_la_LIBTOOLFLAGS =
-libgphobos_t_la_LDFLAGS = -Xcompiler -nophoboslib -rpath /foo -shared
+libgphobos_t_la_LDFLAGS = -Wc,-nophoboslib -rpath /foo -shared
 libgphobos_t_la_LIBADD = $(PHOBOS_TEST_LOBJECTS) \
     ../libdruntime/libgdruntime.la
 EXTRA_libgphobos_t_la_DEPENDENCIES = $(PHOBOS_TEST_LOBJECTS)
@@ -80,7 +81,7 @@ EXTRA_libgphobos_t_la_DEPENDENCIES = $(PHOBOS_TEST_LOBJECTS)
 # For unittest
 unittest_SOURCES = ../testsuite/test_runner.d
 unittest_LIBTOOLFLAGS =
-unittest_LDFLAGS = -Xcompiler -nophoboslib -shared
+unittest_LDFLAGS = -Wc,-nophoboslib -shared
 unittest_LDADD = libgphobos_t.la ../libdruntime/libgdruntime.la
 
 # Extra install and clean rules.
index a349fa7e897a0ad21b1c511f794d209965bacb1a..3dffa6f6093e3ed78f2def486f4a94e0610cadf5 100644 (file)
@@ -696,14 +696,16 @@ toolexeclib_DATA = libgphobos.spec
 toolexeclib_LTLIBRARIES = libgphobos.la
 libgphobos_la_SOURCES = $(ALL_PHOBOS_SOURCES) $(ZLIB_SRC)
 libgphobos_la_LIBTOOLFLAGS = 
-libgphobos_la_LDFLAGS = -Xcompiler -nophoboslib -version-info $(libtool_VERSION)
+libgphobos_la_LDFLAGS = -Wc,-nophoboslib,-dstartfiles,-B../libdruntime/gcc \
+    -version-info $(libtool_VERSION)
+
 libgphobos_la_LIBADD = ../libdruntime/libgdruntime.la
 libgphobos_la_DEPENDENCIES = libgphobos.spec
 
 # For static unittest, link objects directly
 unittest_static_SOURCES = ../testsuite/test_runner.d $(ZLIB_SRC)
 unittest_static_LIBTOOLFLAGS = 
-unittest_static_LDFLAGS = -Xcompiler -nophoboslib -static-libtool-libs
+unittest_static_LDFLAGS = -Wc,-nophoboslib -static-libtool-libs
 unittest_static_LDADD = $(PHOBOS_TEST_OBJECTS) \
     ../libdruntime/libgdruntime.la
 
@@ -712,7 +714,7 @@ EXTRA_unittest_static_DEPENDENCIES = $(PHOBOS_TEST_OBJECTS)
 # For unittest with dynamic library
 libgphobos_t_la_SOURCES = $(ZLIB_SRC)
 libgphobos_t_la_LIBTOOLFLAGS = 
-libgphobos_t_la_LDFLAGS = -Xcompiler -nophoboslib -rpath /foo -shared
+libgphobos_t_la_LDFLAGS = -Wc,-nophoboslib -rpath /foo -shared
 libgphobos_t_la_LIBADD = $(PHOBOS_TEST_LOBJECTS) \
     ../libdruntime/libgdruntime.la
 
@@ -721,7 +723,7 @@ EXTRA_libgphobos_t_la_DEPENDENCIES = $(PHOBOS_TEST_LOBJECTS)
 # For unittest
 unittest_SOURCES = ../testsuite/test_runner.d
 unittest_LIBTOOLFLAGS = 
-unittest_LDFLAGS = -Xcompiler -nophoboslib -shared
+unittest_LDFLAGS = -Wc,-nophoboslib -shared
 unittest_LDADD = libgphobos_t.la ../libdruntime/libgdruntime.la
 
 # Zlib sources when not using system libz
diff --git a/libphobos/src/drtstuff.spec b/libphobos/src/drtstuff.spec
new file mode 100644 (file)
index 0000000..951a91b
--- /dev/null
@@ -0,0 +1,5 @@
+%rename startfile startfile_orig
+*startfile: %(startfile_orig) drtbegin.o%s
+
+%rename endfile endfile_orig
+*endfile: %(endfile_orig) drtend.o%s
index 0a33e834b1af569ef8a6c38980bd6ce4cf5d99a4..ff9389696f36b05a9ac6ce327725dd8322377c5a 100644 (file)
@@ -4,5 +4,7 @@
 # order.
 #
 
+@DRTSTUFF_SPEC@
+
 %rename lib liborig_gdc_renamed
-*lib: @SPEC_PHOBOS_DEPS@ %(liborig_gdc_renamed)
+*lib: %{debuglib|defaultlib|nophoboslib: ; :@SPEC_PHOBOS_DEPS@} %(liborig_gdc_renamed)
index 92cc436d29f0a955cd234d071ba7baacc61bdcde..0326401e459c37cf8db479ee73bafc1b9d4237b1 100755 (executable)
@@ -40,6 +40,7 @@ case ${query} in
       ;;
     --gdcldflags)
       GDCLDFLAGS="-B${BUILD_DIR}/src
+                  -B${BUILD_DIR}/libdruntime/gcc
                   -L${BUILD_DIR}/libdruntime/.libs
                   -L${BUILD_DIR}/src/.libs"
       echo ${GDCLDFLAGS}