aboutsummaryrefslogtreecommitdiff
path: root/libphobos
diff options
context:
space:
mode:
Diffstat (limited to 'libphobos')
-rw-r--r--libphobos/ChangeLog31
-rw-r--r--libphobos/Makefile.am10
-rw-r--r--libphobos/Makefile.in11
-rw-r--r--libphobos/aclocal.m42
-rwxr-xr-xlibphobos/configure95
-rw-r--r--libphobos/configure.ac4
-rw-r--r--libphobos/libdruntime/MERGE2
-rw-r--r--libphobos/libdruntime/config/x86/switchcontext.S8
-rw-r--r--libphobos/libdruntime/core/cpuid.d18
-rw-r--r--libphobos/libdruntime/rt/util/utf.d4
-rw-r--r--libphobos/src/MERGE2
-rw-r--r--libphobos/src/std/net/curl.d44
-rw-r--r--libphobos/src/std/range/package.d2
-rw-r--r--libphobos/src/std/zip.d6
-rw-r--r--libphobos/testsuite/libphobos.typeinfo/struct-align.d2
15 files changed, 209 insertions, 32 deletions
diff --git a/libphobos/ChangeLog b/libphobos/ChangeLog
index 1ba5370..fd0db86 100644
--- a/libphobos/ChangeLog
+++ b/libphobos/ChangeLog
@@ -1,3 +1,34 @@
+2020-06-25 Iain Buclaw <ibuclaw@gdcproject.org>
+
+ * libdruntime/MERGE: Merge upstream druntime d05ebaad.
+ * src/MERGE: Merge upstream phobos 021ae0df7.
+ * testsuite/libphobos.typeinfo/struct-align.d: Remove empty statement.
+
+2020-05-29 H.J. Lu <hjl.tools@gmail.com>
+
+ PR bootstrap/95413
+ * configure: Regenerated.
+
+2020-05-15 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR bootstrap/95147
+ * configure: Regenerated.
+
+2020-05-08 H.J. Lu <hongjiu.lu@intel.com>
+
+ * libdruntime/config/x86/switchcontext.S: Include <cet.h> if
+ __CET__ is defined.
+ (_CET_ENDBR): New. Define if __CET__ is not defined.
+ (fiber_switchContext): Add _CET_ENDBR after .cfi_startproc.
+
+2020-05-08 H.J. Lu <hongjiu.lu@intel.com>
+
+ * Makefile.am (AM_MAKEFLAGS): Add $(CET_FLAGS) to GCC FLAGS.
+ * configure.ac (CET_FLAGS): Add GCC_CET_FLAGS and AC_SUBST.
+ * Makefile.in: Regenerated.
+ * aclocal.m4: Likewise.
+ * configure.ac: Likewise.
+
2020-04-30 Iain Buclaw <ibuclaw@gdcproject.org>
* libdruntime/Makefile.am (DRUNTIME_SOURCES_CONFIGURED): Remove
diff --git a/libphobos/Makefile.am b/libphobos/Makefile.am
index 874b3a2..84d8001 100644
--- a/libphobos/Makefile.am
+++ b/libphobos/Makefile.am
@@ -33,14 +33,14 @@ AM_MAKEFLAGS = \
"AR_FLAGS=$(AR_FLAGS)" \
"CC_FOR_BUILD=$(CC_FOR_BUILD)" \
"CC_FOR_TARGET=$(CC_FOR_TARGET)" \
- "CCASFLAGS=$(CCASFLAGS)" \
- "CFLAGS=$(CFLAGS)" \
- "CXXFLAGS=$(CXXFLAGS)" \
+ "CCASFLAGS=$(CCASFLAGS) $(CET_FLAGS)" \
+ "CFLAGS=$(CFLAGS) $(CET_FLAGS)" \
+ "CXXFLAGS=$(CXXFLAGS) $(CET_FLAGS)" \
"CFLAGS_FOR_BUILD=$(CFLAGS_FOR_BUILD)" \
- "CFLAGS_FOR_TARGET=$(CFLAGS_FOR_TARGET)" \
+ "CFLAGS_FOR_TARGET=$(CFLAGS_FOR_TARGET) $(CET_FLAGS)" \
"GDC_FOR_TARGET=$(GDC_FOR_TARGET)" \
"GDC=$(GDC)" \
- "GDCFLAGS=$(GDCFLAGS)" \
+ "GDCFLAGS=$(GDCFLAGS) $(CET_FLAGS)" \
"INSTALL=$(INSTALL)" \
"INSTALL_DATA=$(INSTALL_DATA)" \
"INSTALL_PROGRAM=$(INSTALL_PROGRAM)" \
diff --git a/libphobos/Makefile.in b/libphobos/Makefile.in
index e51c215..4806f69 100644
--- a/libphobos/Makefile.in
+++ b/libphobos/Makefile.in
@@ -205,6 +205,7 @@ CC = @CC@
CCAS = @CCAS@
CCASFLAGS = @CCASFLAGS@
CC_FOR_BUILD = @CC_FOR_BUILD@
+CET_FLAGS = @CET_FLAGS@
CFLAGS = @CFLAGS@
CFLAGS_FOR_BUILD = @CFLAGS_FOR_BUILD@
CHECKING_DFLAGS = @CHECKING_DFLAGS@
@@ -351,14 +352,14 @@ AM_MAKEFLAGS = \
"AR_FLAGS=$(AR_FLAGS)" \
"CC_FOR_BUILD=$(CC_FOR_BUILD)" \
"CC_FOR_TARGET=$(CC_FOR_TARGET)" \
- "CCASFLAGS=$(CCASFLAGS)" \
- "CFLAGS=$(CFLAGS)" \
- "CXXFLAGS=$(CXXFLAGS)" \
+ "CCASFLAGS=$(CCASFLAGS) $(CET_FLAGS)" \
+ "CFLAGS=$(CFLAGS) $(CET_FLAGS)" \
+ "CXXFLAGS=$(CXXFLAGS) $(CET_FLAGS)" \
"CFLAGS_FOR_BUILD=$(CFLAGS_FOR_BUILD)" \
- "CFLAGS_FOR_TARGET=$(CFLAGS_FOR_TARGET)" \
+ "CFLAGS_FOR_TARGET=$(CFLAGS_FOR_TARGET) $(CET_FLAGS)" \
"GDC_FOR_TARGET=$(GDC_FOR_TARGET)" \
"GDC=$(GDC)" \
- "GDCFLAGS=$(GDCFLAGS)" \
+ "GDCFLAGS=$(GDCFLAGS) $(CET_FLAGS)" \
"INSTALL=$(INSTALL)" \
"INSTALL_DATA=$(INSTALL_DATA)" \
"INSTALL_PROGRAM=$(INSTALL_PROGRAM)" \
diff --git a/libphobos/aclocal.m4 b/libphobos/aclocal.m4
index 899592d..b2e1cbf 100644
--- a/libphobos/aclocal.m4
+++ b/libphobos/aclocal.m4
@@ -873,6 +873,8 @@ AC_SUBST([am__untar])
]) # _AM_PROG_TAR
m4_include([../config/acx.m4])
+m4_include([../config/cet.m4])
+m4_include([../config/enable.m4])
m4_include([../config/lead-dot.m4])
m4_include([../config/multi.m4])
m4_include([../config/override.m4])
diff --git a/libphobos/configure b/libphobos/configure
index e461c74..a8d151c 100755
--- a/libphobos/configure
+++ b/libphobos/configure
@@ -722,6 +722,7 @@ LIBTOOL
CFLAGS_FOR_BUILD
CC_FOR_BUILD
AR
+CET_FLAGS
RANLIB
MAINT
MAINTAINER_MODE_FALSE
@@ -824,6 +825,7 @@ enable_option_checking
enable_multilib
enable_silent_rules
enable_maintainer_mode
+enable_cet
enable_shared
enable_static
with_pic
@@ -1476,6 +1478,7 @@ Optional Features:
--enable-maintainer-mode
enable make rules and dependencies not useful (and
sometimes confusing) to the casual installer
+ --enable-cet enable Intel CET in target libraries [default=auto]
--enable-shared[=PKGS] build shared libraries [default=yes]
--enable-static[=PKGS] build static libraries [default=yes]
--enable-fast-install[=PKGS]
@@ -5560,6 +5563,94 @@ $as_echo "no" >&6; }
fi
+# Add CET specific flags if CET is enabled
+ # Check whether --enable-cet was given.
+if test "${enable_cet+set}" = set; then :
+ enableval=$enable_cet;
+ case "$enableval" in
+ yes|no|auto) ;;
+ *) as_fn_error $? "Unknown argument to enable/disable cet" "$LINENO" 5 ;;
+ esac
+
+else
+ enable_cet=auto
+fi
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for CET support" >&5
+$as_echo_n "checking for CET support... " >&6; }
+
+# NB: Avoid nested save_CFLAGS and save_LDFLAGS.
+case "$host" in
+ i[34567]86-*-linux* | x86_64-*-linux*)
+ case "$enable_cet" in
+ auto)
+ # Check if target supports multi-byte NOPs
+ # and if assembler supports CET insn.
+ cet_save_CFLAGS="$CFLAGS"
+ CFLAGS="$CFLAGS -fcf-protection"
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+#if !defined(__SSE2__)
+#error target does not support multi-byte NOPs
+#else
+asm ("setssbsy");
+#endif
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ enable_cet=yes
+else
+ enable_cet=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ CFLAGS="$cet_save_CFLAGS"
+ ;;
+ yes)
+ # Check if assembler supports CET.
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+int
+main ()
+{
+asm ("setssbsy");
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+
+else
+ as_fn_error $? "assembler with CET support is required for --enable-cet" "$LINENO" 5
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ ;;
+ esac
+ ;;
+ *)
+ enable_cet=no
+ ;;
+esac
+if test x$enable_cet = xyes; then
+ CET_FLAGS="-fcf-protection -mshstk"
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+
# This should be inherited in the recursive make, but ensure it is defined.
test "$AR" || AR=ar
@@ -11647,7 +11738,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 11650 "configure"
+#line 11741 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -11753,7 +11844,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 11756 "configure"
+#line 11847 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
diff --git a/libphobos/configure.ac b/libphobos/configure.ac
index c21da59..ec8a30e 100644
--- a/libphobos/configure.ac
+++ b/libphobos/configure.ac
@@ -65,6 +65,10 @@ AC_PROG_RANLIB
AC_PROG_INSTALL
AC_PROG_MAKE_SET
+# Add CET specific flags if CET is enabled
+GCC_CET_FLAGS(CET_FLAGS)
+AC_SUBST(CET_FLAGS)
+
# This should be inherited in the recursive make, but ensure it is defined.
test "$AR" || AR=ar
AC_SUBST(AR)
diff --git a/libphobos/libdruntime/MERGE b/libphobos/libdruntime/MERGE
index c61ad7c..bcde105 100644
--- a/libphobos/libdruntime/MERGE
+++ b/libphobos/libdruntime/MERGE
@@ -1,4 +1,4 @@
-7bdd83d7b4bd9fd4cb9ffca0d50babc90b31bfd6
+d05ebaad15fbffce6d707c138c84d7b60fcf5ffd
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/config/x86/switchcontext.S b/libphobos/libdruntime/config/x86/switchcontext.S
index f5d1a87..35063af 100644
--- a/libphobos/libdruntime/config/x86/switchcontext.S
+++ b/libphobos/libdruntime/config/x86/switchcontext.S
@@ -24,6 +24,12 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
#include "../common/threadasm.S"
+#ifdef __CET__
+# include <cet.h>
+#else
+# define _CET_ENDBR
+#endif
+
#if defined(__i386__)
.text
@@ -32,6 +38,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
.align 16
CSYM(fiber_switchContext):
.cfi_startproc
+ _CET_ENDBR
// save current stack state
push %ebp
mov %esp, %ebp
@@ -66,6 +73,7 @@ CSYM(fiber_switchContext):
.align 16
CSYM(fiber_switchContext):
.cfi_startproc
+ _CET_ENDBR
// Save current stack state.save current stack state
push %rbp
mov %rsp, %rbp
diff --git a/libphobos/libdruntime/core/cpuid.d b/libphobos/libdruntime/core/cpuid.d
index 839605a..2ba13b5 100644
--- a/libphobos/libdruntime/core/cpuid.d
+++ b/libphobos/libdruntime/core/cpuid.d
@@ -941,13 +941,27 @@ void cpuidX86()
datacache[0].lineSize = 32;
}
}
- if (max_cpuid >= 0x0B) {
+ if (cf.probablyIntel && max_cpuid >= 0x0B) {
// For Intel i7 and later, use function 0x0B to determine
// cores and hyperthreads.
getCpuInfo0B();
} else {
if (hyperThreadingBit) cf.maxThreads = (apic>>>16) & 0xFF;
else cf.maxThreads = cf.maxCores;
+
+ if (cf.probablyAMD && max_extended_cpuid >= 0x8000_001E) {
+ version (GNU) asm pure nothrow @nogc {
+ "cpuid" : "=a" (a), "=b" (b) : "a" (0x8000_001E) : "ecx", "edx";
+ } else {
+ asm pure nothrow @nogc {
+ mov EAX, 0x8000_001e;
+ cpuid;
+ mov b, EBX;
+ }
+ }
+ ubyte coresPerComputeUnit = ((b >> 8) & 3) + 1;
+ cf.maxCores = cf.maxThreads / coresPerComputeUnit;
+ }
}
}
@@ -975,7 +989,7 @@ bool hasCPUID()
xor {(%%esp), %%eax|eax, [esp]}
# eax = whichever bits were changed
popf{l|d} # Restore original EFLAGS
- " : "=a" flags;
+ " : "=a" (flags);
}
}
else version (D_InlineAsm_X86)
diff --git a/libphobos/libdruntime/rt/util/utf.d b/libphobos/libdruntime/rt/util/utf.d
index 0775840..55869b3 100644
--- a/libphobos/libdruntime/rt/util/utf.d
+++ b/libphobos/libdruntime/rt/util/utf.d
@@ -651,9 +651,9 @@ string toUTF8(in wchar[] s)
else
{
r.length = i;
- foreach (dchar c; s[i .. slen])
+ foreach (dchar ch; s[i .. slen])
{
- encode(r, c);
+ encode(r, ch);
}
break;
}
diff --git a/libphobos/src/MERGE b/libphobos/src/MERGE
index 6025cdc..1562f74 100644
--- a/libphobos/src/MERGE
+++ b/libphobos/src/MERGE
@@ -1,4 +1,4 @@
-bf0d0a37c4c2d8762ceff7d8677e7584b770800f
+021ae0df76727a32809a29887095ab7093489ea3
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/net/curl.d b/libphobos/src/std/net/curl.d
index 32ba45c..445f996 100644
--- a/libphobos/src/std/net/curl.d
+++ b/libphobos/src/std/net/curl.d
@@ -2451,7 +2451,6 @@ struct HTTP
in char[] value) callback)
{
import std.algorithm.searching : startsWith;
- import std.conv : to;
import std.regex : regex, match;
import std.uni : toLower;
@@ -2471,18 +2470,8 @@ struct HTTP
if (header.startsWith("HTTP/"))
{
headersIn.clear();
-
- const m = match(header, regex(r"^HTTP/(\d+)\.(\d+) (\d+) (.*)$"));
- if (m.empty)
+ if (parseStatusLine(header, status))
{
- // Invalid status line
- }
- else
- {
- status.majorVersion = to!ushort(m.captures[1]);
- status.minorVersion = to!ushort(m.captures[2]);
- status.code = to!ushort(m.captures[3]);
- status.reason = m.captures[4].idup;
if (onReceiveStatusLine != null)
onReceiveStatusLine(status);
}
@@ -2517,6 +2506,37 @@ struct HTTP
private RefCounted!Impl p;
+ /// Parse status line, as received from / generated by cURL.
+ private static bool parseStatusLine(in char[] header, out StatusLine status) @safe
+ {
+ import std.conv : to;
+ import std.regex : regex, match;
+
+ const m = match(header, regex(r"^HTTP/(\d+)(?:\.(\d+))? (\d+)(?: (.*))?$"));
+ if (m.empty)
+ return false; // Invalid status line
+ else
+ {
+ status.majorVersion = to!ushort(m.captures[1]);
+ status.minorVersion = m.captures[2].length ? to!ushort(m.captures[2]) : 0;
+ status.code = to!ushort(m.captures[3]);
+ status.reason = m.captures[4].idup;
+ return true;
+ }
+ }
+
+ @safe unittest
+ {
+ StatusLine status;
+ assert(parseStatusLine("HTTP/1.1 200 OK", status)
+ && status == StatusLine(1, 1, 200, "OK"));
+ assert(parseStatusLine("HTTP/1.0 304 Not Modified", status)
+ && status == StatusLine(1, 0, 304, "Not Modified"));
+ // The HTTP2 protocol is binary; cURL generates this fake text header.
+ assert(parseStatusLine("HTTP/2 200", status)
+ && status == StatusLine(2, 0, 200, null));
+ }
+
/** Time condition enumeration as an alias of $(REF CurlTimeCond, etc,c,curl)
$(HTTP www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.25, _RFC2616 Section 14.25)
diff --git a/libphobos/src/std/range/package.d b/libphobos/src/std/range/package.d
index fe581f3..13601cb 100644
--- a/libphobos/src/std/range/package.d
+++ b/libphobos/src/std/range/package.d
@@ -4874,7 +4874,7 @@ if (allSatisfy!(isInputRange, Ranges))
// Just make sure 1-range case instantiates. This hangs the compiler
// when no explicit stopping policy is specified due to Bug 4652.
auto stuff = lockstep([1,2,3,4,5], StoppingPolicy.shortest);
- foreach (int i, a; stuff)
+ foreach (i, a; stuff)
{
assert(stuff[i] == a);
}
diff --git a/libphobos/src/std/zip.d b/libphobos/src/std/zip.d
index db47dde..8b130ea 100644
--- a/libphobos/src/std/zip.d
+++ b/libphobos/src/std/zip.d
@@ -970,6 +970,12 @@ version (Posix) @system unittest
{
import std.datetime, std.file, std.format, std.path, std.process, std.stdio;
+ if (executeShell("unzip").status != 0)
+ {
+ writeln("Can't run unzip, skipping unzip test");
+ return;
+ }
+
auto zr = new ZipArchive();
auto am = new ArchiveMember();
am.compressionMethod = CompressionMethod.deflate;
diff --git a/libphobos/testsuite/libphobos.typeinfo/struct-align.d b/libphobos/testsuite/libphobos.typeinfo/struct-align.d
index 7286651..54eaaa6 100644
--- a/libphobos/testsuite/libphobos.typeinfo/struct-align.d
+++ b/libphobos/testsuite/libphobos.typeinfo/struct-align.d
@@ -2,7 +2,7 @@ module structalign;
void main ()
{
- struct K { int *a; };
+ struct K { int *a; }
K k;
auto ti = typeid (k);