summaryrefslogtreecommitdiffstats
path: root/libssp
diff options
context:
space:
mode:
authorIgor Tsimbalist <igor.v.tsimbalist@intel.com>2017-11-17 23:32:46 +0100
committerIgor Tsimbalist <itsimbal@gcc.gnu.org>2017-11-17 23:32:46 +0100
commitff035ef67334c4a5011d2f28a8b1c5813c1da9d5 (patch)
treed27c32575d5c526f1257183c9e0f5c7621c6717d /libssp
parentEnable building libvtv with Intel CET (diff)
downloadgcc-ff035ef67334c4a5011d2f28a8b1c5813c1da9d5.tar.gz
gcc-ff035ef67334c4a5011d2f28a8b1c5813c1da9d5.tar.bz2
gcc-ff035ef67334c4a5011d2f28a8b1c5813c1da9d5.tar.xz
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
Diffstat (limited to 'libssp')
-rw-r--r--libssp/ChangeLog9
-rw-r--r--libssp/Makefile.am3
-rw-r--r--libssp/Makefile.in9
-rw-r--r--libssp/aclocal.m42
-rwxr-xr-xlibssp/configure78
-rw-r--r--libssp/configure.ac5
6 files changed, 100 insertions, 6 deletions
diff --git a/libssp/ChangeLog b/libssp/ChangeLog
index 65733b08ac6..17df1ee2ff1 100644
--- a/libssp/ChangeLog
+++ b/libssp/ChangeLog
@@ -1,3 +1,12 @@
12017-11-17 Igor Tsimbalist <igor.v.tsimbalist@intel.com>
2
3 * Makefile.am: Update AM_CFLAGS, update
4 libssp_nonshared_la_CFLAGS.
5 * Makefile.in: Regenerate.
6 * configure: Likewise.
7 * aclocal.m4: Likewise.
8 * configure.ac: Set CET_FLAGS. Update XCFLAGS.
9
12017-04-01 Jonathan Yong <10walls@gmail.com> 102017-04-01 Jonathan Yong <10walls@gmail.com>
2 11
3 * ssp.c (__guard_setup): Suppress unused variable warning. 12 * ssp.c (__guard_setup): Suppress unused variable warning.
diff --git a/libssp/Makefile.am b/libssp/Makefile.am
index 72df8e79129..9134f96383e 100644
--- a/libssp/Makefile.am
+++ b/libssp/Makefile.am
@@ -34,6 +34,7 @@ version_dep =
34endif 34endif
35 35
36AM_CFLAGS = -Wall 36AM_CFLAGS = -Wall
37AM_CFLAGS += $(XCFLAGS)
37 38
38toolexeclib_LTLIBRARIES = libssp.la libssp_nonshared.la 39toolexeclib_LTLIBRARIES = libssp.la libssp_nonshared.la
39 40
@@ -53,7 +54,7 @@ libssp_la_LDFLAGS = -version-info `grep -v '^\#' $(srcdir)/libtool-version` \
53 54
54libssp_nonshared_la_SOURCES = \ 55libssp_nonshared_la_SOURCES = \
55 ssp-local.c 56 ssp-local.c
56libssp_nonshared_la_CFLAGS = -prefer-pic 57libssp_nonshared_la_CFLAGS = -prefer-pic $(XCFLAGS)
57libssp_nonshared_la_LIBADD = 58libssp_nonshared_la_LIBADD =
58libssp_nonshared_la_DEPENDENCIES = $(libssp_nonshared_la_LIBADD) 59libssp_nonshared_la_DEPENDENCIES = $(libssp_nonshared_la_LIBADD)
59libssp_nonshared_la_LDFLAGS = -static 60libssp_nonshared_la_LDFLAGS = -static
diff --git a/libssp/Makefile.in b/libssp/Makefile.in
index 96b03ae1248..e2a75400894 100644
--- a/libssp/Makefile.in
+++ b/libssp/Makefile.in
@@ -69,7 +69,9 @@ am__aclocal_m4_deps = $(top_srcdir)/../config/acx.m4 \
69 $(top_srcdir)/../config/override.m4 \ 69 $(top_srcdir)/../config/override.m4 \
70 $(top_srcdir)/../libtool.m4 $(top_srcdir)/../ltoptions.m4 \ 70 $(top_srcdir)/../libtool.m4 $(top_srcdir)/../ltoptions.m4 \
71 $(top_srcdir)/../ltsugar.m4 $(top_srcdir)/../ltversion.m4 \ 71 $(top_srcdir)/../ltsugar.m4 $(top_srcdir)/../ltversion.m4 \
72 $(top_srcdir)/../lt~obsolete.m4 $(top_srcdir)/configure.ac 72 $(top_srcdir)/../lt~obsolete.m4 \
73 $(top_srcdir)/../config/enable.m4 \
74 $(top_srcdir)/../config/cet.m4 $(top_srcdir)/configure.ac
73am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ 75am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
74 $(ACLOCAL_M4) 76 $(ACLOCAL_M4)
75am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \ 77am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \
@@ -210,6 +212,7 @@ SET_MAKE = @SET_MAKE@
210SHELL = @SHELL@ 212SHELL = @SHELL@
211STRIP = @STRIP@ 213STRIP = @STRIP@
212VERSION = @VERSION@ 214VERSION = @VERSION@
215XCFLAGS = @XCFLAGS@
213abs_builddir = @abs_builddir@ 216abs_builddir = @abs_builddir@
214abs_srcdir = @abs_srcdir@ 217abs_srcdir = @abs_srcdir@
215abs_top_builddir = @abs_top_builddir@ 218abs_top_builddir = @abs_top_builddir@
@@ -286,7 +289,7 @@ gcc_version := $(shell @get_gcc_base_ver@ $(top_srcdir)/../gcc/BASE-VER)
286@LIBSSP_USE_SYMVER_FALSE@version_dep = 289@LIBSSP_USE_SYMVER_FALSE@version_dep =
287@LIBSSP_USE_SYMVER_GNU_TRUE@@LIBSSP_USE_SYMVER_TRUE@version_dep = $(srcdir)/ssp.map 290@LIBSSP_USE_SYMVER_GNU_TRUE@@LIBSSP_USE_SYMVER_TRUE@version_dep = $(srcdir)/ssp.map
288@LIBSSP_USE_SYMVER_SUN_TRUE@@LIBSSP_USE_SYMVER_TRUE@version_dep = ssp.map-sun 291@LIBSSP_USE_SYMVER_SUN_TRUE@@LIBSSP_USE_SYMVER_TRUE@version_dep = ssp.map-sun
289AM_CFLAGS = -Wall 292AM_CFLAGS = -Wall $(XCFLAGS)
290toolexeclib_LTLIBRARIES = libssp.la libssp_nonshared.la 293toolexeclib_LTLIBRARIES = libssp.la libssp_nonshared.la
291libsubincludedir = $(libdir)/gcc/$(target_noncanonical)/$(gcc_version)/include 294libsubincludedir = $(libdir)/gcc/$(target_noncanonical)/$(gcc_version)/include
292nobase_libsubinclude_HEADERS = ssp/ssp.h ssp/string.h ssp/stdio.h ssp/unistd.h 295nobase_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` \
304libssp_nonshared_la_SOURCES = \ 307libssp_nonshared_la_SOURCES = \
305 ssp-local.c 308 ssp-local.c
306 309
307libssp_nonshared_la_CFLAGS = -prefer-pic 310libssp_nonshared_la_CFLAGS = -prefer-pic $(XCFLAGS)
308libssp_nonshared_la_LIBADD = 311libssp_nonshared_la_LIBADD =
309libssp_nonshared_la_DEPENDENCIES = $(libssp_nonshared_la_LIBADD) 312libssp_nonshared_la_DEPENDENCIES = $(libssp_nonshared_la_LIBADD)
310libssp_nonshared_la_LDFLAGS = -static 313libssp_nonshared_la_LDFLAGS = -static
diff --git a/libssp/aclocal.m4 b/libssp/aclocal.m4
index 927988e5814..7eeae0cf2a9 100644
--- a/libssp/aclocal.m4
+++ b/libssp/aclocal.m4
@@ -1000,3 +1000,5 @@ m4_include([../ltoptions.m4])
1000m4_include([../ltsugar.m4]) 1000m4_include([../ltsugar.m4])
1001m4_include([../ltversion.m4]) 1001m4_include([../ltversion.m4])
1002m4_include([../lt~obsolete.m4]) 1002m4_include([../lt~obsolete.m4])
1003m4_include([../config/enable.m4])
1004m4_include([../config/cet.m4])
diff --git a/libssp/configure b/libssp/configure
index b14e922e6f1..a96b39197ff 100755
--- a/libssp/configure
+++ b/libssp/configure
@@ -633,6 +633,7 @@ LIBSSP_USE_SYMVER_GNU_FALSE
633LIBSSP_USE_SYMVER_GNU_TRUE 633LIBSSP_USE_SYMVER_GNU_TRUE
634LIBSSP_USE_SYMVER_FALSE 634LIBSSP_USE_SYMVER_FALSE
635LIBSSP_USE_SYMVER_TRUE 635LIBSSP_USE_SYMVER_TRUE
636XCFLAGS
636CPP 637CPP
637am__fastdepCC_FALSE 638am__fastdepCC_FALSE
638am__fastdepCC_TRUE 639am__fastdepCC_TRUE
@@ -736,6 +737,7 @@ enable_version_specific_runtime_libs
736enable_maintainer_mode 737enable_maintainer_mode
737enable_multilib 738enable_multilib
738enable_dependency_tracking 739enable_dependency_tracking
740enable_cet
739enable_symvers 741enable_symvers
740enable_shared 742enable_shared
741enable_static 743enable_static
@@ -1376,6 +1378,8 @@ Optional Features:
1376 --enable-multilib build many library versions (default) 1378 --enable-multilib build many library versions (default)
1377 --disable-dependency-tracking speeds up one-time build 1379 --disable-dependency-tracking speeds up one-time build
1378 --enable-dependency-tracking do not reject slow dependency extractors 1380 --enable-dependency-tracking do not reject slow dependency extractors
1381 --enable-cet enable Intel CET in target libraries
1382 [default=default]
1379 --disable-symvers disable symbol versioning for libssp 1383 --disable-symvers disable symbol versioning for libssp
1380 --enable-shared[=PKGS] build shared libraries [default=yes] 1384 --enable-shared[=PKGS] build shared libraries [default=yes]
1381 --enable-static[=PKGS] build static libraries [default=yes] 1385 --enable-static[=PKGS] build static libraries [default=yes]
@@ -4077,6 +4081,76 @@ fi
4077rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext 4081rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
4078CFLAGS="$save_CFLAGS" 4082CFLAGS="$save_CFLAGS"
4079 4083
4084# Add CET specific flags if CET is enabled
4085 # Check whether --enable-cet was given.
4086if test "${enable_cet+set}" = set; then :
4087 enableval=$enable_cet;
4088 case "$enableval" in
4089 yes|no|default) ;;
4090 *) as_fn_error "Unknown argument to enable/disable cet" "$LINENO" 5 ;;
4091 esac
4092
4093else
4094 enable_cet=default
4095fi
4096
4097
4098case "$host" in
4099 i[34567]86-*-linux* | x86_64-*-linux*)
4100 case "$enable_cet" in
4101 default)
4102 # Check if assembler supports CET.
4103 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
4104/* end confdefs.h. */
4105
4106int
4107main ()
4108{
4109asm ("setssbsy");
4110 ;
4111 return 0;
4112}
4113_ACEOF
4114if ac_fn_c_try_compile "$LINENO"; then :
4115 enable_cet=yes
4116else
4117 enable_cet=no
4118fi
4119rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
4120 ;;
4121 yes)
4122 # Check if assembler supports CET.
4123 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
4124/* end confdefs.h. */
4125
4126int
4127main ()
4128{
4129asm ("setssbsy");
4130 ;
4131 return 0;
4132}
4133_ACEOF
4134if ac_fn_c_try_compile "$LINENO"; then :
4135
4136else
4137 as_fn_error "assembler with CET support is required for --enable-cet" "$LINENO" 5
4138fi
4139rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
4140 ;;
4141 esac
4142 ;;
4143 *)
4144 enable_cet=no
4145 ;;
4146esac
4147if test x$enable_cet = xyes; then
4148 CET_FLAGS="-fcf-protection -mcet"
4149fi
4150
4151XCFLAGS="$XCFLAGS $CET_FLAGS"
4152
4153
4080{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether hidden visibility is supported" >&5 4154{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether hidden visibility is supported" >&5
4081$as_echo_n "checking whether hidden visibility is supported... " >&6; } 4155$as_echo_n "checking whether hidden visibility is supported... " >&6; }
4082cat confdefs.h - <<_ACEOF >conftest.$ac_ext 4156cat confdefs.h - <<_ACEOF >conftest.$ac_ext
@@ -10671,7 +10745,7 @@ else
10671 lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 10745 lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
10672 lt_status=$lt_dlunknown 10746 lt_status=$lt_dlunknown
10673 cat > conftest.$ac_ext <<_LT_EOF 10747 cat > conftest.$ac_ext <<_LT_EOF
10674#line 10674 "configure" 10748#line 10748 "configure"
10675#include "confdefs.h" 10749#include "confdefs.h"
10676 10750
10677#if HAVE_DLFCN_H 10751#if HAVE_DLFCN_H
@@ -10777,7 +10851,7 @@ else
10777 lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 10851 lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
10778 lt_status=$lt_dlunknown 10852 lt_status=$lt_dlunknown
10779 cat > conftest.$ac_ext <<_LT_EOF 10853 cat > conftest.$ac_ext <<_LT_EOF
10780#line 10780 "configure" 10854#line 10854 "configure"
10781#include "confdefs.h" 10855#include "confdefs.h"
10782 10856
10783#if HAVE_DLFCN_H 10857#if HAVE_DLFCN_H
diff --git a/libssp/configure.ac b/libssp/configure.ac
index 9e4a22a24d4..0d228c17d1a 100644
--- a/libssp/configure.ac
+++ b/libssp/configure.ac
@@ -62,6 +62,11 @@ void __attribute__((noinline)) bar (char *x)
62[AC_MSG_RESULT(no)]) 62[AC_MSG_RESULT(no)])
63CFLAGS="$save_CFLAGS" 63CFLAGS="$save_CFLAGS"
64 64
65# Add CET specific flags if CET is enabled
66GCC_CET_FLAGS(CET_FLAGS)
67XCFLAGS="$XCFLAGS $CET_FLAGS"
68AC_SUBST(XCFLAGS)
69
65AC_MSG_CHECKING([whether hidden visibility is supported]) 70AC_MSG_CHECKING([whether hidden visibility is supported])
66AC_TRY_COMPILE([ 71AC_TRY_COMPILE([
67void __attribute__((visibility ("hidden"))) bar (void) {}],, 72void __attribute__((visibility ("hidden"))) bar (void) {}],,