+2017-11-17 Igor Tsimbalist <igor.v.tsimbalist@intel.com>
+
+ * Makefile.am: Update AM_CFLAGS, update
+ libssp_nonshared_la_CFLAGS.
+ * Makefile.in: Regenerate.
+ * configure: Likewise.
+ * aclocal.m4: Likewise.
+ * configure.ac: Set CET_FLAGS. Update XCFLAGS.
+
2017-04-01 Jonathan Yong <10walls@gmail.com>
* ssp.c (__guard_setup): Suppress unused variable warning.
endif
AM_CFLAGS = -Wall
+AM_CFLAGS += $(XCFLAGS)
toolexeclib_LTLIBRARIES = libssp.la libssp_nonshared.la
libssp_nonshared_la_SOURCES = \
ssp-local.c
-libssp_nonshared_la_CFLAGS = -prefer-pic
+libssp_nonshared_la_CFLAGS = -prefer-pic $(XCFLAGS)
libssp_nonshared_la_LIBADD =
libssp_nonshared_la_DEPENDENCIES = $(libssp_nonshared_la_LIBADD)
libssp_nonshared_la_LDFLAGS = -static
$(top_srcdir)/../config/override.m4 \
$(top_srcdir)/../libtool.m4 $(top_srcdir)/../ltoptions.m4 \
$(top_srcdir)/../ltsugar.m4 $(top_srcdir)/../ltversion.m4 \
- $(top_srcdir)/../lt~obsolete.m4 $(top_srcdir)/configure.ac
+ $(top_srcdir)/../lt~obsolete.m4 \
+ $(top_srcdir)/../config/enable.m4 \
+ $(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 \
SHELL = @SHELL@
STRIP = @STRIP@
VERSION = @VERSION@
+XCFLAGS = @XCFLAGS@
abs_builddir = @abs_builddir@
abs_srcdir = @abs_srcdir@
abs_top_builddir = @abs_top_builddir@
@LIBSSP_USE_SYMVER_FALSE@version_dep =
@LIBSSP_USE_SYMVER_GNU_TRUE@@LIBSSP_USE_SYMVER_TRUE@version_dep = $(srcdir)/ssp.map
@LIBSSP_USE_SYMVER_SUN_TRUE@@LIBSSP_USE_SYMVER_TRUE@version_dep = ssp.map-sun
-AM_CFLAGS = -Wall
+AM_CFLAGS = -Wall $(XCFLAGS)
toolexeclib_LTLIBRARIES = libssp.la libssp_nonshared.la
libsubincludedir = $(libdir)/gcc/$(target_noncanonical)/$(gcc_version)/include
nobase_libsubinclude_HEADERS = ssp/ssp.h ssp/string.h ssp/stdio.h ssp/unistd.h
libssp_nonshared_la_SOURCES = \
ssp-local.c
-libssp_nonshared_la_CFLAGS = -prefer-pic
+libssp_nonshared_la_CFLAGS = -prefer-pic $(XCFLAGS)
libssp_nonshared_la_LIBADD =
libssp_nonshared_la_DEPENDENCIES = $(libssp_nonshared_la_LIBADD)
libssp_nonshared_la_LDFLAGS = -static
m4_include([../ltsugar.m4])
m4_include([../ltversion.m4])
m4_include([../lt~obsolete.m4])
+m4_include([../config/enable.m4])
+m4_include([../config/cet.m4])
LIBSSP_USE_SYMVER_GNU_TRUE
LIBSSP_USE_SYMVER_FALSE
LIBSSP_USE_SYMVER_TRUE
+XCFLAGS
CPP
am__fastdepCC_FALSE
am__fastdepCC_TRUE
enable_maintainer_mode
enable_multilib
enable_dependency_tracking
+enable_cet
enable_symvers
enable_shared
enable_static
--enable-multilib build many library versions (default)
--disable-dependency-tracking speeds up one-time build
--enable-dependency-tracking do not reject slow dependency extractors
+ --enable-cet enable Intel CET in target libraries
+ [default=default]
--disable-symvers disable symbol versioning for libssp
--enable-shared[=PKGS] build shared libraries [default=yes]
--enable-static[=PKGS] build static libraries [default=yes]
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
CFLAGS="$save_CFLAGS"
+# 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|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
+
+XCFLAGS="$XCFLAGS $CET_FLAGS"
+
+
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether hidden visibility is supported" >&5
$as_echo_n "checking whether hidden visibility is supported... " >&6; }
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 10674 "configure"
+#line 10748 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 10780 "configure"
+#line 10854 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
[AC_MSG_RESULT(no)])
CFLAGS="$save_CFLAGS"
+# Add CET specific flags if CET is enabled
+GCC_CET_FLAGS(CET_FLAGS)
+XCFLAGS="$XCFLAGS $CET_FLAGS"
+AC_SUBST(XCFLAGS)
+
AC_MSG_CHECKING([whether hidden visibility is supported])
AC_TRY_COMPILE([
void __attribute__((visibility ("hidden"))) bar (void) {}],,