From be6169045edab396ab80b2ae72ca551c893bf922 Mon Sep 17 00:00:00 2001 From: Iain Buclaw Date: Fri, 13 Nov 2020 12:26:01 +0100 Subject: libphobos: Update libtool version to 2:0:0 This is so that the library is not to conflict with gcc-10. libphobos/ChangeLog: * configure: Regenerate. * configure.ac (libtool_VERSION): Update to 2:0.0. --- libphobos/configure | 2 +- libphobos/configure.ac | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'libphobos') diff --git a/libphobos/configure b/libphobos/configure index 4c1116d..de6d367 100755 --- a/libphobos/configure +++ b/libphobos/configure @@ -15501,7 +15501,7 @@ SPEC_PHOBOS_DEPS="$LIBS" # Libdruntime / phobos soname version -libtool_VERSION=1:0:0 +libtool_VERSION=2:0:0 # Set default flags (after DRUNTIME_WERROR!) diff --git a/libphobos/configure.ac b/libphobos/configure.ac index bf21128..60aee3f 100644 --- a/libphobos/configure.ac +++ b/libphobos/configure.ac @@ -256,7 +256,7 @@ SPEC_PHOBOS_DEPS="$LIBS" AC_SUBST(SPEC_PHOBOS_DEPS) # Libdruntime / phobos soname version -libtool_VERSION=1:0:0 +libtool_VERSION=2:0:0 AC_SUBST(libtool_VERSION) # Set default flags (after DRUNTIME_WERROR!) -- cgit v1.1 From 77f67db2a4709388b905397421bd3a851fbbf884 Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Sat, 14 Nov 2020 00:16:38 +0000 Subject: Daily bump. --- libphobos/ChangeLog | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'libphobos') diff --git a/libphobos/ChangeLog b/libphobos/ChangeLog index 56a796b..f31a889 100644 --- a/libphobos/ChangeLog +++ b/libphobos/ChangeLog @@ -1,3 +1,8 @@ +2020-11-13 Iain Buclaw + + * configure: Regenerate. + * configure.ac (libtool_VERSION): Update to 2:0.0. + 2020-10-27 Iain Buclaw * libdruntime/MERGE: Merge upstream druntime 58560d51. -- cgit v1.1 From 4c4dfe21df4c4147d9c676a8c768cc303491293e Mon Sep 17 00:00:00 2001 From: Iain Buclaw Date: Fri, 13 Nov 2020 16:56:29 +0100 Subject: libphobos: Merge upstream phobos 7948e0967. Removes deprecated functions from std.string module. Reviewed-on: https://github.com/dlang/phobos/pull/7694 libphobos/ChangeLog: * src/MERGE: Merge upstream phobos 7948e0967. --- libphobos/src/MERGE | 2 +- libphobos/src/std/string.d | 267 --------------------------------------------- 2 files changed, 1 insertion(+), 268 deletions(-) (limited to 'libphobos') diff --git a/libphobos/src/MERGE b/libphobos/src/MERGE index 1562f74..de86ff5 100644 --- a/libphobos/src/MERGE +++ b/libphobos/src/MERGE @@ -1,4 +1,4 @@ -021ae0df76727a32809a29887095ab7093489ea3 +7948e096735adbc093333da789fc28feadce24b0 The first line of this file holds the git revision number of the last merge done from the dlang/phobos repository. diff --git a/libphobos/src/std/string.d b/libphobos/src/std/string.d index 5b61cde..1128a09 100644 --- a/libphobos/src/std/string.d +++ b/libphobos/src/std/string.d @@ -5174,273 +5174,6 @@ body assert(buffer.data == "h5 rd"); } -//@@@DEPRECATED_2.086@@@ -deprecated("This function is obsolete. It is available in https://github.com/dlang/undeaD if necessary.") -bool inPattern(S)(dchar c, in S pattern) @safe pure @nogc -if (isSomeString!S) -{ - bool result = false; - int range = 0; - dchar lastc; - - foreach (size_t i, dchar p; pattern) - { - if (p == '^' && i == 0) - { - result = true; - if (i + 1 == pattern.length) - return (c == p); // or should this be an error? - } - else if (range) - { - range = 0; - if (lastc <= c && c <= p || c == p) - return !result; - } - else if (p == '-' && i > result && i + 1 < pattern.length) - { - range = 1; - continue; - } - else if (c == p) - return !result; - lastc = p; - } - return result; -} - - -deprecated -@safe pure @nogc unittest -{ - import std.conv : to; - import std.exception : assertCTFEable; - - assertCTFEable!( - { - assert(inPattern('x', "x") == 1); - assert(inPattern('x', "y") == 0); - assert(inPattern('x', string.init) == 0); - assert(inPattern('x', "^y") == 1); - assert(inPattern('x', "yxxy") == 1); - assert(inPattern('x', "^yxxy") == 0); - assert(inPattern('x', "^abcd") == 1); - assert(inPattern('^', "^^") == 0); - assert(inPattern('^', "^") == 1); - assert(inPattern('^', "a^") == 1); - assert(inPattern('x', "a-z") == 1); - assert(inPattern('x', "A-Z") == 0); - assert(inPattern('x', "^a-z") == 0); - assert(inPattern('x', "^A-Z") == 1); - assert(inPattern('-', "a-") == 1); - assert(inPattern('-', "^A-") == 0); - assert(inPattern('a', "z-a") == 1); - assert(inPattern('z', "z-a") == 1); - assert(inPattern('x', "z-a") == 0); - }); -} - -//@@@DEPRECATED_2.086@@@ -deprecated("This function is obsolete. It is available in https://github.com/dlang/undeaD if necessary.") -bool inPattern(S)(dchar c, S[] patterns) @safe pure @nogc -if (isSomeString!S) -{ - foreach (string pattern; patterns) - { - if (!inPattern(c, pattern)) - { - return false; - } - } - return true; -} - -//@@@DEPRECATED_2.086@@@ -deprecated("This function is obsolete. It is available in https://github.com/dlang/undeaD if necessary.") -size_t countchars(S, S1)(S s, in S1 pattern) @safe pure @nogc -if (isSomeString!S && isSomeString!S1) -{ - size_t count; - foreach (dchar c; s) - { - count += inPattern(c, pattern); - } - return count; -} - -deprecated -@safe pure @nogc unittest -{ - import std.conv : to; - import std.exception : assertCTFEable; - - assertCTFEable!( - { - assert(countchars("abc", "a-c") == 3); - assert(countchars("hello world", "or") == 3); - }); -} - -//@@@DEPRECATED_2.086@@@ -deprecated("This function is obsolete. It is available in https://github.com/dlang/undeaD if necessary.") -S removechars(S)(S s, in S pattern) @safe pure -if (isSomeString!S) -{ - import std.utf : encode; - - Unqual!(typeof(s[0]))[] r; - bool changed = false; - - foreach (size_t i, dchar c; s) - { - if (inPattern(c, pattern)) - { - if (!changed) - { - changed = true; - r = s[0 .. i].dup; - } - continue; - } - if (changed) - { - encode(r, c); - } - } - if (changed) - return r; - else - return s; -} - -deprecated -@safe pure unittest -{ - import std.conv : to; - import std.exception : assertCTFEable; - - assertCTFEable!( - { - assert(removechars("abc", "a-c").length == 0); - assert(removechars("hello world", "or") == "hell wld"); - assert(removechars("hello world", "d") == "hello worl"); - assert(removechars("hah", "h") == "a"); - }); -} - -deprecated -@safe pure unittest -{ - assert(removechars("abc", "x") == "abc"); -} - -//@@@DEPRECATED_2.086@@@ -deprecated("This function is obsolete. It is available in https://github.com/dlang/undeaD if necessary.") -S squeeze(S)(S s, in S pattern = null) -{ - import std.utf : encode, stride; - - Unqual!(typeof(s[0]))[] r; - dchar lastc; - size_t lasti; - int run; - bool changed; - - foreach (size_t i, dchar c; s) - { - if (run && lastc == c) - { - changed = true; - } - else if (pattern is null || inPattern(c, pattern)) - { - run = 1; - if (changed) - { - if (r is null) - r = s[0 .. lasti].dup; - encode(r, c); - } - else - lasti = i + stride(s, i); - lastc = c; - } - else - { - run = 0; - if (changed) - { - if (r is null) - r = s[0 .. lasti].dup; - encode(r, c); - } - } - } - return changed ? ((r is null) ? s[0 .. lasti] : cast(S) r) : s; -} - -deprecated -@system pure unittest -{ - import std.conv : to; - import std.exception : assertCTFEable; - - assertCTFEable!( - { - string s; - - assert(squeeze("hello") == "helo"); - - s = "abcd"; - assert(squeeze(s) is s); - s = "xyzz"; - assert(squeeze(s).ptr == s.ptr); // should just be a slice - - assert(squeeze("hello goodbyee", "oe") == "hello godbye"); - }); -} - -//@@@DEPRECATED_2.086@@@ -deprecated("This function is obsolete. It is available in https://github.com/dlang/undeaD if necessary.") -S1 munch(S1, S2)(ref S1 s, S2 pattern) @safe pure @nogc -{ - size_t j = s.length; - foreach (i, dchar c; s) - { - if (!inPattern(c, pattern)) - { - j = i; - break; - } - } - scope(exit) s = s[j .. $]; - return s[0 .. j]; -} - -/// -deprecated -@safe pure @nogc unittest -{ - string s = "123abc"; - string t = munch(s, "0123456789"); - assert(t == "123" && s == "abc"); - t = munch(s, "0123456789"); - assert(t == "" && s == "abc"); -} - -deprecated -@safe pure @nogc unittest -{ - string s = "123€abc"; - string t = munch(s, "0123456789"); - assert(t == "123" && s == "€abc"); - t = munch(s, "0123456789"); - assert(t == "" && s == "€abc"); - t = munch(s, "£$€¥"); - assert(t == "€" && s == "abc"); -} - - /********************************************** * Return string that is the 'successor' to s[]. * If the rightmost character is a-zA-Z0-9, it is incremented within -- cgit v1.1 From fa9091ad93b2ec6f2580e9f9c7de799fa404cf2e Mon Sep 17 00:00:00 2001 From: Iain Buclaw Date: Thu, 29 Oct 2020 14:07:02 +0100 Subject: d: Add dragonflybsd support for D compiler and runtime gcc/ChangeLog: * config.gcc (*-*-dragonfly*): Add dragonfly-d.o and t-dragonfly. * config/dragonfly-d.c: New file. * config/t-dragonfly: New file. libphobos/ChangeLog: * configure.tgt: Add *-*-dragonfly* as a supported target. * configure: Regenerate. * m4/druntime/os.m4 (DRUNTIME_OS_SOURCES): Add dragonfly* as a posix target. --- libphobos/configure | 2 +- libphobos/configure.tgt | 3 +++ libphobos/m4/druntime/os.m4 | 2 +- 3 files changed, 5 insertions(+), 2 deletions(-) (limited to 'libphobos') diff --git a/libphobos/configure b/libphobos/configure index de6d367..6d8461f 100755 --- a/libphobos/configure +++ b/libphobos/configure @@ -14283,7 +14283,7 @@ fi druntime_target_posix="no" case "$druntime_cv_target_os" in - aix*|*bsd*|cygwin*|darwin*|gnu*|linux*|skyos*|*solaris*|sysv*) + aix*|*bsd*|cygwin*|darwin*|dragonfly*|gnu*|linux*|skyos*|*solaris*|sysv*) druntime_target_posix="yes" ;; esac diff --git a/libphobos/configure.tgt b/libphobos/configure.tgt index 94e42bf..1ea9e0c 100644 --- a/libphobos/configure.tgt +++ b/libphobos/configure.tgt @@ -24,6 +24,9 @@ LIBPHOBOS_SUPPORTED=no LIBDRUNTIME_ONLY=auto case "${target}" in + *-*-dragonfly*) + LIBPHOBOS_SUPPORTED=yes + ;; aarch64*-*-linux*) LIBPHOBOS_SUPPORTED=yes ;; diff --git a/libphobos/m4/druntime/os.m4 b/libphobos/m4/druntime/os.m4 index 47d4c6a..ed93e30 100644 --- a/libphobos/m4/druntime/os.m4 +++ b/libphobos/m4/druntime/os.m4 @@ -112,7 +112,7 @@ AC_DEFUN([DRUNTIME_OS_SOURCES], druntime_target_posix="no" case "$druntime_cv_target_os" in - aix*|*bsd*|cygwin*|darwin*|gnu*|linux*|skyos*|*solaris*|sysv*) + aix*|*bsd*|cygwin*|darwin*|dragonfly*|gnu*|linux*|skyos*|*solaris*|sysv*) druntime_target_posix="yes" ;; esac -- cgit v1.1 From 25bb75f841c552cfd27a4344b7487efbe35b4481 Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Thu, 19 Nov 2020 00:16:30 +0000 Subject: Daily bump. --- libphobos/ChangeLog | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'libphobos') diff --git a/libphobos/ChangeLog b/libphobos/ChangeLog index f31a889..d4c9184 100644 --- a/libphobos/ChangeLog +++ b/libphobos/ChangeLog @@ -1,3 +1,14 @@ +2020-11-18 Iain Buclaw + + * configure.tgt: Add *-*-dragonfly* as a supported target. + * configure: Regenerate. + * m4/druntime/os.m4 (DRUNTIME_OS_SOURCES): Add dragonfly* as a posix + target. + +2020-11-18 Iain Buclaw + + * src/MERGE: Merge upstream phobos 7948e0967. + 2020-11-13 Iain Buclaw * configure: Regenerate. -- cgit v1.1 From 9285e0f694969dc2d1d9257378ddf6c8ef42de3c Mon Sep 17 00:00:00 2001 From: Iain Buclaw Date: Thu, 26 Nov 2020 10:46:36 +0100 Subject: d: Add float and double overloads for all core.math intrinsics For the math intrinsics: cos, fabs, ldexp, rint, rndtol, and sin, new overloads have been added to the core.math module for matching float and double types. These have been implemented in the compiler. A recent change to dump_function_to_file started triggering some scan-tree-dump tests to FAIL, these have been adjusted as well when updating the test. gcc/d/ChangeLog: * intrinsics.cc (maybe_expand_intrinsic): Handle new intrinsics. * intrinsics.def (INTRINSIC_COS): Add float and double overloads. (INTRINSIC_FABS): Likewise. (INTRINSIC_LDEXP): Likewise. (INTRINSIC_RINT): Likewise. (INTRINSIC_RNDTOL): Likewise. (INTRINSIC_SIN): Likewise. (INTRINSIC_TOPREC): Adjust signature. libphobos/ChangeLog: * libdruntime/MERGE: Merge upstream druntime 5e4492c4. gcc/testsuite/ChangeLog: * gdc.dg/intrinsics.d: Adjust patterns in scan-tree-dump. --- libphobos/libdruntime/MERGE | 2 +- libphobos/libdruntime/core/math.d | 113 +++++++++++++++++++++----------------- 2 files changed, 65 insertions(+), 50 deletions(-) (limited to 'libphobos') diff --git a/libphobos/libdruntime/MERGE b/libphobos/libdruntime/MERGE index 485f8e9..91154ee 100644 --- a/libphobos/libdruntime/MERGE +++ b/libphobos/libdruntime/MERGE @@ -1,4 +1,4 @@ -58560d5163381b0f1c893bd0d035b7a0a1631f92 +5e4492c45172110b035591f5961b9f9f5adf6f13 The first line of this file holds the git revision number of the last merge done from the dlang/druntime repository. diff --git a/libphobos/libdruntime/core/math.d b/libphobos/libdruntime/core/math.d index 219b426..4d46b67 100644 --- a/libphobos/libdruntime/core/math.d +++ b/libphobos/libdruntime/core/math.d @@ -1,4 +1,4 @@ -// Written in the D programming language. +// Written in the D programming language. /** * Builtin mathematical intrinsics @@ -19,15 +19,26 @@ * GT = > * * Copyright: Copyright Digital Mars 2000 - 2011. - * License: $(WEB www.boost.org/LICENSE_1_0.txt, Boost License 1.0). - * Authors: $(WEB digitalmars.com, Walter Bright), + * License: $(HTTP www.boost.org/LICENSE_1_0.txt, Boost License 1.0). + * Authors: $(HTTP digitalmars.com, Walter Bright), * Don Clugston */ module core.math; public: @nogc: +nothrow: +@safe: +/***************************************** + * Returns x rounded to a long value using the FE_TONEAREST rounding mode. + * If the integer value of x is + * greater than long.max, the result is + * indeterminate. + */ +extern (C) real rndtonl(real x); + +pure: /*********************************** * Returns cosine of x. x is in radians. * @@ -40,7 +51,9 @@ public: * Results are undefined if |x| >= $(POWER 2,64). */ -real cos(real x) @safe pure nothrow; /* intrinsic */ +float cos(float x); /* intrinsic */ +double cos(double x); /* intrinsic */ /// ditto +real cos(real x); /* intrinsic */ /// ditto /*********************************** * Returns sine of x. x is in radians. @@ -55,7 +68,9 @@ real cos(real x) @safe pure nothrow; /* intrinsic */ * Results are undefined if |x| >= $(POWER 2,64). */ -real sin(real x) @safe pure nothrow; /* intrinsic */ +float sin(float x); /* intrinsic */ +double sin(double x); /* intrinsic */ /// ditto +real sin(real x); /* intrinsic */ /// ditto /***************************************** * Returns x rounded to a long value using the current rounding mode. @@ -63,16 +78,10 @@ real sin(real x) @safe pure nothrow; /* intrinsic */ * greater than long.max, the result is * indeterminate. */ -long rndtol(real x) @safe pure nothrow; /* intrinsic */ - -/***************************************** - * Returns x rounded to a long value using the FE_TONEAREST rounding mode. - * If the integer value of x is - * greater than long.max, the result is - * indeterminate. - */ -extern (C) real rndtonl(real x); +long rndtol(float x); /* intrinsic */ +long rndtol(double x); /* intrinsic */ /// ditto +long rndtol(real x); /* intrinsic */ /// ditto /*************************************** * Compute square root of x. @@ -85,57 +94,65 @@ extern (C) real rndtonl(real x); * ) */ -@safe pure nothrow -{ - float sqrt(float x); /* intrinsic */ - double sqrt(double x); /* intrinsic */ /// ditto - real sqrt(real x); /* intrinsic */ /// ditto -} +float sqrt(float x); /* intrinsic */ +double sqrt(double x); /* intrinsic */ /// ditto +real sqrt(real x); /* intrinsic */ /// ditto /******************************************* * Compute n * 2$(SUPERSCRIPT exp) * References: frexp */ -real ldexp(real n, int exp) @safe pure nothrow; /* intrinsic */ +float ldexp(float n, int exp); /* intrinsic */ +double ldexp(double n, int exp); /* intrinsic */ /// ditto +real ldexp(real n, int exp); /* intrinsic */ /// ditto unittest { static if (real.mant_dig == 113) { - assert(ldexp(1, -16384) == 0x1p-16384L); - assert(ldexp(1, -16382) == 0x1p-16382L); + assert(ldexp(1.0L, -16384) == 0x1p-16384L); + assert(ldexp(1.0L, -16382) == 0x1p-16382L); } else static if (real.mant_dig == 106) { - assert(ldexp(1, 1023) == 0x1p1023L); - assert(ldexp(1, -1022) == 0x1p-1022L); - assert(ldexp(1, -1021) == 0x1p-1021L); + assert(ldexp(1.0L, 1023) == 0x1p1023L); + assert(ldexp(1.0L, -1022) == 0x1p-1022L); + assert(ldexp(1.0L, -1021) == 0x1p-1021L); } else static if (real.mant_dig == 64) { - assert(ldexp(1, -16384) == 0x1p-16384L); - assert(ldexp(1, -16382) == 0x1p-16382L); + assert(ldexp(1.0L, -16384) == 0x1p-16384L); + assert(ldexp(1.0L, -16382) == 0x1p-16382L); } else static if (real.mant_dig == 53) { - assert(ldexp(1, 1023) == 0x1p1023L); - assert(ldexp(1, -1022) == 0x1p-1022L); - assert(ldexp(1, -1021) == 0x1p-1021L); + assert(ldexp(1.0L, 1023) == 0x1p1023L); + assert(ldexp(1.0L, -1022) == 0x1p-1022L); + assert(ldexp(1.0L, -1021) == 0x1p-1021L); } else assert(false, "Only 128bit, 80bit and 64bit reals expected here"); } /******************************* - * Returns |x| - * + * Compute the absolute value. * $(TABLE_SV * $(TR $(TH x) $(TH fabs(x))) * $(TR $(TD $(PLUSMN)0.0) $(TD +0.0) ) * $(TR $(TD $(PLUSMN)$(INFIN)) $(TD +$(INFIN)) ) * ) + * It is implemented as a compiler intrinsic. + * Params: + * x = floating point value + * Returns: |x| + * References: equivalent to `std.math.fabs` */ -real fabs(real x) @safe pure nothrow; /* intrinsic */ +@safe pure nothrow @nogc +{ + float fabs(float x); + double fabs(double x); /// ditto + real fabs(real x); /// ditto +} /********************************** * Rounds x to the nearest integer value, using the current rounding @@ -145,22 +162,29 @@ real fabs(real x) @safe pure nothrow; /* intrinsic */ * $(B nearbyint) performs * the same operation, but does not set the FE_INEXACT exception. */ -real rint(real x) @safe pure nothrow; /* intrinsic */ +float rint(float x); /* intrinsic */ +double rint(double x); /* intrinsic */ /// ditto +real rint(real x); /* intrinsic */ /// ditto /*********************************** * Building block functions, they * translate to a single x87 instruction. */ - -real yl2x(real x, real y) @safe pure nothrow; // y * log2(x) -real yl2xp1(real x, real y) @safe pure nothrow; // y * log2(x + 1) +// y * log2(x) +float yl2x(float x, float y); /* intrinsic */ +double yl2x(double x, double y); /* intrinsic */ /// ditto +real yl2x(real x, real y); /* intrinsic */ /// ditto +// y * log2(x +1) +float yl2xp1(float x, float y); /* intrinsic */ +double yl2xp1(double x, double y); /* intrinsic */ /// ditto +real yl2xp1(real x, real y); /* intrinsic */ /// ditto unittest { version (INLINE_YL2X) { - assert(yl2x(1024, 1) == 10); - assert(yl2xp1(1023, 1) == 10); + assert(yl2x(1024.0L, 1) == 10); + assert(yl2xp1(1023.0L, 1) == 10); } } @@ -179,31 +203,22 @@ unittest * Returns: * f in precision of type `T` */ -@safe pure nothrow T toPrec(T:float)(float f) { pragma(inline, false); return f; } /// ditto -@safe pure nothrow T toPrec(T:float)(double f) { pragma(inline, false); return cast(T) f; } /// ditto -@safe pure nothrow T toPrec(T:float)(real f) { pragma(inline, false); return cast(T) f; } /// ditto -@safe pure nothrow T toPrec(T:double)(float f) { pragma(inline, false); return f; } /// ditto -@safe pure nothrow T toPrec(T:double)(double f) { pragma(inline, false); return f; } /// ditto -@safe pure nothrow T toPrec(T:double)(real f) { pragma(inline, false); return cast(T) f; } /// ditto -@safe pure nothrow T toPrec(T:real)(float f) { pragma(inline, false); return f; } /// ditto -@safe pure nothrow T toPrec(T:real)(double f) { pragma(inline, false); return f; } /// ditto -@safe pure nothrow T toPrec(T:real)(real f) { pragma(inline, false); return f; } @safe unittest -- cgit v1.1 From 6ac67dddc31e6ab4f954e27e1f86e005537efc12 Mon Sep 17 00:00:00 2001 From: Iain Buclaw Date: Thu, 26 Nov 2020 11:15:32 +0100 Subject: libphobos: Merge upstream phobos 38873fe6e. Adds support for FreeBSD/x86 53-bit precision reals, and removes all support code and tests for the extern(Pascal) calling convention. Reviewed-on: https://github.com/dlang/phobos/pull/7704 https://github.com/dlang/phobos/pull/7705 libphobos/ChangeLog: * src/MERGE: Merge upstream phobos 38873fe6e. --- libphobos/src/MERGE | 2 +- libphobos/src/std/complex.d | 20 ++++--- libphobos/src/std/conv.d | 26 ++++++--- libphobos/src/std/internal/math/gammafunction.d | 7 +++ libphobos/src/std/math.d | 72 ++++++++++++++++--------- libphobos/src/std/traits.d | 6 +-- 6 files changed, 92 insertions(+), 41 deletions(-) (limited to 'libphobos') diff --git a/libphobos/src/MERGE b/libphobos/src/MERGE index de86ff5..cd620c9 100644 --- a/libphobos/src/MERGE +++ b/libphobos/src/MERGE @@ -1,4 +1,4 @@ -7948e096735adbc093333da789fc28feadce24b0 +38873fe6ee70fe8e2b7a41b7c3663e090e27d61b The first line of this file holds the git revision number of the last merge done from the dlang/phobos repository. diff --git a/libphobos/src/std/complex.d b/libphobos/src/std/complex.d index b078051..8e488db 100644 --- a/libphobos/src/std/complex.d +++ b/libphobos/src/std/complex.d @@ -832,8 +832,13 @@ Complex!T sin(T)(Complex!T z) @safe pure nothrow @nogc @safe pure nothrow unittest { static import std.math; + import std.math : feqrel; assert(sin(complex(0.0)) == 0.0); - assert(sin(complex(2.0L, 0)) == std.math.sin(2.0L)); + assert(sin(complex(2.0, 0)) == std.math.sin(2.0)); + auto c1 = sin(complex(2.0L, 0)); + auto c2 = complex(std.math.sin(2.0L), 0); + assert(feqrel(c1.re, c2.re) >= real.mant_dig - 1 && + feqrel(c1.im, c2.im) >= real.mant_dig - 1); } @@ -849,17 +854,20 @@ Complex!T cos(T)(Complex!T z) @safe pure nothrow @nogc /// @safe pure nothrow unittest { - import std.complex; - import std.math; + static import std.math; + import std.math : feqrel; assert(cos(complex(0.0)) == 1.0); - assert(cos(complex(1.3L)) == std.math.cos(1.3L)); + assert(cos(complex(1.3)) == std.math.cos(1.3)); auto c1 = cos(complex(0, 5.2L)); - auto c2 = cosh(5.2L); + auto c2 = complex(std.math.cosh(5.2L), 0.0L); assert(feqrel(c1.re, c2.re) >= real.mant_dig - 1 && feqrel(c1.im, c2.im) >= real.mant_dig - 1); + auto c3 = cos(complex(1.3L)); + auto c4 = complex(std.math.cos(1.3L), 0.0L); + assert(feqrel(c3.re, c4.re) >= real.mant_dig - 1 && + feqrel(c3.im, c4.im) >= real.mant_dig - 1); } - /** Params: y = A real number. Returns: The value of cos(y) + i sin(y). diff --git a/libphobos/src/std/conv.d b/libphobos/src/std/conv.d index eaee62f..743d203 100644 --- a/libphobos/src/std/conv.d +++ b/libphobos/src/std/conv.d @@ -1629,6 +1629,8 @@ private void testIntegralToFloating(Integral, Floating)() private void testFloatingToIntegral(Floating, Integral)() { + import std.math : floatTraits, RealFormat; + bool convFails(Source, Target, E)(Source src) { try @@ -1660,18 +1662,23 @@ private void testFloatingToIntegral(Floating, Integral)() { a = -a; // -Integral.min not representable as an Integral assert(convFails!(Floating, Integral, ConvOverflowException)(a) - || Floating.sizeof <= Integral.sizeof); + || Floating.sizeof <= Integral.sizeof + || floatTraits!Floating.realFormat == RealFormat.ieeeExtended53); } a = 0.0 + Integral.min; assert(to!Integral(a) == Integral.min); --a; // no more representable as an Integral assert(convFails!(Floating, Integral, ConvOverflowException)(a) - || Floating.sizeof <= Integral.sizeof); + || Floating.sizeof <= Integral.sizeof + || floatTraits!Floating.realFormat == RealFormat.ieeeExtended53); a = 0.0 + Integral.max; - assert(to!Integral(a) == Integral.max || Floating.sizeof <= Integral.sizeof); + assert(to!Integral(a) == Integral.max + || Floating.sizeof <= Integral.sizeof + || floatTraits!Floating.realFormat == RealFormat.ieeeExtended53); ++a; // no more representable as an Integral assert(convFails!(Floating, Integral, ConvOverflowException)(a) - || Floating.sizeof <= Integral.sizeof); + || Floating.sizeof <= Integral.sizeof + || floatTraits!Floating.realFormat == RealFormat.ieeeExtended53); // convert a value with a fractional part a = 3.14; assert(to!Integral(a) == 3); @@ -3016,7 +3023,9 @@ if (isInputRange!Source && isSomeChar!(ElementType!Source) && !is(Source == enum @system unittest { // @system because strtod is not @safe. - static if (real.mant_dig == 53) + import std.math : floatTraits, RealFormat; + + static if (floatTraits!real.realFormat == RealFormat.ieeeDouble) { import core.stdc.stdlib, std.exception, std.math; @@ -3099,7 +3108,8 @@ if (isInputRange!Source && isSomeChar!(ElementType!Source) && !is(Source == enum { ushort[8] value; } - else static if (floatTraits!real.realFormat == RealFormat.ieeeExtended) + else static if (floatTraits!real.realFormat == RealFormat.ieeeExtended || + floatTraits!real.realFormat == RealFormat.ieeeExtended53) { ushort[5] value; } @@ -3122,6 +3132,8 @@ if (isInputRange!Source && isSomeChar!(ElementType!Source) && !is(Source == enum enum s = "0x1.FFFFFFFFFFFFFFFEp-16382"; else static if (floatTraits!real.realFormat == RealFormat.ieeeExtended) enum s = "0x1.FFFFFFFFFFFFFFFEp-16382"; + else static if (floatTraits!real.realFormat == RealFormat.ieeeExtended53) + enum s = "0x1.FFFFFFFFFFFFFFFEp-16382"; else static if (floatTraits!real.realFormat == RealFormat.ieeeDouble) enum s = "0x1.FFFFFFFFFFFFFFFEp-1000"; else @@ -3141,6 +3153,8 @@ if (isInputRange!Source && isSomeChar!(ElementType!Source) && !is(Source == enum else ld1 = strtold(s.ptr, null); } + else static if (floatTraits!real.realFormat == RealFormat.ieeeExtended53) + ld1 = 0x1.FFFFFFFFFFFFFFFEp-16382L; // strtold rounds to 53 bits. else ld1 = strtold(s.ptr, null); diff --git a/libphobos/src/std/internal/math/gammafunction.d b/libphobos/src/std/internal/math/gammafunction.d index dd20691..c9677c7 100644 --- a/libphobos/src/std/internal/math/gammafunction.d +++ b/libphobos/src/std/internal/math/gammafunction.d @@ -253,6 +253,8 @@ static if (floatTraits!(real).realFormat == RealFormat.ieeeQuadruple) enum real MAXGAMMA = 1755.5483429L; else static if (floatTraits!(real).realFormat == RealFormat.ieeeExtended) enum real MAXGAMMA = 1755.5483429L; +else static if (floatTraits!(real).realFormat == RealFormat.ieeeExtended53) + enum real MAXGAMMA = 1755.5483429L; else static if (floatTraits!(real).realFormat == RealFormat.ieeeDouble) enum real MAXGAMMA = 171.6243769L; else @@ -603,6 +605,11 @@ else static if (floatTraits!(real).realFormat == RealFormat.ieeeExtended) enum real MAXLOG = 0x1.62e42fefa39ef358p+13L; // log(real.max) enum real MINLOG = -0x1.6436716d5406e6d8p+13L; // log(real.min_normal*real.epsilon) = log(smallest denormal) } +else static if (floatTraits!(real).realFormat == RealFormat.ieeeExtended53) +{ + enum real MAXLOG = 0x1.62e42fefa39ef358p+13L; // log(real.max) + enum real MINLOG = -0x1.6436716d5406e6d8p+13L; // log(real.min_normal*real.epsilon) = log(smallest denormal) +} else static if (floatTraits!(real).realFormat == RealFormat.ieeeDouble) { enum real MAXLOG = 0x1.62e42fefa39efp+9L; // log(real.max) diff --git a/libphobos/src/std/math.d b/libphobos/src/std/math.d index 5cc3a85..3d18cfa 100644 --- a/libphobos/src/std/math.d +++ b/libphobos/src/std/math.d @@ -495,7 +495,8 @@ T floorImpl(T)(const T x) @trusted pure nothrow @nogc else int pos = 3; } - else static if (F.realFormat == RealFormat.ieeeExtended) + else static if (F.realFormat == RealFormat.ieeeExtended || + F.realFormat == RealFormat.ieeeExtended53) { int exp = (y.vu[F.EXPPOS_SHORT] & 0x7fff) - 0x3fff; @@ -542,7 +543,10 @@ T floorImpl(T)(const T x) @trusted pure nothrow @nogc } else { - exp = (T.mant_dig - 1) - exp; + static if (F.realFormat == RealFormat.ieeeExtended53) + exp = (T.mant_dig + 11 - 1) - exp; // mant_dig is really 64 + else + exp = (T.mant_dig - 1) - exp; // Zero 16 bits at a time. while (exp >= 16) @@ -1079,13 +1083,13 @@ Lret: {} real t = tan(x); //printf("tan(%Lg) = %Lg, should be %Lg\n", x, t, r); - if (!isIdentical(r, t)) assert(fabs(r-t) <= .0000001); + assert(approxEqual(r, t)); x = -x; r = -r; t = tan(x); //printf("tan(%Lg) = %Lg, should be %Lg\n", x, t, r); - if (!isIdentical(r, t) && !(r != r && t != t)) assert(fabs(r-t) <= .0000001); + assert(approxEqual(r, t)); } // overflow assert(isNaN(tan(real.infinity))); @@ -1150,7 +1154,7 @@ float asin(float x) @safe pure nothrow @nogc { return asin(cast(real) x); } @system unittest { - assert(equalsDigit(asin(0.5), PI / 6, useDigits)); + assert(asin(0.5).approxEqual(PI / 6)); } /*************** @@ -1379,7 +1383,7 @@ float atan2(float y, float x) @safe pure nothrow @nogc @system unittest { - assert(equalsDigit(atan2(1.0L, std.math.sqrt(3.0L)), PI / 6, useDigits)); + assert(atan2(1.0, sqrt(3.0)).approxEqual(PI / 6)); } /*********************************** @@ -1441,7 +1445,7 @@ float sinh(float x) @safe pure nothrow @nogc { return sinh(cast(real) x); } @system unittest { - assert(equalsDigit(sinh(1.0), (E - 1.0 / E) / 2, useDigits)); + assert(sinh(1.0).approxEqual((E - 1.0 / E) / 2)); } /*********************************** @@ -1791,7 +1795,8 @@ real exp(real x) @trusted pure nothrow @nogc enum real OF = 7.09782712893383996732E2; // ln((1-2^-53) * 2^1024) enum real UF = -7.451332191019412076235E2; // ln(2^-1075) } - else static if (F.realFormat == RealFormat.ieeeExtended) + else static if (F.realFormat == RealFormat.ieeeExtended || + F.realFormat == RealFormat.ieeeExtended53) { // Coefficients for exp(x) static immutable real[3] P = [ @@ -1882,7 +1887,7 @@ float exp(float x) @safe pure nothrow @nogc { return exp(cast(real) x); } @system unittest { - assert(equalsDigit(exp(3.0L), E * E * E, useDigits)); + assert(exp(3.0).feqrel(E * E * E) > 16); } /** @@ -2468,7 +2473,8 @@ private real exp2Impl(real x) @nogc @trusted pure nothrow ctrl.rounding = FloatingPointControl.roundToNearest; } - static if (real.mant_dig == 113) + enum realFormat = floatTraits!real.realFormat; + static if (realFormat == RealFormat.ieeeQuadruple) { static immutable real[2][] exptestpoints = [ // x exp(x) @@ -2487,7 +2493,8 @@ private real exp2Impl(real x) @nogc @trusted pure nothrow [-0x1p+30L, 0 ], // far underflow ]; } - else static if (real.mant_dig == 64) // 80-bit reals + else static if (realFormat == RealFormat.ieeeExtended || + realFormat == RealFormat.ieeeExtended53) { static immutable real[2][] exptestpoints = [ // x exp(x) @@ -2506,7 +2513,7 @@ private real exp2Impl(real x) @nogc @trusted pure nothrow [-0x1p+30L, 0 ], // far underflow ]; } - else static if (real.mant_dig == 53) // 64-bit reals + else static if (realFormat == RealFormat.ieeeDouble) { static immutable real[2][] exptestpoints = [ // x, exp(x) @@ -2527,14 +2534,14 @@ private real exp2Impl(real x) @nogc @trusted pure nothrow else static assert(0, "No exp() tests for real type!"); - const minEqualDecimalDigits = real.dig - 3; + const minEqualMantissaBits = real.mant_dig - 13; real x; version (IeeeFlagsSupport) IeeeFlags f; foreach (ref pair; exptestpoints) { version (IeeeFlagsSupport) resetIeeeFlags(); x = exp(pair[0]); - assert(equalsDigit(x, pair[1], minEqualDecimalDigits)); + assert(feqrel(x, pair[1]) >= minEqualMantissaBits); } // Ideally, exp(0) would not set the inexact flag. @@ -2650,7 +2657,8 @@ if (isFloatingPoint!T) alias F = floatTraits!T; ex = vu[F.EXPPOS_SHORT] & F.EXPMASK; - static if (F.realFormat == RealFormat.ieeeExtended) + static if (F.realFormat == RealFormat.ieeeExtended || + F.realFormat == RealFormat.ieeeExtended53) { if (ex) { // If exponent is non-zero @@ -2938,7 +2946,8 @@ if (isFloatingPoint!T) y.rv = x; int ex = y.vu[F.EXPPOS_SHORT] & F.EXPMASK; - static if (F.realFormat == RealFormat.ieeeExtended) + static if (F.realFormat == RealFormat.ieeeExtended || + F.realFormat == RealFormat.ieeeExtended53) { if (ex) { @@ -3184,6 +3193,7 @@ float ldexp(float n, int exp) @safe pure nothrow @nogc { return ldexp(cast(real) @safe pure nothrow @nogc unittest { static if (floatTraits!(real).realFormat == RealFormat.ieeeExtended || + floatTraits!(real).realFormat == RealFormat.ieeeExtended53 || floatTraits!(real).realFormat == RealFormat.ieeeQuadruple) { assert(ldexp(1.0L, -16384) == 0x1p-16384L); @@ -4428,12 +4438,16 @@ long lrint(real x) @trusted pure nothrow @nogc return sign ? -result : result; } - else static if (F.realFormat == RealFormat.ieeeExtended) + else static if (F.realFormat == RealFormat.ieeeExtended || + F.realFormat == RealFormat.ieeeExtended53) { long result; // Rounding limit when casting from real(80-bit) to ulong. - enum real OF = 9.22337203685477580800E18L; + static if (F.realFormat == RealFormat.ieeeExtended) + enum real OF = 9.22337203685477580800E18L; + else + enum real OF = 4.50359962737049600000E15L; ushort* vu = cast(ushort*)(&x); uint* vi = cast(uint*)(&x); @@ -5904,7 +5918,8 @@ bool isSubnormal(X)(X x) @trusted pure nothrow @nogc return (e == 0 && ((ps[MANTISSA_LSB]|(ps[MANTISSA_MSB]& 0x0000_FFFF_FFFF_FFFF)) != 0)); } - else static if (F.realFormat == RealFormat.ieeeExtended) + else static if (F.realFormat == RealFormat.ieeeExtended || + F.realFormat == RealFormat.ieeeExtended53) { ushort* pe = cast(ushort *)&x; long* ps = cast(long *)&x; @@ -5954,7 +5969,8 @@ if (isFloatingPoint!(X)) return ((*cast(ulong *)&x) & 0x7FFF_FFFF_FFFF_FFFF) == 0x7FF0_0000_0000_0000; } - else static if (F.realFormat == RealFormat.ieeeExtended) + else static if (F.realFormat == RealFormat.ieeeExtended || + F.realFormat == RealFormat.ieeeExtended53) { const ushort e = cast(ushort)(F.EXPMASK & (cast(ushort *)&x)[F.EXPPOS_SHORT]); const ulong ps = *cast(ulong *)&x; @@ -6217,7 +6233,8 @@ F sgn(F)(F x) @safe pure nothrow @nogc real NaN(ulong payload) @trusted pure nothrow @nogc { alias F = floatTraits!(real); - static if (F.realFormat == RealFormat.ieeeExtended) + static if (F.realFormat == RealFormat.ieeeExtended || + F.realFormat == RealFormat.ieeeExtended53) { // real80 (in x86 real format, the implied bit is actually // not implied but a real bit which is stored in the real) @@ -6423,11 +6440,14 @@ real nextUp(real x) @trusted pure nothrow @nogc } return x; } - else static if (F.realFormat == RealFormat.ieeeExtended) + else static if (F.realFormat == RealFormat.ieeeExtended || + F.realFormat == RealFormat.ieeeExtended53) { // For 80-bit reals, the "implied bit" is a nuisance... ushort *pe = cast(ushort *)&x; ulong *ps = cast(ulong *)&x; + // EPSILON is 1 for 64-bit, and 2048 for 53-bit precision reals. + enum ulong EPSILON = 2UL ^^ (64 - real.mant_dig); if ((pe[F.EXPPOS_SHORT] & F.EXPMASK) == F.EXPMASK) { @@ -6438,7 +6458,7 @@ real nextUp(real x) @trusted pure nothrow @nogc if (pe[F.EXPPOS_SHORT] & 0x8000) { // Negative number -- need to decrease the significand - --*ps; + *ps -= EPSILON; // Need to mask with 0x7FFF... so subnormals are treated correctly. if ((*ps & 0x7FFF_FFFF_FFFF_FFFF) == 0x7FFF_FFFF_FFFF_FFFF) { @@ -6463,7 +6483,7 @@ real nextUp(real x) @trusted pure nothrow @nogc { // Positive number -- need to increase the significand. // Works automatically for positive zero. - ++*ps; + *ps += EPSILON; if ((*ps & 0x7FFF_FFFF_FFFF_FFFF) == 0) { // change in exponent @@ -7228,6 +7248,7 @@ if (isFloatingPoint!(X)) static assert(F.realFormat == RealFormat.ieeeSingle || F.realFormat == RealFormat.ieeeDouble || F.realFormat == RealFormat.ieeeExtended + || F.realFormat == RealFormat.ieeeExtended53 || F.realFormat == RealFormat.ieeeQuadruple); if (x == y) @@ -7367,7 +7388,8 @@ body alias F = floatTraits!(T); T u; - static if (F.realFormat == RealFormat.ieeeExtended) + static if (F.realFormat == RealFormat.ieeeExtended || + F.realFormat == RealFormat.ieeeExtended53) { // There's slight additional complexity because they are actually // 79-bit reals... diff --git a/libphobos/src/std/traits.d b/libphobos/src/std/traits.d index 4359dfb..7badab42 100644 --- a/libphobos/src/std/traits.d +++ b/libphobos/src/std/traits.d @@ -1927,7 +1927,7 @@ Determine the linkage attribute of the function. Params: func = the function symbol, or the type of a function, delegate, or pointer to function Returns: - one of the strings "D", "C", "Windows", "Pascal", or "Objective-C" + one of the strings "D", "C", "Windows", or "Objective-C" */ template functionLinkage(func...) if (func.length == 1 && isCallable!func) @@ -2148,7 +2148,7 @@ template SetFunctionAttributes(T, string linkage, uint attrs) !(attrs & FunctionAttribute.safe), "Cannot have a function/delegate that is both trusted and safe."); - static immutable linkages = ["D", "C", "Windows", "Pascal", "C++", "System"]; + static immutable linkages = ["D", "C", "Windows", "C++", "System"]; static assert(canFind(linkages, linkage), "Invalid linkage '" ~ linkage ~ "', must be one of " ~ linkages.stringof ~ "."); @@ -2263,7 +2263,7 @@ version (unittest) // Check that all linkage types work (D-style variadics require D linkage). static if (variadicFunctionStyle!T != Variadic.d) { - foreach (newLinkage; AliasSeq!("D", "C", "Windows", "Pascal", "C++")) + foreach (newLinkage; AliasSeq!("D", "C", "Windows", "C++")) { alias New = SetFunctionAttributes!(T, newLinkage, attrs); static assert(functionLinkage!New == newLinkage, -- cgit v1.1 From f886c4a79573f1f1b46c37a1d5d68a4cf5d1319d Mon Sep 17 00:00:00 2001 From: Iain Buclaw Date: Thu, 26 Nov 2020 11:23:11 +0100 Subject: libphobos: Merge upstream druntime d37ef985. Adds support for FreeBSD/x86 53-bit precision reals, updates bindings for FreeBSD 12.x, and removes all support code and tests for the extern(Pascal) calling convention. Reviewed-on: https://github.com/dlang/druntime/pull/3286 https://github.com/dlang/druntime/pull/3287 libphobos/ChangeLog: * libdruntime/MERGE: Merge upstream druntime d37ef985. * libdruntime/Makefile.am (DRUNTIME_DSOURCES_FREEBSD): Add core/sys/freebsd/config.d * libdruntime/Makefile.in: Regenerate. --- libphobos/libdruntime/MERGE | 2 +- libphobos/libdruntime/Makefile.am | 20 ++--- libphobos/libdruntime/Makefile.in | 23 +++--- libphobos/libdruntime/core/demangle.d | 15 +--- libphobos/libdruntime/core/internal/convert.d | 11 ++- libphobos/libdruntime/core/sys/freebsd/config.d | 24 ++++++ libphobos/libdruntime/core/sys/freebsd/sys/event.d | 35 +++++--- libphobos/libdruntime/core/sys/freebsd/sys/mount.d | 14 +++- libphobos/libdruntime/core/sys/posix/dirent.d | 33 ++++++-- libphobos/libdruntime/core/sys/posix/sys/stat.d | 94 ++++++++++++++++------ libphobos/libdruntime/core/sys/posix/sys/types.d | 19 ++++- libphobos/libdruntime/rt/critical_.d | 2 +- libphobos/libdruntime/rt/dmain2.d | 21 +---- 13 files changed, 214 insertions(+), 99 deletions(-) create mode 100644 libphobos/libdruntime/core/sys/freebsd/config.d (limited to 'libphobos') diff --git a/libphobos/libdruntime/MERGE b/libphobos/libdruntime/MERGE index 91154ee..6b65a44 100644 --- a/libphobos/libdruntime/MERGE +++ b/libphobos/libdruntime/MERGE @@ -1,4 +1,4 @@ -5e4492c45172110b035591f5961b9f9f5adf6f13 +d37ef985a97eb446371ab4b2315a52b87233fbf3 The first line of this file holds the git revision number of the last merge done from the dlang/druntime repository. diff --git a/libphobos/libdruntime/Makefile.am b/libphobos/libdruntime/Makefile.am index 4136642..4798bdf 100644 --- a/libphobos/libdruntime/Makefile.am +++ b/libphobos/libdruntime/Makefile.am @@ -237,16 +237,16 @@ DRUNTIME_DSOURCES_DRAGONFLYBSD = core/sys/dragonflybsd/dlfcn.d \ core/sys/dragonflybsd/sys/mman.d core/sys/dragonflybsd/sys/socket.d \ core/sys/dragonflybsd/time.d -DRUNTIME_DSOURCES_FREEBSD = core/sys/freebsd/dlfcn.d \ - core/sys/freebsd/execinfo.d core/sys/freebsd/netinet/in_.d \ - core/sys/freebsd/pthread_np.d core/sys/freebsd/string.d \ - core/sys/freebsd/sys/_bitset.d core/sys/freebsd/sys/_cpuset.d \ - core/sys/freebsd/sys/cdefs.d core/sys/freebsd/sys/elf.d \ - core/sys/freebsd/sys/elf32.d core/sys/freebsd/sys/elf64.d \ - core/sys/freebsd/sys/elf_common.d core/sys/freebsd/sys/event.d \ - core/sys/freebsd/sys/link_elf.d core/sys/freebsd/sys/mman.d \ - core/sys/freebsd/sys/mount.d core/sys/freebsd/time.d \ - core/sys/freebsd/unistd.d +DRUNTIME_DSOURCES_FREEBSD = core/sys/freebsd/config.d \ + core/sys/freebsd/dlfcn.d core/sys/freebsd/execinfo.d \ + core/sys/freebsd/netinet/in_.d core/sys/freebsd/pthread_np.d \ + core/sys/freebsd/string.d core/sys/freebsd/sys/_bitset.d \ + core/sys/freebsd/sys/_cpuset.d core/sys/freebsd/sys/cdefs.d \ + core/sys/freebsd/sys/elf.d core/sys/freebsd/sys/elf32.d \ + core/sys/freebsd/sys/elf64.d core/sys/freebsd/sys/elf_common.d \ + core/sys/freebsd/sys/event.d core/sys/freebsd/sys/link_elf.d \ + core/sys/freebsd/sys/mman.d core/sys/freebsd/sys/mount.d \ + core/sys/freebsd/time.d core/sys/freebsd/unistd.d DRUNTIME_DSOURCES_LINUX = core/sys/linux/config.d \ core/sys/linux/dlfcn.d core/sys/linux/elf.d core/sys/linux/epoll.d \ diff --git a/libphobos/libdruntime/Makefile.in b/libphobos/libdruntime/Makefile.in index d0bb324..0b89514 100644 --- a/libphobos/libdruntime/Makefile.in +++ b/libphobos/libdruntime/Makefile.in @@ -299,7 +299,7 @@ am__objects_7 = core/sys/dragonflybsd/dlfcn.lo \ am__objects_9 = core/sys/bionic/fcntl.lo core/sys/bionic/string.lo \ core/sys/bionic/unistd.lo @DRUNTIME_OS_ANDROID_TRUE@am__objects_10 = $(am__objects_9) -am__objects_11 = core/sys/freebsd/dlfcn.lo \ +am__objects_11 = core/sys/freebsd/config.lo core/sys/freebsd/dlfcn.lo \ core/sys/freebsd/execinfo.lo core/sys/freebsd/netinet/in_.lo \ core/sys/freebsd/pthread_np.lo core/sys/freebsd/string.lo \ core/sys/freebsd/sys/_bitset.lo \ @@ -861,16 +861,16 @@ DRUNTIME_DSOURCES_DRAGONFLYBSD = core/sys/dragonflybsd/dlfcn.d \ core/sys/dragonflybsd/sys/mman.d core/sys/dragonflybsd/sys/socket.d \ core/sys/dragonflybsd/time.d -DRUNTIME_DSOURCES_FREEBSD = core/sys/freebsd/dlfcn.d \ - core/sys/freebsd/execinfo.d core/sys/freebsd/netinet/in_.d \ - core/sys/freebsd/pthread_np.d core/sys/freebsd/string.d \ - core/sys/freebsd/sys/_bitset.d core/sys/freebsd/sys/_cpuset.d \ - core/sys/freebsd/sys/cdefs.d core/sys/freebsd/sys/elf.d \ - core/sys/freebsd/sys/elf32.d core/sys/freebsd/sys/elf64.d \ - core/sys/freebsd/sys/elf_common.d core/sys/freebsd/sys/event.d \ - core/sys/freebsd/sys/link_elf.d core/sys/freebsd/sys/mman.d \ - core/sys/freebsd/sys/mount.d core/sys/freebsd/time.d \ - core/sys/freebsd/unistd.d +DRUNTIME_DSOURCES_FREEBSD = core/sys/freebsd/config.d \ + core/sys/freebsd/dlfcn.d core/sys/freebsd/execinfo.d \ + core/sys/freebsd/netinet/in_.d core/sys/freebsd/pthread_np.d \ + core/sys/freebsd/string.d core/sys/freebsd/sys/_bitset.d \ + core/sys/freebsd/sys/_cpuset.d core/sys/freebsd/sys/cdefs.d \ + core/sys/freebsd/sys/elf.d core/sys/freebsd/sys/elf32.d \ + core/sys/freebsd/sys/elf64.d core/sys/freebsd/sys/elf_common.d \ + core/sys/freebsd/sys/event.d core/sys/freebsd/sys/link_elf.d \ + core/sys/freebsd/sys/mman.d core/sys/freebsd/sys/mount.d \ + core/sys/freebsd/time.d core/sys/freebsd/unistd.d DRUNTIME_DSOURCES_LINUX = core/sys/linux/config.d \ core/sys/linux/dlfcn.d core/sys/linux/elf.d core/sys/linux/epoll.d \ @@ -1435,6 +1435,7 @@ core/sys/bionic/unistd.lo: core/sys/bionic/$(am__dirstamp) core/sys/freebsd/$(am__dirstamp): @$(MKDIR_P) core/sys/freebsd @: > core/sys/freebsd/$(am__dirstamp) +core/sys/freebsd/config.lo: core/sys/freebsd/$(am__dirstamp) core/sys/freebsd/dlfcn.lo: core/sys/freebsd/$(am__dirstamp) core/sys/freebsd/execinfo.lo: core/sys/freebsd/$(am__dirstamp) core/sys/freebsd/netinet/$(am__dirstamp): diff --git a/libphobos/libdruntime/core/demangle.d b/libphobos/libdruntime/core/demangle.d index 86cfcad..4458b70 100644 --- a/libphobos/libdruntime/core/demangle.d +++ b/libphobos/libdruntime/core/demangle.d @@ -1009,7 +1009,6 @@ pure @safe: F // D U // C W // Windows - V // Pascal R // C++ FuncAttrs: @@ -1089,10 +1088,6 @@ pure @safe: popFront(); put( "extern (Windows) " ); break; - case 'V': // Pascal - popFront(); - put( "extern (Pascal) " ); - break; case 'R': // C++ popFront(); put( "extern (C++) " ); @@ -2380,15 +2375,14 @@ private template isExternCPP(FT) if (is(FT == function)) private template hasPlainMangling(FT) if (is(FT == function)) { enum lnk = __traits(getLinkage, FT); - // C || Pascal || Windows - enum hasPlainMangling = lnk == "C" || lnk == "Pascal" || lnk == "Windows"; + // C || Windows + enum hasPlainMangling = lnk == "C" || lnk == "Windows"; } @safe pure nothrow unittest { static extern(D) void fooD(); static extern(C) void fooC(); - static extern(Pascal) void fooP(); static extern(Windows) void fooW(); static extern(C++) void fooCPP(); @@ -2399,13 +2393,11 @@ private template hasPlainMangling(FT) if (is(FT == function)) } static assert(check!(typeof(fooD))(true, false, false)); static assert(check!(typeof(fooC))(false, false, true)); - static assert(check!(typeof(fooP))(false, false, true)); static assert(check!(typeof(fooW))(false, false, true)); static assert(check!(typeof(fooCPP))(false, true, false)); static assert(__traits(compiles, mangleFunc!(typeof(&fooD))(""))); static assert(__traits(compiles, mangleFunc!(typeof(&fooC))(""))); - static assert(__traits(compiles, mangleFunc!(typeof(&fooP))(""))); static assert(__traits(compiles, mangleFunc!(typeof(&fooW))(""))); static assert(!__traits(compiles, mangleFunc!(typeof(&fooCPP))(""))); } @@ -2505,7 +2497,8 @@ version (unittest) "pure @safe void testexpansion.s!(testexpansion.s!(int).s(int).Result).s(testexpansion.s!(int).s(int).Result).Result.foo()"], ["_D13testexpansion__T1sTSQw__TQjTiZQoFiZ6ResultZQBbFQBcZQq3fooMFNaNfZv", "pure @safe void testexpansion.s!(testexpansion.s!(int).s(int).Result).s(testexpansion.s!(int).s(int).Result).Result.foo()"], - // ambiguity on 'V', template value argument or pascal function + // formerly ambiguous on 'V', template value argument or pascal function + // pascal functions have now been removed (in v2.095.0) ["_D3std4conv__T7enumRepTyAaTEQBa12experimental9allocator15building_blocks15stats_collector7OptionsVQCti64ZQDnyQDh", "immutable(char[]) std.conv.enumRep!(immutable(char[]), std.experimental.allocator.building_blocks.stats_collector.Options, 64).enumRep"], // symbol back reference to location with symbol back reference diff --git a/libphobos/libdruntime/core/internal/convert.d b/libphobos/libdruntime/core/internal/convert.d index 8010ad7..d922049 100644 --- a/libphobos/libdruntime/core/internal/convert.d +++ b/libphobos/libdruntime/core/internal/convert.d @@ -39,7 +39,7 @@ const(ubyte)[] toUbyte(T)(const ref T val) if (is(Unqual!T == float) || is(Unqua { if (__ctfe) { - static if (T.mant_dig == float.mant_dig || T.mant_dig == double.mant_dig) + static if (floatFormat!T == FloatFormat.Float || floatFormat!T == FloatFormat.Double) { static if (is(T : ireal)) // https://issues.dlang.org/show_bug.cgi?id=19932 const f = val.im; @@ -628,7 +628,14 @@ template floatFormat(T) if (is(T:real) || is(T:ireal)) static if (T.mant_dig == 24) enum floatFormat = FloatFormat.Float; else static if (T.mant_dig == 53) - enum floatFormat = FloatFormat.Double; + { + // Double precision, or real == double + static if (T.sizeof == double.sizeof) + enum floatFormat = FloatFormat.Double; + // 80-bit real with rounding precision set to 53 bits. + else static if (T.sizeof == real.sizeof) + enum floatFormat = FloatFormat.Real80; + } else static if (T.mant_dig == 64) enum floatFormat = FloatFormat.Real80; else static if (T.mant_dig == 106) diff --git a/libphobos/libdruntime/core/sys/freebsd/config.d b/libphobos/libdruntime/core/sys/freebsd/config.d new file mode 100644 index 0000000..4eda066 --- /dev/null +++ b/libphobos/libdruntime/core/sys/freebsd/config.d @@ -0,0 +1,24 @@ +/** + * D header file for FreeBSD + * + * Authors: Iain Buclaw + */ +module core.sys.freebsd.config; + +version (FreeBSD): + +public import core.sys.posix.config; + +// https://svnweb.freebsd.org/base/head/sys/sys/param.h?view=markup +// __FreeBSD_version numbers are documented in the Porter's Handbook. +// NOTE: When adding newer versions of FreeBSD, verify all current versioned +// bindings are still compatible with the release. + version (FreeBSD_12) enum __FreeBSD_version = 1202000; +else version (FreeBSD_11) enum __FreeBSD_version = 1104000; +else version (FreeBSD_10) enum __FreeBSD_version = 1004000; +else version (FreeBSD_9) enum __FreeBSD_version = 903000; +else version (FreeBSD_8) enum __FreeBSD_version = 804000; +else static assert(false, "Unsupported version of FreeBSD"); + +// First version of FreeBSD to support 64-bit stat buffer. +enum INO64_FIRST = 1200031; diff --git a/libphobos/libdruntime/core/sys/freebsd/sys/event.d b/libphobos/libdruntime/core/sys/freebsd/sys/event.d index 2ae10b3..8ac7c3b 100644 --- a/libphobos/libdruntime/core/sys/freebsd/sys/event.d +++ b/libphobos/libdruntime/core/sys/freebsd/sys/event.d @@ -18,6 +18,7 @@ extern (C): nothrow: @nogc: +import core.sys.freebsd.config; import core.stdc.stdint; // intptr_t, uintptr_t import core.sys.posix.time; // timespec @@ -38,19 +39,35 @@ enum EVFILT_SYSCOUNT = 11, } -extern(D) void EV_SET(kevent_t* kevp, typeof(kevent_t.tupleof) args) +static if (__FreeBSD_version >= 1200000) { - *kevp = kevent_t(args); + struct kevent_t + { + uintptr_t ident; + short filter; + ushort flags; + uint fflags; + long data; + void* udata; + ulong[4] ext; + } +} +else +{ + struct kevent_t + { + uintptr_t ident; /* identifier for this event */ + short filter; /* filter for event */ + ushort flags; + uint fflags; + intptr_t data; + void *udata; /* opaque user data identifier */ + } } -struct kevent_t +extern(D) void EV_SET(kevent_t* kevp, typeof(kevent_t.tupleof) args) { - uintptr_t ident; /* identifier for this event */ - short filter; /* filter for event */ - ushort flags; - uint fflags; - intptr_t data; - void *udata; /* opaque user data identifier */ + *kevp = kevent_t(args); } enum diff --git a/libphobos/libdruntime/core/sys/freebsd/sys/mount.d b/libphobos/libdruntime/core/sys/freebsd/sys/mount.d index 66c69a4..e45c460 100644 --- a/libphobos/libdruntime/core/sys/freebsd/sys/mount.d +++ b/libphobos/libdruntime/core/sys/freebsd/sys/mount.d @@ -11,6 +11,7 @@ module core.sys.freebsd.sys.mount; version (FreeBSD): +import core.sys.freebsd.config; import core.stdc.config : c_long; import core.sys.posix.sys.stat : stat_t; import core.sys.posix.sys.types : uid_t; @@ -32,8 +33,17 @@ struct fid } enum MFSNAMELEN = 16; -enum MNAMELEN = 88; -enum STATFS_VERSION = 0x20030518; + +static if (__FreeBSD_version >= 1200000) +{ + enum MNAMELEN = 1024; + enum STATFS_VERSION = 0x20140518; +} +else +{ + enum MNAMELEN = 88; + enum STATFS_VERSION = 0x20030518; +} struct statfs_t { diff --git a/libphobos/libdruntime/core/sys/posix/dirent.d b/libphobos/libdruntime/core/sys/posix/dirent.d index cea22d2..b12d6b1 100644 --- a/libphobos/libdruntime/core/sys/posix/dirent.d +++ b/libphobos/libdruntime/core/sys/posix/dirent.d @@ -135,6 +135,8 @@ else version (Darwin) } else version (FreeBSD) { + import core.sys.freebsd.config; + // https://github.com/freebsd/freebsd/blob/master/sys/sys/dirent.h enum { @@ -149,14 +151,31 @@ else version (FreeBSD) DT_WHT = 14 } - align(4) - struct dirent + static if (__FreeBSD_version >= 1200000) { - uint d_fileno; - ushort d_reclen; - ubyte d_type; - ubyte d_namlen; - char[256] d_name = 0; + struct dirent + { + ino_t d_fileno; + off_t d_off; + ushort d_reclen; + ubyte d_type; + ubyte d_pad0; + ushort d_namlen; + ushort d_pad1; + char[256] d_name = 0; + } + } + else + { + align(4) + struct dirent + { + uint d_fileno; + ushort d_reclen; + ubyte d_type; + ubyte d_namlen; + char[256] d_name = 0; + } } alias void* DIR; diff --git a/libphobos/libdruntime/core/sys/posix/sys/stat.d b/libphobos/libdruntime/core/sys/posix/sys/stat.d index b154e14..35b1f1c 100644 --- a/libphobos/libdruntime/core/sys/posix/sys/stat.d +++ b/libphobos/libdruntime/core/sys/posix/sys/stat.d @@ -1060,36 +1060,82 @@ else version (Darwin) } else version (FreeBSD) { - // https://github.com/freebsd/freebsd/blob/master/sys/sys/stat.h + import core.sys.freebsd.config; - struct stat_t + // https://github.com/freebsd/freebsd/blob/master/sys/sys/stat.h + static if (__FreeBSD_version >= INO64_FIRST) { - dev_t st_dev; - ino_t st_ino; - mode_t st_mode; - nlink_t st_nlink; - uid_t st_uid; - gid_t st_gid; - dev_t st_rdev; + struct stat_t + { + dev_t st_dev; + ino_t st_ino; + nlink_t st_nlink; + mode_t st_mode; + short st_padding0; + uid_t st_uid; + gid_t st_gid; + int st_padding1; + dev_t st_rdev; - time_t st_atime; - c_long __st_atimensec; - time_t st_mtime; - c_long __st_mtimensec; - time_t st_ctime; - c_long __st_ctimensec; + version (X86) int st_atim_ext; + timespec st_atim; - off_t st_size; - blkcnt_t st_blocks; - blksize_t st_blksize; - fflags_t st_flags; - uint st_gen; - int st_lspare; + version (X86) int st_mtim_ext; + timespec st_mtim; + + version (X86) int st_ctim_ext; + timespec st_ctim; - time_t st_birthtime; - c_long st_birthtimensec; + version (X86) int st_btim_ext; + timespec st_birthtim; - ubyte[16 - timespec.sizeof] padding; + off_t st_size; + blkcnt_t st_blocks; + blksize_t st_blksize; + fflags_t st_flags; + ulong st_gen; + ulong[10] st_spare; + + extern(D) @safe @property inout pure nothrow + { + ref inout(time_t) st_atime() return { return st_atim.tv_sec; } + ref inout(time_t) st_mtime() return { return st_mtim.tv_sec; } + ref inout(time_t) st_ctime() return { return st_ctim.tv_sec; } + ref inout(time_t) st_birthtime() return { return st_birthtim.tv_sec; } + } + } + } + else + { + struct stat_t + { + uint st_dev; + uint st_ino; + mode_t st_mode; + ushort st_nlink; + uid_t st_uid; + gid_t st_gid; + uint st_rdev; + timespec st_atim; + timespec st_mtim; + timespec st_ctim; + off_t st_size; + blkcnt_t st_blocks; + blksize_t st_blksize; + fflags_t st_flags; + uint st_gen; + int st_lspare; + timespec st_birthtim; + ubyte[16 - timespec.sizeof] padding; + + extern(D) @safe @property inout pure nothrow + { + ref inout(time_t) st_atime() return { return st_atim.tv_sec; } + ref inout(time_t) st_mtime() return { return st_mtim.tv_sec; } + ref inout(time_t) st_ctime() return { return st_ctim.tv_sec; } + ref inout(time_t) st_birthtime() return { return st_birthtim.tv_sec; } + } + } } enum S_IRUSR = 0x100; // octal 0000400 diff --git a/libphobos/libdruntime/core/sys/posix/sys/types.d b/libphobos/libdruntime/core/sys/posix/sys/types.d index 451c8b4..2d8ef92 100644 --- a/libphobos/libdruntime/core/sys/posix/sys/types.d +++ b/libphobos/libdruntime/core/sys/posix/sys/types.d @@ -168,14 +168,27 @@ else version (Darwin) } else version (FreeBSD) { + import core.sys.freebsd.config; + // https://github.com/freebsd/freebsd/blob/master/sys/sys/_types.h alias long blkcnt_t; alias uint blksize_t; - alias uint dev_t; + + static if (__FreeBSD_version >= 1200000) + { + alias ulong dev_t; + alias ulong ino_t; + alias ulong nlink_t; + } + else + { + alias uint dev_t; + alias uint ino_t; + alias ushort nlink_t; + } + alias uint gid_t; - alias uint ino_t; alias ushort mode_t; - alias ushort nlink_t; alias long off_t; alias int pid_t; //size_t (defined in core.stdc.stddef) diff --git a/libphobos/libdruntime/rt/critical_.d b/libphobos/libdruntime/rt/critical_.d index 40030ad..15c460a 100644 --- a/libphobos/libdruntime/rt/critical_.d +++ b/libphobos/libdruntime/rt/critical_.d @@ -43,7 +43,7 @@ extern (C) void _d_criticalenter2(D_CRITICAL_SECTION** pcs) lockMutex(cast(Mutex*)&gcs.mtx); if (atomicLoad!(MemoryOrder.raw)(*cast(shared) pcs) is null) { - auto cs = new shared D_CRITICAL_SECTION; + auto cs = new shared(D_CRITICAL_SECTION); initMutex(cast(Mutex*)&cs.mtx); atomicStore!(MemoryOrder.rel)(*cast(shared) pcs, cs); } diff --git a/libphobos/libdruntime/rt/dmain2.d b/libphobos/libdruntime/rt/dmain2.d index 32635c4..3d5ba29 100644 --- a/libphobos/libdruntime/rt/dmain2.d +++ b/libphobos/libdruntime/rt/dmain2.d @@ -9,9 +9,6 @@ * Source: $(DRUNTIMESRC src/rt/_dmain2.d) */ -/* NOTE: This file has been patched from the original DMD distribution to - * work with the GDC compiler. - */ module rt.dmain2; private @@ -340,15 +337,8 @@ extern (C) int _d_run_main(int argc, char **argv, MainFunc mainFunc) version (CRuntime_Microsoft) { // enable full precision for reals - version (GNU) + version (D_InlineAsm_X86_64) { - size_t fpu_cw; - asm { "fstcw %0" : "=m" (fpu_cw); } - fpu_cw |= 0b11_00_111111; // 11: use 64 bit extended-precision - // 111111: mask all FP exceptions - asm { "fldcw %0" : "=m" (fpu_cw); } - } - else version (Win64) asm { push RAX; @@ -358,7 +348,8 @@ extern (C) int _d_run_main(int argc, char **argv, MainFunc mainFunc) fldcw word ptr [RSP]; pop RAX; } - else version (Win32) + } + else version (D_InlineAsm_X86) { asm { @@ -455,12 +446,6 @@ extern (C) int _d_run_main(int argc, char **argv, MainFunc mainFunc) { if (IsDebuggerPresent()) trapExceptions = false; - version (GNU) - { - /* IsDebuggerPresent doesn't detect GDC. Would be nice to have - some way of detecting valid console output */ - trapExceptions = true; - } } void tryExec(scope void delegate() dg) -- cgit v1.1 From 5dbab7b3f4d3a8298aeb8ecde1cfbc4b16913d28 Mon Sep 17 00:00:00 2001 From: Iain Buclaw Date: Fri, 27 Nov 2020 13:15:44 +0100 Subject: libphobos: Fix segfault at run-time when using custom Fibers (PR 98025) When libphobos is configured with --enable-cet, this adds extra fields to the Fiber class to support the ucontext_t fallback implementation. These fields get omitted when compiling user code unless they also used `-fversion=CET' to build their project, which resulted in data being overwritten from within swapcontext(). On reviewing the ucontext_t definitions, it was found that the shadow stack fields were missing, and the struct size didn't match up on X32. This has been fixed in upstream druntime and merged down here. Reviewed-on: https://github.com/dlang/druntime/pull/3293 libphobos/ChangeLog: PR d/98025 * Makefile.in: Regenerate. * configure: Regenerate. * configure.ac (DCFG_ENABLE_CET): Substitute. * libdruntime/MERGE: Merge upstream druntime 0fe7974c. * libdruntime/Makefile.in: Regenerate. * libdruntime/core/thread.d: Import gcc.config. (class Fiber): Add ucontext_t fields when GNU_Enable_CET is true. * libdruntime/gcc/config.d.in (GNU_Enable_CET): Define. * src/Makefile.in: Regenerate. * testsuite/Makefile.in: Regenerate. --- libphobos/Makefile.in | 1 + libphobos/configure | 16 +++++++++++++--- libphobos/configure.ac | 11 ++++++++--- libphobos/libdruntime/MERGE | 2 +- libphobos/libdruntime/Makefile.in | 1 + libphobos/libdruntime/core/sys/posix/ucontext.d | 6 ++++-- libphobos/libdruntime/core/thread.d | 10 ++++++++++ libphobos/libdruntime/gcc/config.d.in | 3 +++ libphobos/src/Makefile.in | 1 + libphobos/testsuite/Makefile.in | 1 + 10 files changed, 43 insertions(+), 9 deletions(-) (limited to 'libphobos') diff --git a/libphobos/Makefile.in b/libphobos/Makefile.in index f692b2f..a139592 100644 --- a/libphobos/Makefile.in +++ b/libphobos/Makefile.in @@ -217,6 +217,7 @@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DCFG_ARM_EABI_UNWINDER = @DCFG_ARM_EABI_UNWINDER@ DCFG_DLPI_TLS_MODID = @DCFG_DLPI_TLS_MODID@ +DCFG_ENABLE_CET = @DCFG_ENABLE_CET@ DCFG_HAVE_64BIT_ATOMICS = @DCFG_HAVE_64BIT_ATOMICS@ DCFG_HAVE_ATOMIC_BUILTINS = @DCFG_HAVE_ATOMIC_BUILTINS@ DCFG_HAVE_LIBATOMIC = @DCFG_HAVE_LIBATOMIC@ diff --git a/libphobos/configure b/libphobos/configure index 6d8461f..77a3125 100755 --- a/libphobos/configure +++ b/libphobos/configure @@ -722,6 +722,7 @@ LIBTOOL CFLAGS_FOR_BUILD CC_FOR_BUILD AR +DCFG_ENABLE_CET CET_DFLAGS CET_FLAGS RANLIB @@ -5652,11 +5653,20 @@ fi # To ensure that runtime code for CET is compiled in, add in D version flags. -if test "$enable_cet" = yes; then +if test x$enable_cet = xyes; then : + CET_DFLAGS="$CET_FLAGS -fversion=CET" + DCFG_ENABLE_CET=true + +else + + CET_DFLAGS= + DCFG_ENABLE_CET=false fi + + # This should be inherited in the recursive make, but ensure it is defined. test "$AR" || AR=ar @@ -11744,7 +11754,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 11747 "configure" +#line 11757 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -11850,7 +11860,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 11853 "configure" +#line 11863 "configure" #include "confdefs.h" #if HAVE_DLFCN_H diff --git a/libphobos/configure.ac b/libphobos/configure.ac index 60aee3f..2d51e46 100644 --- a/libphobos/configure.ac +++ b/libphobos/configure.ac @@ -69,10 +69,15 @@ AC_PROG_MAKE_SET GCC_CET_FLAGS(CET_FLAGS) AC_SUBST(CET_FLAGS) # To ensure that runtime code for CET is compiled in, add in D version flags. -if test "$enable_cet" = yes; then +AS_IF([test x$enable_cet = xyes], [ CET_DFLAGS="$CET_FLAGS -fversion=CET" - AC_SUBST(CET_DFLAGS) -fi + DCFG_ENABLE_CET=true +], [ + CET_DFLAGS= + DCFG_ENABLE_CET=false +]) +AC_SUBST(CET_DFLAGS) +AC_SUBST(DCFG_ENABLE_CET) # This should be inherited in the recursive make, but ensure it is defined. test "$AR" || AR=ar diff --git a/libphobos/libdruntime/MERGE b/libphobos/libdruntime/MERGE index 6b65a44..7162844 100644 --- a/libphobos/libdruntime/MERGE +++ b/libphobos/libdruntime/MERGE @@ -1,4 +1,4 @@ -d37ef985a97eb446371ab4b2315a52b87233fbf3 +0fe7974cf53b75db59461de2a3d6e53ce933d297 The first line of this file holds the git revision number of the last merge done from the dlang/druntime repository. diff --git a/libphobos/libdruntime/Makefile.in b/libphobos/libdruntime/Makefile.in index 0b89514..99ee8b9 100644 --- a/libphobos/libdruntime/Makefile.in +++ b/libphobos/libdruntime/Makefile.in @@ -577,6 +577,7 @@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DCFG_ARM_EABI_UNWINDER = @DCFG_ARM_EABI_UNWINDER@ DCFG_DLPI_TLS_MODID = @DCFG_DLPI_TLS_MODID@ +DCFG_ENABLE_CET = @DCFG_ENABLE_CET@ DCFG_HAVE_64BIT_ATOMICS = @DCFG_HAVE_64BIT_ATOMICS@ DCFG_HAVE_ATOMIC_BUILTINS = @DCFG_HAVE_ATOMIC_BUILTINS@ DCFG_HAVE_LIBATOMIC = @DCFG_HAVE_LIBATOMIC@ diff --git a/libphobos/libdruntime/core/sys/posix/ucontext.d b/libphobos/libdruntime/core/sys/posix/ucontext.d index 49a7c3e..2e518ae 100644 --- a/libphobos/libdruntime/core/sys/posix/ucontext.d +++ b/libphobos/libdruntime/core/sys/posix/ucontext.d @@ -114,7 +114,7 @@ version (CRuntime_Glibc) enum NGREG = 23; - alias c_long greg_t; + alias long greg_t; alias greg_t[NGREG] gregset_t; alias _libc_fpstate* fpregset_t; } @@ -123,7 +123,7 @@ version (CRuntime_Glibc) { gregset_t gregs; fpregset_t fpregs; - c_ulong[8] __reserved1; + ulong[8] __reserved1; } struct ucontext_t @@ -134,6 +134,7 @@ version (CRuntime_Glibc) mcontext_t uc_mcontext; sigset_t uc_sigmask; _libc_fpstate __fpregs_mem; + ulong[4] __ssp; } } else version (X86) @@ -205,6 +206,7 @@ version (CRuntime_Glibc) mcontext_t uc_mcontext; sigset_t uc_sigmask; _libc_fpstate __fpregs_mem; + c_ulong[4] __ssp; } } else version (HPPA) diff --git a/libphobos/libdruntime/core/thread.d b/libphobos/libdruntime/core/thread.d index eaf088d..7506a8b 100644 --- a/libphobos/libdruntime/core/thread.d +++ b/libphobos/libdruntime/core/thread.d @@ -52,6 +52,7 @@ version (Solaris) version (GNU) { import gcc.builtins; + import gcc.config; version (GNU_StackGrowsDown) version = StackGrowsDown; } @@ -5123,6 +5124,15 @@ private: ucontext_t m_utxt = void; ucontext_t* m_ucur = null; } + else static if (GNU_Enable_CET) + { + // When libphobos was built with --enable-cet, these fields need to + // always be present in the Fiber class layout. + import core.sys.posix.ucontext; + static ucontext_t sm_utxt = void; + ucontext_t m_utxt = void; + ucontext_t* m_ucur = null; + } private: diff --git a/libphobos/libdruntime/gcc/config.d.in b/libphobos/libdruntime/gcc/config.d.in index 6301aaf..9ac7d05 100644 --- a/libphobos/libdruntime/gcc/config.d.in +++ b/libphobos/libdruntime/gcc/config.d.in @@ -49,3 +49,6 @@ enum GNU_Have_LibAtomic = @DCFG_HAVE_LIBATOMIC@; // Do we have qsort_r function enum Have_Qsort_R = @DCFG_HAVE_QSORT_R@; + +// Whether libphobos been configured with --enable-cet. +enum GNU_Enable_CET = @DCFG_ENABLE_CET@; diff --git a/libphobos/src/Makefile.in b/libphobos/src/Makefile.in index 4a0612a..2e72178 100644 --- a/libphobos/src/Makefile.in +++ b/libphobos/src/Makefile.in @@ -333,6 +333,7 @@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DCFG_ARM_EABI_UNWINDER = @DCFG_ARM_EABI_UNWINDER@ DCFG_DLPI_TLS_MODID = @DCFG_DLPI_TLS_MODID@ +DCFG_ENABLE_CET = @DCFG_ENABLE_CET@ DCFG_HAVE_64BIT_ATOMICS = @DCFG_HAVE_64BIT_ATOMICS@ DCFG_HAVE_ATOMIC_BUILTINS = @DCFG_HAVE_ATOMIC_BUILTINS@ DCFG_HAVE_LIBATOMIC = @DCFG_HAVE_LIBATOMIC@ diff --git a/libphobos/testsuite/Makefile.in b/libphobos/testsuite/Makefile.in index 2f6911d..c38a468 100644 --- a/libphobos/testsuite/Makefile.in +++ b/libphobos/testsuite/Makefile.in @@ -161,6 +161,7 @@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DCFG_ARM_EABI_UNWINDER = @DCFG_ARM_EABI_UNWINDER@ DCFG_DLPI_TLS_MODID = @DCFG_DLPI_TLS_MODID@ +DCFG_ENABLE_CET = @DCFG_ENABLE_CET@ DCFG_HAVE_64BIT_ATOMICS = @DCFG_HAVE_64BIT_ATOMICS@ DCFG_HAVE_ATOMIC_BUILTINS = @DCFG_HAVE_ATOMIC_BUILTINS@ DCFG_HAVE_LIBATOMIC = @DCFG_HAVE_LIBATOMIC@ -- cgit v1.1 From e87559d202d90e614315203f38f9aa2f5881d36e Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Sat, 28 Nov 2020 00:16:38 +0000 Subject: Daily bump. --- libphobos/ChangeLog | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) (limited to 'libphobos') diff --git a/libphobos/ChangeLog b/libphobos/ChangeLog index d4c9184..0957b1a 100644 --- a/libphobos/ChangeLog +++ b/libphobos/ChangeLog @@ -1,3 +1,32 @@ +2020-11-27 Iain Buclaw + + PR d/98025 + * Makefile.in: Regenerate. + * configure: Regenerate. + * configure.ac (DCFG_ENABLE_CET): Substitute. + * libdruntime/MERGE: Merge upstream druntime 0fe7974c. + * libdruntime/Makefile.in: Regenerate. + * libdruntime/core/thread.d: Import gcc.config. + (class Fiber): Add ucontext_t fields when GNU_Enable_CET is true. + * libdruntime/gcc/config.d.in (GNU_Enable_CET): Define. + * src/Makefile.in: Regenerate. + * testsuite/Makefile.in: Regenerate. + +2020-11-27 Iain Buclaw + + * libdruntime/MERGE: Merge upstream druntime d37ef985. + * libdruntime/Makefile.am (DRUNTIME_DSOURCES_FREEBSD): Add + core/sys/freebsd/config.d + * libdruntime/Makefile.in: Regenerate. + +2020-11-27 Iain Buclaw + + * src/MERGE: Merge upstream phobos 38873fe6e. + +2020-11-27 Iain Buclaw + + * libdruntime/MERGE: Merge upstream druntime 5e4492c4. + 2020-11-18 Iain Buclaw * configure.tgt: Add *-*-dragonfly* as a supported target. -- cgit v1.1 From e855b30c28391b190eebb8e6afc8d2116a6d85de Mon Sep 17 00:00:00 2001 From: Iain Buclaw Date: Sat, 28 Nov 2020 16:55:53 +0100 Subject: d: Add freebsd support for D compiler and runtime gcc/ChangeLog: PR d/87818 * config.gcc (*-*-freebsd*): Add freebsd-d.o and t-freebsd. * config/freebsd-d.c: New file. * config/t-freebsd: New file. libphobos/ChangeLog: PR d/87818 * configure.tgt: Add x86_64-*-freebsd* and i?86-*-freebsd* as supported targets. --- libphobos/configure.tgt | 3 +++ 1 file changed, 3 insertions(+) (limited to 'libphobos') diff --git a/libphobos/configure.tgt b/libphobos/configure.tgt index 1ea9e0c..7d9c6bc 100644 --- a/libphobos/configure.tgt +++ b/libphobos/configure.tgt @@ -49,6 +49,9 @@ case "${target}" in s390*-linux*) LIBPHOBOS_SUPPORTED=yes ;; + x86_64-*-freebsd* | i?86-*-freebsd*) + LIBPHOBOS_SUPPORTED=yes + ;; x86_64-*-kfreebsd*-gnu | i?86-*-kfreebsd*-gnu) LIBPHOBOS_SUPPORTED=yes ;; -- cgit v1.1 From 94358e4770e6e4c52f101f8f74fdc27187fd0050 Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Tue, 1 Dec 2020 00:16:38 +0000 Subject: Daily bump. --- libphobos/ChangeLog | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'libphobos') diff --git a/libphobos/ChangeLog b/libphobos/ChangeLog index 0957b1a..2596478c 100644 --- a/libphobos/ChangeLog +++ b/libphobos/ChangeLog @@ -1,3 +1,9 @@ +2020-11-30 Iain Buclaw + + PR d/87818 + * configure.tgt: Add x86_64-*-freebsd* and i?86-*-freebsd* as + supported targets. + 2020-11-27 Iain Buclaw PR d/98025 -- cgit v1.1