summaryrefslogtreecommitdiff
path: root/libphobos/libdruntime
diff options
context:
space:
mode:
authorRainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>2019-02-14 17:47:49 +0000
committerRainer Orth <ro@gcc.gnu.org>2019-02-14 17:47:49 +0000
commit0b6e3127e8a003ad01b9cfb6896dee14c637701b (patch)
tree2ab850aa2d7c3b37ace2470ebaae57ae9a799012 /libphobos/libdruntime
parent323694e9a2c535d56a81bcfc84fb0fd5b6155b34 (diff)
downloadgcc-0b6e3127e8a003ad01b9cfb6896dee14c637701b.tar.gz
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
Diffstat (limited to 'libphobos/libdruntime')
-rw-r--r--libphobos/libdruntime/Makefile.am24
-rw-r--r--libphobos/libdruntime/Makefile.in71
-rw-r--r--libphobos/libdruntime/gcc/config.d.in3
-rw-r--r--libphobos/libdruntime/gcc/drtstuff.c39
-rw-r--r--libphobos/libdruntime/rt/sections_elf_shared.d1
5 files changed, 114 insertions, 24 deletions
diff --git a/libphobos/libdruntime/Makefile.am b/libphobos/libdruntime/Makefile.am
index 8fa0ac104ef..eca6c4a56fd 100644
--- a/libphobos/libdruntime/Makefile.am
+++ b/libphobos/libdruntime/Makefile.am
@@ -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.
diff --git a/libphobos/libdruntime/Makefile.in b/libphobos/libdruntime/Makefile.in
index 89daa1c08ff..02331af95bd 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 @@ 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
diff --git a/libphobos/libdruntime/gcc/config.d.in b/libphobos/libdruntime/gcc/config.d.in
index 3a1d493f3c4..1b5d5d9b692 100644
--- a/libphobos/libdruntime/gcc/config.d.in
+++ b/libphobos/libdruntime/gcc/config.d.in
@@ -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
index 00000000000..40edda3bffb
--- /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 3f43bbd7663..d4e1ff07699 100644
--- a/libphobos/libdruntime/rt/sections_elf_shared.d
+++ b/libphobos/libdruntime/rt/sections_elf_shared.d
@@ -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