Skip to content

Commit

Permalink
Enable building libstdc++-v3 with Intel CET
Browse files Browse the repository at this point in the history
libstdc++-v3/
	* acinclude.m4: Add cet.m4.
	* configure.ac: Set CET_FLAGS. Update EXTRA_CFLAGS,
	EXTRA_CXX_FLAGS.
	* libsupc++/Makefile.am: Use Add EXTRA_CFLAGS.
	* Makefile.in: Regenerate.
	* configure: Likewise.
	* doc/Makefile.in: Likewise.
	* include/Makefile.in: Likewise.
	* libsupc++/Makefile.in: Likewise.
	* po/Makefile.in: Likewise.
	* python/Makefile.in: Likewise.
	* src/Makefile.in: Likewise.
	* src/c++11/Makefile.in: Likewise.
	* src/c++98/Makefile.in: Likewise.
	* src/filesystem/Makefile.in: Likewise.
	* testsuite/Makefile.in: Likewise.

From-SVN: r254895
  • Loading branch information
itsimbal authored and Igor Tsimbalist committed Nov 17, 2017
1 parent efe33ce commit 36101de
Show file tree
Hide file tree
Showing 16 changed files with 138 additions and 24 deletions.
19 changes: 19 additions & 0 deletions libstdc++-v3/ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,22 @@
2017-11-17 Igor Tsimbalist <[email protected]>

* acinclude.m4: Add cet.m4.
* configure.ac: Set CET_FLAGS. Update EXTRA_CFLAGS,
EXTRA_CXX_FLAGS.
* libsupc++/Makefile.am: Use Add EXTRA_CFLAGS.
* Makefile.in: Regenerate.
* configure: Likewise.
* doc/Makefile.in: Likewise.
* include/Makefile.in: Likewise.
* libsupc++/Makefile.in: Likewise.
* po/Makefile.in: Likewise.
* python/Makefile.in: Likewise.
* src/Makefile.in: Likewise.
* src/c++11/Makefile.in: Likewise.
* src/c++98/Makefile.in: Likewise.
* src/filesystem/Makefile.in: Likewise.
* testsuite/Makefile.in: Likewise.

2017-11-17 Jonathan Wakely <[email protected]>

