Enable building libssp with Intel CET

libssp/
	* 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.

From-SVN: r254898
This commit is contained in:
Igor Tsimbalist 2017-11-17 23:32:46 +01:00 committed by Igor Tsimbalist
parent 8e2fc0551b
commit ff035ef673
6 changed files with 100 additions and 6 deletions

View File

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

View File

@ -34,6 +34,7 @@ version_dep =
endif
AM_CFLAGS = -Wall
AM_CFLAGS += $(XCFLAGS)
toolexeclib_LTLIBRARIES = libssp.la libssp_nonshared.la
@ -53,7 +54,7 @@ libssp_la_LDFLAGS = -version-info `grep -v '^\#' $(srcdir)/libtool-version` \
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

View File

@ -69,7 +69,9 @@ am__aclocal_m4_deps = $(top_srcdir)/../config/acx.m4 \
$(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 \
@ -210,6 +212,7 @@ SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
STRIP = @STRIP@
VERSION = @VERSION@
XCFLAGS = @XCFLAGS@
abs_builddir = @abs_builddir@
abs_srcdir = @abs_srcdir@
abs_top_builddir = @abs_top_builddir@
@ -286,7 +289,7 @@ gcc_version := $(shell @get_gcc_base_ver@ $(top_srcdir)/../gcc/BASE-VER)
@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
@ -304,7 +307,7 @@ libssp_la_LDFLAGS = -version-info `grep -v '^\#' $(srcdir)/libtool-version` \
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

2
libssp/aclocal.m4 vendored
View File

@ -1000,3 +1000,5 @@ m4_include([../ltoptions.m4])
m4_include([../ltsugar.m4])
m4_include([../ltversion.m4])
m4_include([../lt~obsolete.m4])
m4_include([../config/enable.m4])
m4_include([../config/cet.m4])

78
libssp/configure vendored
View File

@ -633,6 +633,7 @@ LIBSSP_USE_SYMVER_GNU_FALSE
LIBSSP_USE_SYMVER_GNU_TRUE
LIBSSP_USE_SYMVER_FALSE
LIBSSP_USE_SYMVER_TRUE
XCFLAGS
CPP
am__fastdepCC_FALSE
am__fastdepCC_TRUE
@ -736,6 +737,7 @@ enable_version_specific_runtime_libs
enable_maintainer_mode
enable_multilib
enable_dependency_tracking
enable_cet
enable_symvers
enable_shared
enable_static
@ -1376,6 +1378,8 @@ Optional Features:
--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]
@ -4077,6 +4081,76 @@ fi
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
@ -10671,7 +10745,7 @@ else
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
@ -10777,7 +10851,7 @@ else
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

View File

@ -62,6 +62,11 @@ void __attribute__((noinline)) bar (char *x)
[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) {}],,