diff options
author | Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE> | 2019-02-14 17:47:49 +0000 |
---|---|---|
committer | Rainer Orth <ro@gcc.gnu.org> | 2019-02-14 17:47:49 +0000 |
commit | 0b6e3127e8a003ad01b9cfb6896dee14c637701b (patch) | |
tree | 2ab850aa2d7c3b37ace2470ebaae57ae9a799012 /libphobos/libdruntime/gcc | |
parent | 323694e9a2c535d56a81bcfc84fb0fd5b6155b34 (diff) | |
download | gcc-0b6e3127e8a003ad01b9cfb6896dee14c637701b.zip gcc-0b6e3127e8a003ad01b9cfb6896dee14c637701b.tar.gz gcc-0b6e3127e8a003ad01b9cfb6896dee14c637701b.tar.bz2 |
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/gcc')
-rw-r--r-- | libphobos/libdruntime/gcc/config.d.in | 3 | ||||
-rw-r--r-- | libphobos/libdruntime/gcc/drtstuff.c | 39 |
2 files changed, 39 insertions, 3 deletions
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 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__ */ |