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) <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
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 <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
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 @@
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 @@
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 @@
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 @@
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 <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
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 @@
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}"] } {
diff --git a/libphobos/ChangeLog b/libphobos/ChangeLog
index e43b855..4efd97e 100644
--- a/libphobos/ChangeLog
+++ b/libphobos/ChangeLog
@@ -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
diff --git a/libphobos/configure b/libphobos/configure
index 9f96ad5..4741c28 100755
--- a/libphobos/configure
+++ b/libphobos/configure
@@ -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 @@
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_NAME
PATH_SEPARATOR
SHELL'
-ac_subst_files=''
+ac_subst_files='DRTSTUFF_SPEC'
ac_user_opts='
enable_option_checking
enable_multilib
@@ -1568,7 +1570,7 @@
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 @@
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 @@
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
@@ -14119,6 +14121,14 @@
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 @@
+# 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 @@
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 @@
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 @@
# 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
@@ -16117,6 +16156,17 @@
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 @@
cat >>"\$ac_tmp/subs1.awk" <<_ACAWK &&
for (key in S) S_is_set[key] = 1
FS = ""
-
+ \$ac_cs_awk_pipe_init
}
{
line = $ 0
@@ -16211,10 +16261,16 @@
} 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&@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 @@
# 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.
diff --git a/libphobos/configure.ac b/libphobos/configure.ac
index 919bc19..3701a24 100644
--- a/libphobos/configure.ac
+++ b/libphobos/configure.ac
@@ -143,6 +143,14 @@
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)
diff --git a/libphobos/libdruntime/Makefile.am b/libphobos/libdruntime/Makefile.am
index 8fa0ac1..eca6c4a 100644
--- a/libphobos/libdruntime/Makefile.am
+++ b/libphobos/libdruntime/Makefile.am
@@ -74,6 +74,20 @@
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 @@
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_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.
diff --git a/libphobos/libdruntime/Makefile.in b/libphobos/libdruntime/Makefile.in
index 89daa1c..02331af 100644
--- a/libphobos/libdruntime/Makefile.in
+++ b/libphobos/libdruntime/Makefile.in
@@ -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 @@
|| { 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 @@
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 @@
# 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 @@
$(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 @@
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_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 @@
-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 @@
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-am:
-install-exec-am: install-toolexeclibLTLIBRARIES
+install-exec-am: install-toolexeclibDATA \
+ install-toolexeclibLTLIBRARIES
install-html: install-html-am
@@ -2653,7 +2684,8 @@
ps-am:
-uninstall-am: uninstall-toolexeclibLTLIBRARIES
+uninstall-am: uninstall-toolexeclibDATA \
+ uninstall-toolexeclibLTLIBRARIES
.MAKE: check-am install-am install-strip
@@ -2667,11 +2699,12 @@
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 @@
%.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
diff --git a/libphobos/libdruntime/gcc/config.d.in b/libphobos/libdruntime/gcc/config.d.in
index 3a1d493..1b5d5d9 100644
--- a/libphobos/libdruntime/gcc/config.d.in
+++ b/libphobos/libdruntime/gcc/config.d.in
@@ -35,9 +35,6 @@
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
index 0000000..40edda3
--- /dev/null
+++ b/libphobos/libdruntime/gcc/drtstuff.c
@@ -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__ */
diff --git a/libphobos/libdruntime/rt/sections_elf_shared.d b/libphobos/libdruntime/rt/sections_elf_shared.d
index 3f43bbd..d4e1ff0 100644
--- a/libphobos/libdruntime/rt/sections_elf_shared.d
+++ b/libphobos/libdruntime/rt/sections_elf_shared.d
@@ -335,7 +335,6 @@
///////////////////////////////////////////////////////////////////////////////
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
diff --git a/libphobos/m4/druntime/os.m4 b/libphobos/m4/druntime/os.m4
index 0c71105..92a2ba5 100644
--- a/libphobos/m4/druntime/os.m4
+++ b/libphobos/m4/druntime/os.m4
@@ -180,5 +180,6 @@
[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])
])
diff --git a/libphobos/src/Makefile.am b/libphobos/src/Makefile.am
index 30896df..51fd11e 100644
--- a/libphobos/src/Makefile.am
+++ b/libphobos/src/Makefile.am
@@ -57,14 +57,15 @@
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 @@
# 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 @@
# 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.
diff --git a/libphobos/src/Makefile.in b/libphobos/src/Makefile.in
index a349fa7..3dffa6f 100644
--- a/libphobos/src/Makefile.in
+++ b/libphobos/src/Makefile.in
@@ -696,14 +696,16 @@
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 @@
# 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 @@
# 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
index 0000000..951a91b
--- /dev/null
+++ b/libphobos/src/drtstuff.spec
@@ -0,0 +1,5 @@
+%rename startfile startfile_orig
+*startfile: %(startfile_orig) drtbegin.o%s
+
+%rename endfile endfile_orig
+*endfile: %(endfile_orig) drtend.o%s
diff --git a/libphobos/src/libgphobos.spec.in b/libphobos/src/libgphobos.spec.in
index 0a33e83..ff93896 100644
--- a/libphobos/src/libgphobos.spec.in
+++ b/libphobos/src/libgphobos.spec.in
@@ -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)
diff --git a/libphobos/testsuite/testsuite_flags.in b/libphobos/testsuite/testsuite_flags.in
index 92cc436..0326401 100755
--- a/libphobos/testsuite/testsuite_flags.in
+++ b/libphobos/testsuite/testsuite_flags.in
@@ -40,6 +40,7 @@
;;
--gdcldflags)
GDCLDFLAGS="-B${BUILD_DIR}/src
+ -B${BUILD_DIR}/libdruntime/gcc
-L${BUILD_DIR}/libdruntime/.libs
-L${BUILD_DIR}/src/.libs"
echo ${GDCLDFLAGS}