PR libstdc++/83025
Expand Down
3 changes: 2 additions & 1 deletion libstdc++-v3/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ am__aclocal_m4_deps = $(top_srcdir)/../config/acx.m4 \
$(top_srcdir)/linkage.m4 $(top_srcdir)/acinclude.m4 \
$(top_srcdir)/../config/gc++filt.m4 \
$(top_srcdir)/../config/tls.m4 $(top_srcdir)/../config/gthr.m4 \
$(top_srcdir)/configure.ac
$(top_srcdir)/../config/cet.m4 $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \
Expand Down Expand Up @@ -173,6 +173,7 @@ ECHO_T = @ECHO_T@
EGREP = @EGREP@
ERROR_CONSTANTS_SRCDIR = @ERROR_CONSTANTS_SRCDIR@
EXEEXT = @EXEEXT@
EXTRA_CFLAGS = @EXTRA_CFLAGS@
EXTRA_CXX_FLAGS = @EXTRA_CXX_FLAGS@
FGREP = @FGREP@
GLIBCXX_INCLUDES = @GLIBCXX_INCLUDES@
Expand Down
1 change: 1 addition & 0 deletions libstdc++-v3/acinclude.m4
Original file line number Diff line number Diff line change
Expand Up @@ -4519,3 +4519,4 @@ AC_DEFUN([GLIBCXX_CHECK_EXCEPTION_PTR_SYMVER], [
m4_include([../config/gc++filt.m4])
m4_include([../config/tls.m4])
m4_include([../config/gthr.m4])
m4_include([../config/cet.m4])
94 changes: 85 additions & 9 deletions libstdc++-v3/configure
Original file line number Diff line number Diff line change
Expand Up @@ -611,6 +611,7 @@ glibcxx_toolexeclibdir
glibcxx_toolexecdir
gxx_include_dir
glibcxx_prefixdir
EXTRA_CFLAGS
CPU_OPT_BITS_RANDOM
CPU_OPT_EXT_RANDOM
ERROR_CONSTANTS_SRCDIR
Expand Down Expand Up @@ -896,6 +897,7 @@ enable_libstdcxx_dual_abi
with_default_libstdcxx_abi
enable_libstdcxx_threads
enable_libstdcxx_filesystem_ts
enable_cet
with_gxx_include_dir
enable_version_specific_runtime_libs
with_gcc_major_version_only
Expand Down Expand Up @@ -1594,6 +1596,8 @@ Optional Features:
enable C++11 threads support [default=auto]
--enable-libstdcxx-filesystem-ts
turns on ISO/IEC TS 18822 support [default=auto]
--enable-cet enable Intel CET in target libraries
[default=default]
--enable-version-specific-runtime-libs
Specify that runtime libraries should be installed
in a compiler-specific directory
Expand Down Expand Up @@ -11601,7 +11605,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
#line 11604 "configure"
#line 11608 "configure"
#include "confdefs.h"

#if HAVE_DLFCN_H
Expand Down Expand Up @@ -11707,7 +11711,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
#line 11710 "configure"
#line 11714 "configure"
#include "confdefs.h"

#if HAVE_DLFCN_H
Expand Down Expand Up @@ -15393,7 +15397,7 @@ $as_echo "$glibcxx_cv_atomic_long_long" >&6; }
# Fake what AC_TRY_COMPILE does.

cat > conftest.$ac_ext << EOF
#line 15396 "configure"
#line 15400 "configure"
int main()
{
typedef bool atomic_type;
Expand Down Expand Up @@ -15428,7 +15432,7 @@ $as_echo "$glibcxx_cv_atomic_bool" >&6; }
rm -f conftest*

cat > conftest.$ac_ext << EOF
#line 15431 "configure"
#line 15435 "configure"
int main()
{
typedef short atomic_type;
Expand Down Expand Up @@ -15463,7 +15467,7 @@ $as_echo "$glibcxx_cv_atomic_short" >&6; }
rm -f conftest*

cat > conftest.$ac_ext << EOF
#line 15466 "configure"
#line 15470 "configure"
int main()
{
// NB: _Atomic_word not necessarily int.
Expand Down Expand Up @@ -15499,7 +15503,7 @@ $as_echo "$glibcxx_cv_atomic_int" >&6; }
rm -f conftest*

cat > conftest.$ac_ext << EOF
#line 15502 "configure"
#line 15506 "configure"
int main()
{
typedef long long atomic_type;
Expand Down Expand Up @@ -15580,7 +15584,7 @@ $as_echo "$as_me: WARNING: Performance of certain classes will degrade as a resu
# unnecessary for this test.

cat > conftest.$ac_ext << EOF
#line 15583 "configure"
#line 15587 "configure"
int main()
{
_Decimal32 d1;
Expand Down Expand Up @@ -15622,7 +15626,7 @@ ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
# unnecessary for this test.

cat > conftest.$ac_ext << EOF
#line 15625 "configure"
#line 15629 "configure"
template<typename T1, typename T2>
struct same
{ typedef T2 type; };
Expand Down Expand Up @@ -15656,7 +15660,7 @@ $as_echo "$enable_int128" >&6; }
rm -f conftest*

cat > conftest.$ac_ext << EOF
#line 15659 "configure"
#line 15663 "configure"
template<typename T1, typename T2>
struct same
{ typedef T2 type; };
Expand Down Expand Up @@ -81077,6 +81081,78 @@ CPU_OPT_BITS_RANDOM=config/${cpu_opt_bits_random}



# Add CET specific flags if Intel CET is enabled.
# Check whether --enable-cet was given.
if test "${enable_cet+set}" = set; then :
enableval=$enable_cet;
case "$enableval" in
yes|no|default) ;;
*) as_fn_error "Unknown argument to enable/disable cet" "$LINENO" 5 ;;
esac

else
enable_cet=default
fi


case "$host" in
i[34567]86-*-linux* | x86_64-*-linux*)
case "$enable_cet" in
default)
# 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 :
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 -mcet"
fi

EXTRA_CXX_FLAGS="$EXTRA_CXX_FLAGS $CET_FLAGS"
EXTRA_CFLAGS="$EXTRA_CFLAGS $CET_FLAGS"



# Determine cross-compile flags and AM_CONDITIONALs.
#AC_SUBST(GLIBCXX_IS_NATIVE)
#AM_CONDITIONAL(CANADIAN, test $CANADIAN = yes)
Expand Down
7 changes: 7 additions & 0 deletions libstdc++-v3/configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -489,6 +489,13 @@ AC_SUBST(CPU_OPT_EXT_RANDOM)
AC_SUBST(CPU_OPT_BITS_RANDOM)


# Add CET specific flags if Intel CET is enabled.
GCC_CET_FLAGS(CET_FLAGS)
EXTRA_CXX_FLAGS="$EXTRA_CXX_FLAGS $CET_FLAGS"
EXTRA_CFLAGS="$EXTRA_CFLAGS $CET_FLAGS"
AC_SUBST(EXTRA_CFLAGS)
AC_SUBST(EXTRA_CXX_FLAGS)

