aboutsummaryrefslogtreecommitdiff
path: root/libphobos
diff options
context:
space:
mode:
authorIan Lance Taylor <iant@golang.org>2020-10-12 09:46:38 -0700
committerIan Lance Taylor <iant@golang.org>2020-10-12 09:46:38 -0700
commit9cd320ea6572c577cdf17ce1f9ea5230b166af6d (patch)
treed1c8e7c2e09a91ed75f0e5476c648c2e745aa2de /libphobos
parent4854d721be78358e59367982bdd94461b4be3c5a (diff)
parent3175d40fc52fb8eb3c3b18cc343d773da24434fb (diff)
downloadgcc-9cd320ea6572c577cdf17ce1f9ea5230b166af6d.zip
gcc-9cd320ea6572c577cdf17ce1f9ea5230b166af6d.tar.gz
gcc-9cd320ea6572c577cdf17ce1f9ea5230b166af6d.tar.bz2
Merge from trunk revision 3175d40fc52fb8eb3c3b18cc343d773da24434fb.
Diffstat (limited to 'libphobos')
-rw-r--r--libphobos/ChangeLog42
-rw-r--r--libphobos/Makefile.am10
-rw-r--r--libphobos/Makefile.in13
-rwxr-xr-xlibphobos/configure12
-rw-r--r--libphobos/configure.ac5
-rw-r--r--libphobos/libdruntime/Makefile.am6
-rw-r--r--libphobos/libdruntime/Makefile.in10
-rw-r--r--libphobos/libdruntime/config/x86/switchcontext.S9
-rw-r--r--libphobos/libdruntime/core/thread.d29
-rw-r--r--libphobos/src/Makefile.am5
-rw-r--r--libphobos/src/Makefile.in9
-rw-r--r--libphobos/testsuite/Makefile.in4
-rw-r--r--libphobos/testsuite/lib/libphobos.exp4
-rwxr-xr-xlibphobos/testsuite/testsuite_flags.in2
14 files changed, 126 insertions, 34 deletions
diff --git a/libphobos/ChangeLog b/libphobos/ChangeLog
index fd0db86..d8c9914 100644
--- a/libphobos/ChangeLog
+++ b/libphobos/ChangeLog
@@ -1,3 +1,45 @@
+2020-09-10 Iain Buclaw <ibuclaw@gdcproject.org>
+
+ PR d/95680
+ PR d/97007
+ * Makefile.am (AM_MAKEFLAGS): Remove $(CET_FLAGS).
+ * Makefile.in: Regenerate.
+ * configure: Regenerate.
+ * configure.ac (DCFG_ENABLE_CET): Remove substitution.
+ (CET_DFLAGS): Substitute.
+ * libdruntime/Makefile.am (AM_DFLAGS): Add $(CET_DFLAGS).
+ (AM_CFLAGS): Add $(CET_FLAGS).
+ (AM_CCASFLAGS): Likewise.
+ * libdruntime/Makefile.in: Regenerate.
+ * libdruntime/core/thread.d: Replace static if GNU_Enable_CET
+ condition with `version (CET)'.
+ * libdruntime/gcc/config.d.in (GNU_Enable_CET): Remove.
+ * src/Makefile.am (AM_DFLAGS): Add $(CET_DFLAGS).
+ (AM_CFLAGS): Add $(CET_FLAGS).
+ * src/Makefile.in: Regenerate.
+ * testsuite/Makefile.in: Regenerate.
+ * testsuite/testsuite_flags.in: Add $(CET_DFLAGS) to --gdcflags.
+
+2020-09-09 H.J. Lu <hjl.tools@gmail.com>
+
+ PR d/95680
+ * libdruntime/config/x86/switchcontext.S: Include <cet.h> to
+ generate the CET marker for -fcf-protection.
+
+2020-09-08 Iain Buclaw <ibuclaw@gdcproject.org>
+
+ PR d/95680
+ * Makefile.in: Regenerate.
+ * configure: Regenerate.
+ * configure.ac (DCFG_ENABLE_CET): Substitute.
+ * libdruntime/Makefile.in: Regenerate.
+ * libdruntime/config/x86/switchcontext.S: Remove CET support code.
+ * libdruntime/core/thread.d: Import gcc.config. Don't set version
+ AsmExternal when GNU_Enable_CET is true.
+ * libdruntime/gcc/config.d.in (GNU_Enable_CET): Define.
+ * src/Makefile.in: Regenerate.
+ * testsuite/Makefile.in: Regenerate.
+
2020-06-25 Iain Buclaw <ibuclaw@gdcproject.org>
* libdruntime/MERGE: Merge upstream druntime d05ebaad.
diff --git a/libphobos/Makefile.am b/libphobos/Makefile.am
index 84d8001..874b3a2 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) $(CET_FLAGS)" \
- "CFLAGS=$(CFLAGS) $(CET_FLAGS)" \
- "CXXFLAGS=$(CXXFLAGS) $(CET_FLAGS)" \
+ "CCASFLAGS=$(CCASFLAGS)" \
+ "CFLAGS=$(CFLAGS)" \
+ "CXXFLAGS=$(CXXFLAGS)" \
"CFLAGS_FOR_BUILD=$(CFLAGS_FOR_BUILD)" \
- "CFLAGS_FOR_TARGET=$(CFLAGS_FOR_TARGET) $(CET_FLAGS)" \
+ "CFLAGS_FOR_TARGET=$(CFLAGS_FOR_TARGET)" \
"GDC_FOR_TARGET=$(GDC_FOR_TARGET)" \
"GDC=$(GDC)" \
- "GDCFLAGS=$(GDCFLAGS) $(CET_FLAGS)" \
+ "GDCFLAGS=$(GDCFLAGS)" \
"INSTALL=$(INSTALL)" \
"INSTALL_DATA=$(INSTALL_DATA)" \
"INSTALL_PROGRAM=$(INSTALL_PROGRAM)" \
diff --git a/libphobos/Makefile.in b/libphobos/Makefile.in
index 4806f69..f692b2f 100644
--- a/libphobos/Makefile.in
+++ b/libphobos/Makefile.in
@@ -108,6 +108,8 @@ target_triplet = @target@
subdir = .
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/../config/acx.m4 \
+ $(top_srcdir)/../config/cet.m4 \
+ $(top_srcdir)/../config/enable.m4 \
$(top_srcdir)/../config/lead-dot.m4 \
$(top_srcdir)/../config/multi.m4 \
$(top_srcdir)/../config/override.m4 \
@@ -205,6 +207,7 @@ CC = @CC@
CCAS = @CCAS@
CCASFLAGS = @CCASFLAGS@
CC_FOR_BUILD = @CC_FOR_BUILD@
+CET_DFLAGS = @CET_DFLAGS@
CET_FLAGS = @CET_FLAGS@
CFLAGS = @CFLAGS@
CFLAGS_FOR_BUILD = @CFLAGS_FOR_BUILD@
@@ -352,14 +355,14 @@ AM_MAKEFLAGS = \
"AR_FLAGS=$(AR_FLAGS)" \
"CC_FOR_BUILD=$(CC_FOR_BUILD)" \
"CC_FOR_TARGET=$(CC_FOR_TARGET)" \
- "CCASFLAGS=$(CCASFLAGS) $(CET_FLAGS)" \
- "CFLAGS=$(CFLAGS) $(CET_FLAGS)" \
- "CXXFLAGS=$(CXXFLAGS) $(CET_FLAGS)" \
+ "CCASFLAGS=$(CCASFLAGS)" \
+ "CFLAGS=$(CFLAGS)" \
+ "CXXFLAGS=$(CXXFLAGS)" \
"CFLAGS_FOR_BUILD=$(CFLAGS_FOR_BUILD)" \
- "CFLAGS_FOR_TARGET=$(CFLAGS_FOR_TARGET) $(CET_FLAGS)" \
+ "CFLAGS_FOR_TARGET=$(CFLAGS_FOR_TARGET)" \
"GDC_FOR_TARGET=$(GDC_FOR_TARGET)" \
"GDC=$(GDC)" \
- "GDCFLAGS=$(GDCFLAGS) $(CET_FLAGS)" \
+ "GDCFLAGS=$(GDCFLAGS)" \
"INSTALL=$(INSTALL)" \
"INSTALL_DATA=$(INSTALL_DATA)" \
"INSTALL_PROGRAM=$(INSTALL_PROGRAM)" \
diff --git a/libphobos/configure b/libphobos/configure
index a8d151c..4c1116d 100755
--- a/libphobos/configure
+++ b/libphobos/configure
@@ -722,6 +722,7 @@ LIBTOOL
CFLAGS_FOR_BUILD
CC_FOR_BUILD
AR
+CET_DFLAGS
CET_FLAGS
RANLIB
MAINT
@@ -5586,7 +5587,7 @@ case "$host" in
case "$enable_cet" in
auto)
# Check if target supports multi-byte NOPs
- # and if assembler supports CET insn.
+ # and if compiler and assembler support CET insn.
cet_save_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS -fcf-protection"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
@@ -5650,6 +5651,11 @@ $as_echo "no" >&6; }
fi
+# To ensure that runtime code for CET is compiled in, add in D version flags.
+if test "$enable_cet" = yes; then
+ CET_DFLAGS="$CET_FLAGS -fversion=CET"
+
+fi
# This should be inherited in the recursive make, but ensure it is defined.
test "$AR" || AR=ar
@@ -11738,7 +11744,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 11741 "configure"
+#line 11747 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -11844,7 +11850,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 11847 "configure"
+#line 11853 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
diff --git a/libphobos/configure.ac b/libphobos/configure.ac
index ec8a30e..bf21128 100644
--- a/libphobos/configure.ac
+++ b/libphobos/configure.ac
@@ -68,6 +68,11 @@ AC_PROG_MAKE_SET
# Add CET specific flags if CET is enabled
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
+ CET_DFLAGS="$CET_FLAGS -fversion=CET"
+ AC_SUBST(CET_DFLAGS)
+fi
# This should be inherited in the recursive make, but ensure it is defined.
test "$AR" || AR=ar
diff --git a/libphobos/libdruntime/Makefile.am b/libphobos/libdruntime/Makefile.am
index 1d340a0..4136642 100644
--- a/libphobos/libdruntime/Makefile.am
+++ b/libphobos/libdruntime/Makefile.am
@@ -24,7 +24,11 @@ D_EXTRA_DFLAGS=-nostdinc -I $(srcdir) -I .
# D flags for compilation
AM_DFLAGS= \
$(phobos_compiler_pic_flag) \
- $(WARN_DFLAGS) $(CHECKING_DFLAGS)
+ $(WARN_DFLAGS) $(CHECKING_DFLAGS) $(CET_DFLAGS)
+
+# Flags for other kinds of sources
+AM_CFLAGS=$(CET_FLAGS)
+AM_CCASFLAGS=$(CET_FLAGS)
# Install all D and DI files
ALL_DRUNTIME_INSTALL_DSOURCES = $(DRUNTIME_DSOURCES) \
diff --git a/libphobos/libdruntime/Makefile.in b/libphobos/libdruntime/Makefile.in
index 3fddbc3..d0bb324 100644
--- a/libphobos/libdruntime/Makefile.in
+++ b/libphobos/libdruntime/Makefile.in
@@ -131,6 +131,8 @@ target_triplet = @target@
subdir = libdruntime
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/../config/acx.m4 \
+ $(top_srcdir)/../config/cet.m4 \
+ $(top_srcdir)/../config/enable.m4 \
$(top_srcdir)/../config/lead-dot.m4 \
$(top_srcdir)/../config/multi.m4 \
$(top_srcdir)/../config/override.m4 \
@@ -565,6 +567,8 @@ CC = @CC@
CCAS = @CCAS@
CCASFLAGS = @CCASFLAGS@
CC_FOR_BUILD = @CC_FOR_BUILD@
+CET_DFLAGS = @CET_DFLAGS@
+CET_FLAGS = @CET_FLAGS@
CFLAGS = @CFLAGS@
CFLAGS_FOR_BUILD = @CFLAGS_FOR_BUILD@
CHECKING_DFLAGS = @CHECKING_DFLAGS@
@@ -715,9 +719,13 @@ D_EXTRA_DFLAGS = -nostdinc -I $(srcdir) -I .
# D flags for compilation
AM_DFLAGS = \
$(phobos_compiler_pic_flag) \
- $(WARN_DFLAGS) $(CHECKING_DFLAGS)
+ $(WARN_DFLAGS) $(CHECKING_DFLAGS) $(CET_DFLAGS)
+# Flags for other kinds of sources
+AM_CFLAGS = $(CET_FLAGS)
+AM_CCASFLAGS = $(CET_FLAGS)
+
# Install all D and DI files
ALL_DRUNTIME_INSTALL_DSOURCES = $(DRUNTIME_DSOURCES) \
$(DRUNTIME_DSOURCES_BIONIC) $(DRUNTIME_DSOURCES_DARWIN) \
diff --git a/libphobos/libdruntime/config/x86/switchcontext.S b/libphobos/libdruntime/config/x86/switchcontext.S
index 35063af..f2f8efa 100644
--- a/libphobos/libdruntime/config/x86/switchcontext.S
+++ b/libphobos/libdruntime/config/x86/switchcontext.S
@@ -24,13 +24,12 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
#include "../common/threadasm.S"
+/* NB: Generate the CET marker for -fcf-protection. */
#ifdef __CET__
# include <cet.h>
-#else
-# define _CET_ENDBR
#endif
-#if defined(__i386__)
+#if defined(__i386__) && !defined(__CET__)
.text
.globl CSYM(fiber_switchContext)
@@ -38,7 +37,6 @@ 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
@@ -65,7 +63,7 @@ CSYM(fiber_switchContext):
.cfi_endproc
.size CSYM(fiber_switchContext),.-CSYM(fiber_switchContext)
-#elif defined(__x86_64__) && !defined(__ILP32__)
+#elif defined(__x86_64__) && !defined(__ILP32__) && !defined(__CET__)
.text
.globl CSYM(fiber_switchContext)
@@ -73,7 +71,6 @@ 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/thread.d b/libphobos/libdruntime/core/thread.d
index e1a6805..eaf088d 100644
--- a/libphobos/libdruntime/core/thread.d
+++ b/libphobos/libdruntime/core/thread.d
@@ -3586,30 +3586,39 @@ private
}
else version (X86)
{
- version = AsmExternal;
+ version = AlignFiberStackTo16Byte;
- version (MinGW)
+ version (CET)
{
- version = GNU_AsmX86_Windows;
- version = AlignFiberStackTo16Byte;
+ // fiber_switchContext does not support shadow stack from
+ // Intel CET. So use ucontext implementation.
}
- else version (Posix)
+ else
{
- version = AsmX86_Posix;
- version (OSX)
- version = AlignFiberStackTo16Byte;
+ version = AsmExternal;
+
+ version (MinGW)
+ version = GNU_AsmX86_Windows;
+ else version (Posix)
+ version = AsmX86_Posix;
}
}
else version (X86_64)
{
- version (D_X32)
+ version = AlignFiberStackTo16Byte;
+
+ version (CET)
+ {
+ // fiber_switchContext does not support shadow stack from
+ // Intel CET. So use ucontext implementation.
+ }
+ else version (D_X32)
{
// let X32 be handled by ucontext swapcontext
}
else
{
version = AsmExternal;
- version = AlignFiberStackTo16Byte;
version (MinGW)
version = GNU_AsmX86_64_Windows;
diff --git a/libphobos/src/Makefile.am b/libphobos/src/Makefile.am
index 9fb416e..3769d8e 100644
--- a/libphobos/src/Makefile.am
+++ b/libphobos/src/Makefile.am
@@ -25,7 +25,10 @@ D_EXTRA_DFLAGS=-nostdinc -I $(srcdir) \
# D flags for compilation
AM_DFLAGS= \
$(phobos_compiler_pic_flag) \
- $(WARN_DFLAGS) $(CHECKING_DFLAGS)
+ $(WARN_DFLAGS) $(CHECKING_DFLAGS) $(CET_DFLAGS)
+
+# Flags for other kinds of sources
+AM_CFLAGS=$(CET_FLAGS)
# Install all D files
ALL_PHOBOS_INSTALL_DSOURCES = $(PHOBOS_DSOURCES)
diff --git a/libphobos/src/Makefile.in b/libphobos/src/Makefile.in
index 4b1ae86..4a0612a 100644
--- a/libphobos/src/Makefile.in
+++ b/libphobos/src/Makefile.in
@@ -93,6 +93,8 @@ target_triplet = @target@
subdir = src
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/../config/acx.m4 \
+ $(top_srcdir)/../config/cet.m4 \
+ $(top_srcdir)/../config/enable.m4 \
$(top_srcdir)/../config/lead-dot.m4 \
$(top_srcdir)/../config/multi.m4 \
$(top_srcdir)/../config/override.m4 \
@@ -321,6 +323,8 @@ CC = @CC@
CCAS = @CCAS@
CCASFLAGS = @CCASFLAGS@
CC_FOR_BUILD = @CC_FOR_BUILD@
+CET_DFLAGS = @CET_DFLAGS@
+CET_FLAGS = @CET_FLAGS@
CFLAGS = @CFLAGS@
CFLAGS_FOR_BUILD = @CFLAGS_FOR_BUILD@
CHECKING_DFLAGS = @CHECKING_DFLAGS@
@@ -473,9 +477,12 @@ D_EXTRA_DFLAGS = -nostdinc -I $(srcdir) \
# D flags for compilation
AM_DFLAGS = \
$(phobos_compiler_pic_flag) \
- $(WARN_DFLAGS) $(CHECKING_DFLAGS)
+ $(WARN_DFLAGS) $(CHECKING_DFLAGS) $(CET_DFLAGS)
+# Flags for other kinds of sources
+AM_CFLAGS = $(CET_FLAGS)
+
# Install all D files
ALL_PHOBOS_INSTALL_DSOURCES = $(PHOBOS_DSOURCES)
diff --git a/libphobos/testsuite/Makefile.in b/libphobos/testsuite/Makefile.in
index 66077fc..2f6911d 100644
--- a/libphobos/testsuite/Makefile.in
+++ b/libphobos/testsuite/Makefile.in
@@ -93,6 +93,8 @@ target_triplet = @target@
subdir = testsuite
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/../config/acx.m4 \
+ $(top_srcdir)/../config/cet.m4 \
+ $(top_srcdir)/../config/enable.m4 \
$(top_srcdir)/../config/lead-dot.m4 \
$(top_srcdir)/../config/multi.m4 \
$(top_srcdir)/../config/override.m4 \
@@ -149,6 +151,8 @@ CC = @CC@
CCAS = @CCAS@
CCASFLAGS = @CCASFLAGS@
CC_FOR_BUILD = @CC_FOR_BUILD@
+CET_DFLAGS = @CET_DFLAGS@
+CET_FLAGS = @CET_FLAGS@
CFLAGS = @CFLAGS@
CFLAGS_FOR_BUILD = @CFLAGS_FOR_BUILD@
CHECKING_DFLAGS = @CHECKING_DFLAGS@
diff --git a/libphobos/testsuite/lib/libphobos.exp b/libphobos/testsuite/lib/libphobos.exp
index 2e9da95..790480b 100644
--- a/libphobos/testsuite/lib/libphobos.exp
+++ b/libphobos/testsuite/lib/libphobos.exp
@@ -105,6 +105,7 @@ proc libphobos_init { args } {
global gdcpaths gdcldflags
global gluefile wrap_flags
global ld_library_path
+ global tool_timeout
global DEFAULT_DFLAGS
# If a testcase doesn't have special options, use these.
@@ -185,6 +186,9 @@ proc libphobos_init { args } {
}
}
+ # Set the default timeout for phobos tests.
+ set tool_timeout 600
+
set_ld_library_path_env_vars
libphobos_maybe_build_wrapper "${objdir}/testglue.o"
diff --git a/libphobos/testsuite/testsuite_flags.in b/libphobos/testsuite/testsuite_flags.in
index 14b6795..6a2d79f 100755
--- a/libphobos/testsuite/testsuite_flags.in
+++ b/libphobos/testsuite/testsuite_flags.in
@@ -28,7 +28,7 @@ case ${query} in
;;
--gdcflags)
GDCFLAGS_default="-fmessage-length=0 -fno-show-column"
- GDCFLAGS_config="@WARN_DFLAGS@ @GDCFLAGS@ -fno-release -funittest"
+ GDCFLAGS_config="@WARN_DFLAGS@ @GDCFLAGS@ @CET_DFLAGS@ -fno-release -funittest"
echo ${GDCFLAGS_default} ${GDCFLAGS_config}
;;
--gdcpaths)