Skip to content

Commit

Permalink
Enable building libssp with Intel CET
Browse files Browse the repository at this point in the history
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
  • Loading branch information
itsimbal authored and Igor Tsimbalist committed Nov 17, 2017
1 parent 8e2fc05 commit ff035ef
Show file tree
Hide file tree
Showing 6 changed files with 100 additions and 6 deletions.
9 changes: 9 additions & 0 deletions libssp/ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
2017-11-17 Igor Tsimbalist <[email protected]>

* 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 <[email protected]>

* ssp.c (__guard_setup): Suppress unused variable warning.
Expand Down
3 changes: 2 additions & 1 deletion libssp/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ version_dep =
endif

AM_CFLAGS = -Wall
AM_CFLAGS += $(XCFLAGS)

toolexeclib_LTLIBRARIES = libssp.la libssp_nonshared.la

Expand All @@ -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
Expand Down
9 changes: 6 additions & 3 deletions libssp/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand Down Expand Up @@ -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@
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down
2 changes: 2 additions & 0 deletions libssp/aclocal.m4
Original file line number Diff line number Diff line change
Expand Up @@ -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 changes: 76 additions & 2 deletions libssp/configure
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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]
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
5 changes: 5 additions & 0 deletions libssp/configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -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) {}],,
Expand Down

0 comments on commit ff035ef

Please sign in to comment.