# Determine cross-compile flags and AM_CONDITIONALs.
#AC_SUBST(GLIBCXX_IS_NATIVE)
#AM_CONDITIONAL(CANADIAN, test $CANADIAN = yes)
Expand Down
3 changes: 2 additions & 1 deletion libstdc++-v3/doc/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ am__aclocal_m4_deps = $(top_srcdir)/../config/acx.m4 \
$(top_srcdir)/linkage.m4 $(top_srcdir)/acinclude.m4 \
$(top_srcdir)/../config/gc++filt.m4 \
$(top_srcdir)/../config/tls.m4 $(top_srcdir)/../config/gthr.m4 \
$(top_srcdir)/configure.ac
$(top_srcdir)/../config/cet.m4 $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
CONFIG_HEADER = $(top_builddir)/config.h
Expand Down Expand Up @@ -145,6 +145,7 @@ ECHO_T = @ECHO_T@
EGREP = @EGREP@
ERROR_CONSTANTS_SRCDIR = @ERROR_CONSTANTS_SRCDIR@
EXEEXT = @EXEEXT@
EXTRA_CFLAGS = @EXTRA_CFLAGS@
EXTRA_CXX_FLAGS = @EXTRA_CXX_FLAGS@
FGREP = @FGREP@
GLIBCXX_INCLUDES = @GLIBCXX_INCLUDES@
Expand Down
3 changes: 2 additions & 1 deletion libstdc++-v3/include/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ am__aclocal_m4_deps = $(top_srcdir)/../config/acx.m4 \
$(top_srcdir)/linkage.m4 $(top_srcdir)/acinclude.m4 \
$(top_srcdir)/../config/gc++filt.m4 \
$(top_srcdir)/../config/tls.m4 $(top_srcdir)/../config/gthr.m4 \
$(top_srcdir)/configure.ac
$(top_srcdir)/../config/cet.m4 $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
CONFIG_HEADER = $(top_builddir)/config.h
Expand Down Expand Up @@ -145,6 +145,7 @@ ECHO_T = @ECHO_T@
EGREP = @EGREP@
ERROR_CONSTANTS_SRCDIR = @ERROR_CONSTANTS_SRCDIR@
EXEEXT = @EXEEXT@
EXTRA_CFLAGS = @EXTRA_CFLAGS@
EXTRA_CXX_FLAGS = @EXTRA_CXX_FLAGS@
FGREP = @FGREP@
GLIBCXX_INCLUDES = @GLIBCXX_INCLUDES@
Expand Down
4 changes: 2 additions & 2 deletions libstdc++-v3/libsupc++/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -170,13 +170,13 @@ AM_MAKEFLAGS = \
C_INCLUDES = -I.. -I$(toplevel_srcdir)/libiberty -I$(toplevel_srcdir)/include
C_COMPILE = \
$(CC) $(DEFS) $(C_INCLUDES) \
$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) $(EXTRA_CFLAGS)

# LTCOMPILE is copied from LTCXXCOMPILE below.
LTCOMPILE = $(LIBTOOL) --tag CC --tag disable-shared $(LIBTOOLFLAGS) --mode=compile \
$(CC) $(DEFS) $(C_INCLUDES) \
$(glibcxx_lt_pic_flag) $(glibcxx_compiler_shared_flag) \
$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) $(EXTRA_CFLAGS)

# Libtool notes

Expand Down
7 changes: 4 additions & 3 deletions libstdc++-v3/libsupc++/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ am__aclocal_m4_deps = $(top_srcdir)/../config/acx.m4 \
$(top_srcdir)/linkage.m4 $(top_srcdir)/acinclude.m4 \
$(top_srcdir)/../config/gc++filt.m4 \
$(top_srcdir)/../config/tls.m4 $(top_srcdir)/../config/gthr.m4 \
$(top_srcdir)/configure.ac
$(top_srcdir)/../config/cet.m4 $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
CONFIG_HEADER = $(top_builddir)/config.h
Expand Down Expand Up @@ -218,6 +218,7 @@ ECHO_T = @ECHO_T@
EGREP = @EGREP@
ERROR_CONSTANTS_SRCDIR = @ERROR_CONSTANTS_SRCDIR@
EXEEXT = @EXEEXT@
EXTRA_CFLAGS = @EXTRA_CFLAGS@
EXTRA_CXX_FLAGS = @EXTRA_CXX_FLAGS@
FGREP = @FGREP@
GLIBCXX_INCLUDES = @GLIBCXX_INCLUDES@
Expand Down Expand Up @@ -497,14 +498,14 @@ AM_MAKEFLAGS = \
C_INCLUDES = -I.. -I$(toplevel_srcdir)/libiberty -I$(toplevel_srcdir)/include
C_COMPILE = \
$(CC) $(DEFS) $(C_INCLUDES) \
$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) $(EXTRA_CFLAGS)


# LTCOMPILE is copied from LTCXXCOMPILE below.
LTCOMPILE = $(LIBTOOL) --tag CC --tag disable-shared $(LIBTOOLFLAGS) --mode=compile \
$(CC) $(DEFS) $(C_INCLUDES) \
$(glibcxx_lt_pic_flag) $(glibcxx_compiler_shared_flag) \
$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) $(EXTRA_CFLAGS)


