libphobos: Add --enable-cet to configure

When --enable-cet is used to configure GCC, enable Intel CET in libphobos.

	* 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.
This commit is contained in:
H.J. Lu 2020-05-08 15:11:24 -07:00
parent 74dc179a6d
commit 08c1d39d3a
6 changed files with 114 additions and 12 deletions

View File

@ -1,3 +1,11 @@
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

View File

@ -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)" \

View File

@ -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)" \

View File

@ -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])

91
libphobos/configure vendored
View File

@ -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=no]
--enable-shared[=PKGS] build shared libraries [default=yes]
--enable-static[=PKGS] build static libraries [default=yes]
--enable-fast-install[=PKGS]
@ -5560,6 +5563,90 @@ $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=no
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for CET support" >&5
$as_echo_n "checking for CET support... " >&6; }
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.
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
;;
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 +11734,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 11737 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@ -11753,7 +11840,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 11843 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H

View File

@ -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)