diff options
author | Iain Buclaw <ibuclaw@gdcproject.org> | 2021-04-08 16:11:16 +0200 |
---|---|---|
committer | Iain Buclaw <ibuclaw@gdcproject.org> | 2021-04-10 15:02:07 +0200 |
commit | 32703b80f66f7ca504eb79bee7e745f22cf096a8 (patch) | |
tree | 1954456b1d2e6a84ccc6a9846f2211f4fb60d596 /libphobos/libdruntime/gcc/sections/common.d | |
parent | 385ee099eeae53bff5dd5adf673ad4f4b8d22981 (diff) | |
download | gcc-32703b80f66f7ca504eb79bee7e745f22cf096a8.zip gcc-32703b80f66f7ca504eb79bee7e745f22cf096a8.tar.gz gcc-32703b80f66f7ca504eb79bee7e745f22cf096a8.tar.bz2 |
libphobos: Add section support code for MACHO and PE/COFF
This replaces the original and untested support for Windows and OSX, and
is the 90% of the work needed to support libphobos on those targets.
The core.thread interface has been updated to accomodate for the same
function might be implemented by any of the platform-dependent modules.
libphobos/ChangeLog:
* libdruntime/Makefile.am (DRUNTIME_DSOURCES): Removed
gcc/sections/android.d, elf_shared.d, osx.d, win32.d, and win64.d.
Added gcc/sections/common.d, elf.d macho.d, and pecoff.d.
* libdruntime/Makefile.in: Regenerate.
* libdruntime/core/thread/osthread.d: Update externDFunc FQDN names to
use platform independant section function names.
* libdruntime/gcc/sections/elf_shared.d: Renamed to...
* libdruntime/gcc/sections/elf.d: ...this. Mangle functions for
core.thread interface as if they come from the gcc.sections module.
* libdruntime/gcc/sections/package.d: Update public imports, declare
functions for core.thread interface.
* libdruntime/gcc/sections/android.d: Removed.
* libdruntime/gcc/sections/osx.d: Removed.
* libdruntime/gcc/sections/win32.d: Removed.
* libdruntime/gcc/sections/win64.d: Removed.
* libdruntime/gcc/sections/common.d: New file.
* libdruntime/gcc/sections/macho.d: New file.
* libdruntime/gcc/sections/pecoff.d: New file.
Diffstat (limited to 'libphobos/libdruntime/gcc/sections/common.d')
-rw-r--r-- | libphobos/libdruntime/gcc/sections/common.d | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/libphobos/libdruntime/gcc/sections/common.d b/libphobos/libdruntime/gcc/sections/common.d new file mode 100644 index 0000000..85fdc0e --- /dev/null +++ b/libphobos/libdruntime/gcc/sections/common.d @@ -0,0 +1,39 @@ +// Contains various utility functions used by the runtime implementation. +// Copyright (C) 2019-2021 Free Software Foundation, Inc. + +// 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/>. + +module gcc.sections.common; + +/** + * Asserts that the given condition is `true`. + * + * The assertion is independent from -release, by abort()ing. Regular assertions + * throw an AssertError and thus require an initialized GC, which might not be + * the case (yet or anymore) for the startup/shutdown code in this package + * (called by CRT ctors/dtors etc.). + */ +package(gcc) void safeAssert( + bool condition, scope string msg, scope string file = __FILE__, size_t line = __LINE__ +) nothrow @nogc @safe +{ + import core.internal.abort; + condition || abort(msg, file, line); +} |