# Libtool notes
Expand Down
3 changes: 2 additions & 1 deletion libstdc++-v3/po/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ am__aclocal_m4_deps = $(top_srcdir)/../config/acx.m4 \
$(top_srcdir)/linkage.m4 $(top_srcdir)/acinclude.m4 \
$(top_srcdir)/../config/gc++filt.m4 \
$(top_srcdir)/../config/tls.m4 $(top_srcdir)/../config/gthr.m4 \
$(top_srcdir)/configure.ac
$(top_srcdir)/../config/cet.m4 $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
CONFIG_HEADER = $(top_builddir)/config.h
Expand Down Expand Up @@ -145,6 +145,7 @@ ECHO_T = @ECHO_T@
EGREP = @EGREP@
ERROR_CONSTANTS_SRCDIR = @ERROR_CONSTANTS_SRCDIR@
EXEEXT = @EXEEXT@
EXTRA_CFLAGS = @EXTRA_CFLAGS@
EXTRA_CXX_FLAGS = @EXTRA_CXX_FLAGS@
FGREP = @FGREP@
GLIBCXX_INCLUDES = @GLIBCXX_INCLUDES@
Expand Down
3 changes: 2 additions & 1 deletion libstdc++-v3/python/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ am__aclocal_m4_deps = $(top_srcdir)/../config/acx.m4 \
$(top_srcdir)/linkage.m4 $(top_srcdir)/acinclude.m4 \
$(top_srcdir)/../config/gc++filt.m4 \
$(top_srcdir)/../config/tls.m4 $(top_srcdir)/../config/gthr.m4 \
$(top_srcdir)/configure.ac
$(top_srcdir)/../config/cet.m4 $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
CONFIG_HEADER = $(top_builddir)/config.h
Expand Down Expand Up @@ -175,6 +175,7 @@ ECHO_T = @ECHO_T@
EGREP = @EGREP@
ERROR_CONSTANTS_SRCDIR = @ERROR_CONSTANTS_SRCDIR@
EXEEXT = @EXEEXT@
EXTRA_CFLAGS = @EXTRA_CFLAGS@
EXTRA_CXX_FLAGS = @EXTRA_CXX_FLAGS@
FGREP = @FGREP@
GLIBCXX_INCLUDES = @GLIBCXX_INCLUDES@
Expand Down
3 changes: 2 additions & 1 deletion libstdc++-v3/src/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ am__aclocal_m4_deps = $(top_srcdir)/../config/acx.m4 \
$(top_srcdir)/linkage.m4 $(top_srcdir)/acinclude.m4 \
$(top_srcdir)/../config/gc++filt.m4 \
$(top_srcdir)/../config/tls.m4 $(top_srcdir)/../config/gthr.m4 \
$(top_srcdir)/configure.ac
$(top_srcdir)/../config/cet.m4 $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
CONFIG_HEADER = $(top_builddir)/config.h
Expand Down Expand Up @@ -208,6 +208,7 @@ ECHO_T = @ECHO_T@
EGREP = @EGREP@
ERROR_CONSTANTS_SRCDIR = @ERROR_CONSTANTS_SRCDIR@
EXEEXT = @EXEEXT@
EXTRA_CFLAGS = @EXTRA_CFLAGS@
EXTRA_CXX_FLAGS = @EXTRA_CXX_FLAGS@
FGREP = @FGREP@
GLIBCXX_INCLUDES = @GLIBCXX_INCLUDES@
Expand Down
3 changes: 2 additions & 1 deletion libstdc++-v3/src/c++11/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ am__aclocal_m4_deps = $(top_srcdir)/../config/acx.m4 \
$(top_srcdir)/linkage.m4 $(top_srcdir)/acinclude.m4 \
$(top_srcdir)/../config/gc++filt.m4 \
$(top_srcdir)/../config/tls.m4 $(top_srcdir)/../config/gthr.m4 \
$(top_srcdir)/configure.ac
$(top_srcdir)/../config/cet.m4 $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
CONFIG_HEADER = $(top_builddir)/config.h
Expand Down Expand Up @@ -183,6 +183,7 @@ ECHO_T = @ECHO_T@
EGREP = @EGREP@
ERROR_CONSTANTS_SRCDIR = @ERROR_CONSTANTS_SRCDIR@
EXEEXT = @EXEEXT@
EXTRA_CFLAGS = @EXTRA_CFLAGS@
EXTRA_CXX_FLAGS = @EXTRA_CXX_FLAGS@
FGREP = @FGREP@
GLIBCXX_INCLUDES = @GLIBCXX_INCLUDES@
Expand Down
Loading

0 comments on commit 36101de

Please sign in to comment.