Enable building libsanitizer with Intel CET
authorIgor Tsimbalist <igor.v.tsimbalist@intel.com>
Fri, 17 Nov 2017 21:34:50 +0000 (22:34 +0100)
committerIgor Tsimbalist <itsimbal@gcc.gnu.org>
Fri, 17 Nov 2017 21:34:50 +0000 (22:34 +0100)
libsanitizer/
* acinclude.m4: Add enable.m4 and cet.m4.
* Makefile.in: Regenerate.
* asan/Makefile.am: Update AM_CXXFLAGS.
* asan/Makefile.in: Regenerate.
* configure: Likewise.
* configure.ac: Set CET_FLAGS. Update EXTRA_CFLAGS,
EXTRA_CXXFLAGS, EXTRA_ASFLAGS.
* interception/Makefile.am: Update AM_CXXFLAGS.
* interception/Makefile.in: Regenerate.
* libbacktrace/Makefile.am: Update AM_CFLAGS, AM_CXXFLAGS.
* libbacktrace/Makefile.in: Regenerate.
* lsan/Makefile.am: Update AM_CXXFLAGS.
* lsan/Makefile.in: Regenerate.
* sanitizer_common/Makefile.am: Update AM_CXXFLAGS,
AM_CCASFLAGS.
* sanitizer_common/sanitizer_linux_x86_64.S: Include cet.h.
Add _CET_ENDBR macro.
* sanitizer_common/Makefile.in: Regenerate.
* tsan/Makefile.am: Update AM_CXXFLAGS.
* tsan/Makefile.in: Regenerate.
* tsan/tsan_rtl_amd64.S Include cet.h. Add _CET_ENDBR macro.
* ubsan/Makefile.am: Update AM_CXXFLAGS.
* ubsan/Makefile.in: Regenerate.

From-SVN: r254896

21 files changed:
libsanitizer/ChangeLog
libsanitizer/Makefile.in
libsanitizer/acinclude.m4
libsanitizer/asan/Makefile.am
libsanitizer/asan/Makefile.in
libsanitizer/configure
libsanitizer/configure.ac
libsanitizer/interception/Makefile.am
libsanitizer/interception/Makefile.in
libsanitizer/libbacktrace/Makefile.am
libsanitizer/libbacktrace/Makefile.in
libsanitizer/lsan/Makefile.am
libsanitizer/lsan/Makefile.in
libsanitizer/sanitizer_common/Makefile.am
libsanitizer/sanitizer_common/Makefile.in
libsanitizer/sanitizer_common/sanitizer_linux_x86_64.S
libsanitizer/tsan/Makefile.am
libsanitizer/tsan/Makefile.in
libsanitizer/tsan/tsan_rtl_amd64.S
libsanitizer/ubsan/Makefile.am
libsanitizer/ubsan/Makefile.in

index f94a53bcd378dfdf7e1979bc66770efe69720562..497c4eaed5c0873ccb3c375e5512f429967e2fd6 100644 (file)
@@ -1,3 +1,29 @@
+2017-11-17  Igor Tsimbalist  <igor.v.tsimbalist@intel.com>
+
+       * acinclude.m4: Add enable.m4 and cet.m4.
+       * Makefile.in: Regenerate.
+       * asan/Makefile.am: Update AM_CXXFLAGS.
+       * asan/Makefile.in: Regenerate.
+       * configure: Likewise.
+       * configure.ac: Set CET_FLAGS. Update EXTRA_CFLAGS,
+       EXTRA_CXXFLAGS, EXTRA_ASFLAGS.
+       * interception/Makefile.am: Update AM_CXXFLAGS.
+       * interception/Makefile.in: Regenerate.
+       * libbacktrace/Makefile.am: Update AM_CFLAGS, AM_CXXFLAGS.
+       * libbacktrace/Makefile.in: Regenerate.
+       * lsan/Makefile.am: Update AM_CXXFLAGS.
+       * lsan/Makefile.in: Regenerate.
+       * sanitizer_common/Makefile.am: Update AM_CXXFLAGS,
+       AM_CCASFLAGS.
+       * sanitizer_common/sanitizer_linux_x86_64.S: Include cet.h.
+       Add _CET_ENDBR macro.
+       * sanitizer_common/Makefile.in: Regenerate.
+       * tsan/Makefile.am: Update AM_CXXFLAGS.
+       * tsan/Makefile.in: Regenerate.
+       * tsan/tsan_rtl_amd64.S Include cet.h. Add _CET_ENDBR macro.
+       * ubsan/Makefile.am: Update AM_CXXFLAGS.
+       * ubsan/Makefile.in: Regenerate.
+
 2017-11-08  Jakub Jelinek  <jakub@redhat.com>
 
        PR bootstrap/82670
index fd0f7fd78f9ea1e7b26b9599bbfbbeafa3a42d8c..a9fea21eaf8fff0db777db949d351d3032fcd100 100644 (file)
@@ -75,7 +75,8 @@ am__aclocal_m4_deps = $(top_srcdir)/../config/acx.m4 \
        $(top_srcdir)/../ltoptions.m4 $(top_srcdir)/../ltsugar.m4 \
        $(top_srcdir)/../ltversion.m4 $(top_srcdir)/../lt~obsolete.m4 \
        $(top_srcdir)/acinclude.m4 $(top_srcdir)/../libtool.m4 \
-       $(top_srcdir)/configure.ac
+       $(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 \
@@ -174,6 +175,9 @@ ECHO_N = @ECHO_N@
 ECHO_T = @ECHO_T@
 EGREP = @EGREP@
 EXEEXT = @EXEEXT@
+EXTRA_ASFLAGS = @EXTRA_ASFLAGS@
+EXTRA_CFLAGS = @EXTRA_CFLAGS@
+EXTRA_CXXFLAGS = @EXTRA_CXXFLAGS@
 FGREP = @FGREP@
 FORMAT_FILE = @FORMAT_FILE@
 GREP = @GREP@
index 8e606e7a6d923a1cfbfa5064608ebe33fefe64af..059b4595d75b3a490d8ede08aaf61c5a9f7c8433 100644 (file)
@@ -2,6 +2,8 @@ dnl ----------------------------------------------------------------------
 dnl This whole bit snagged from libgfortran.
 
 sinclude(../libtool.m4)
+sinclude(../config/enable.m4)
+sinclude(../config/cet.m4)
 dnl The lines below arrange for aclocal not to bring an installed
 dnl libtool.m4 into aclocal.m4, while still arranging for automake to
 dnl add a definition of LIBTOOL to Makefile.in.
index 709b6c8d75ba2152da616ea70319bbab94d96cab..f105b0357964ca85d9dd48653e13ef5c5b6cbef9 100644 (file)
@@ -10,6 +10,7 @@ endif
 AM_CXXFLAGS = -Wall -W -Wno-unused-parameter -Wwrite-strings -pedantic -Wno-long-long  -fPIC -fno-builtin -fno-exceptions -fno-rtti -fomit-frame-pointer -funwind-tables -fvisibility=hidden -Wno-variadic-macros -fno-ipa-icf
 AM_CXXFLAGS += $(LIBSTDCXX_RAW_CXX_CXXFLAGS)
 AM_CXXFLAGS += -std=gnu++11
+AM_CXXFLAGS += $(EXTRA_CXXFLAGS)
 ACLOCAL_AMFLAGS = -I $(top_srcdir) -I $(top_srcdir)/config
 
 toolexeclib_LTLIBRARIES = libasan.la
index db3c3ced8b904282e673cad304136ef42e9f800c..4cf27e712f70638cae67e9e5faf9c833a16c00b6 100644 (file)
@@ -69,7 +69,8 @@ am__aclocal_m4_deps = $(top_srcdir)/../config/acx.m4 \
        $(top_srcdir)/../ltoptions.m4 $(top_srcdir)/../ltsugar.m4 \
        $(top_srcdir)/../ltversion.m4 $(top_srcdir)/../lt~obsolete.m4 \
        $(top_srcdir)/acinclude.m4 $(top_srcdir)/../libtool.m4 \
-       $(top_srcdir)/configure.ac
+       $(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)
 mkinstalldirs = $(SHELL) $(top_srcdir)/../mkinstalldirs
@@ -184,6 +185,9 @@ ECHO_N = @ECHO_N@
 ECHO_T = @ECHO_T@
 EGREP = @EGREP@
 EXEEXT = @EXEEXT@
+EXTRA_ASFLAGS = @EXTRA_ASFLAGS@
+EXTRA_CFLAGS = @EXTRA_CFLAGS@
+EXTRA_CXXFLAGS = @EXTRA_CXXFLAGS@
 FGREP = @FGREP@
 FORMAT_FILE = @FORMAT_FILE@
 GREP = @GREP@
@@ -304,7 +308,7 @@ AM_CXXFLAGS = -Wall -W -Wno-unused-parameter -Wwrite-strings -pedantic \
        -Wno-long-long -fPIC -fno-builtin -fno-exceptions -fno-rtti \
        -fomit-frame-pointer -funwind-tables -fvisibility=hidden \
        -Wno-variadic-macros -fno-ipa-icf \
-       $(LIBSTDCXX_RAW_CXX_CXXFLAGS) -std=gnu++11
+       $(LIBSTDCXX_RAW_CXX_CXXFLAGS) -std=gnu++11 $(EXTRA_CXXFLAGS)
 ACLOCAL_AMFLAGS = -I $(top_srcdir) -I $(top_srcdir)/config
 toolexeclib_LTLIBRARIES = libasan.la
 nodist_toolexeclib_HEADERS = libasan_preinit.o
index 8e0c47ea8384882b25fd664d41555a383d7fb3b8..a0104d8c2abcbf057c0b7340c56952588e6f8a5d 100755 (executable)
@@ -604,6 +604,9 @@ ac_subst_vars='am__EXEEXT_FALSE
 am__EXEEXT_TRUE
 LTLIBOBJS
 LIBOBJS
+EXTRA_CXXFLAGS
+EXTRA_CFLAGS
+EXTRA_ASFLAGS
 get_gcc_base_ver
 SANITIZER_COMMON_TARGET_DEPENDENT_OBJECTS
 TSAN_TARGET_DEPENDENT_OBJECTS
@@ -774,6 +777,7 @@ enable_fast_install
 with_gnu_ld
 enable_libtool_lock
 with_gcc_major_version_only
+enable_cet
 '
       ac_precious_vars='build_alias
 host_alias
@@ -1421,6 +1425,8 @@ Optional Features:
   --enable-fast-install[=PKGS]
                           optimize for fast installation [default=yes]
   --disable-libtool-lock  avoid locking (might break parallel builds)
+  --enable-cet            enable Intel CET in target libraries
+                          [default=default]
 
 Optional Packages:
   --with-PACKAGE[=ARG]    use PACKAGE [ARG=yes]
@@ -12032,7 +12038,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 12035 "configure"
+#line 12041 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -12138,7 +12144,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 12141 "configure"
+#line 12147 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
 
 
 
+# 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_CFLAGS="$EXTRA_CFLAGS $CET_FLAGS"
+EXTRA_CXXFLAGS="$EXTRA_CXXFLAGS $CET_FLAGS"
+EXTRA_ASFLAGS=$CET_FLAGS
+
+
+
+
 cat >confcache <<\_ACEOF
 # This file is a shell script that caches the results of configure
 # tests run on this system so they can be shared between configure
index b0c485b0f7bcf98dcffa98a98ec5eeee884f3e26..0d11afd19483232a31c8a20511e45ecd832ad340 100644 (file)
@@ -380,4 +380,13 @@ AC_SUBST([SANITIZER_COMMON_TARGET_DEPENDENT_OBJECTS])
 # Determine what GCC version number to use in filesystem paths.
 GCC_BASE_VER
 
+# Add CET specific flags if Intel CET is enabled.
+GCC_CET_FLAGS(CET_FLAGS)
+EXTRA_CFLAGS="$EXTRA_CFLAGS $CET_FLAGS"
+EXTRA_CXXFLAGS="$EXTRA_CXXFLAGS $CET_FLAGS"
+EXTRA_ASFLAGS=$CET_FLAGS
+AC_SUBST(EXTRA_ASFLAGS)
+AC_SUBST(EXTRA_CFLAGS)
+AC_SUBST(EXTRA_CXXFLAGS)
+
 AC_OUTPUT
index bd3172309bd060b6b2246ae9e944ad4e48378f53..22ce8d5edaca2d049dfa022616f2ba6522ebea9d 100644 (file)
@@ -7,6 +7,7 @@ DEFS = -D_GNU_SOURCE -D_DEBUG -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D
 AM_CXXFLAGS = -Wall -W -Wno-unused-parameter -Wwrite-strings -pedantic -Wno-long-long  -fPIC -fno-builtin -fno-exceptions -fno-rtti -fomit-frame-pointer -funwind-tables -fvisibility=hidden -Wno-variadic-macros
 AM_CXXFLAGS += $(LIBSTDCXX_RAW_CXX_CXXFLAGS)
 AM_CXXFLAGS += -std=gnu++11
+AM_CXXFLAGS += $(EXTRA_CXXFLAGS)
 ACLOCAL_AMFLAGS = -I m4
 
 noinst_LTLIBRARIES = libinterception.la
index c71fb57b8b839bcbe6a756d2f3ea9a9ebff79c8e..4eb64562e702a9a41d4009c3ae17f3942ec7dd44 100644 (file)
@@ -65,7 +65,8 @@ am__aclocal_m4_deps = $(top_srcdir)/../config/acx.m4 \
        $(top_srcdir)/../ltoptions.m4 $(top_srcdir)/../ltsugar.m4 \
        $(top_srcdir)/../ltversion.m4 $(top_srcdir)/../lt~obsolete.m4 \
        $(top_srcdir)/acinclude.m4 $(top_srcdir)/../libtool.m4 \
-       $(top_srcdir)/configure.ac
+       $(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)
 mkinstalldirs = $(SHELL) $(top_srcdir)/../mkinstalldirs
@@ -132,6 +133,9 @@ ECHO_N = @ECHO_N@
 ECHO_T = @ECHO_T@
 EGREP = @EGREP@
 EXEEXT = @EXEEXT@
+EXTRA_ASFLAGS = @EXTRA_ASFLAGS@
+EXTRA_CFLAGS = @EXTRA_CFLAGS@
+EXTRA_CXXFLAGS = @EXTRA_CXXFLAGS@
 FGREP = @FGREP@
 FORMAT_FILE = @FORMAT_FILE@
 GREP = @GREP@
@@ -252,7 +256,7 @@ AM_CXXFLAGS = -Wall -W -Wno-unused-parameter -Wwrite-strings -pedantic \
        -Wno-long-long -fPIC -fno-builtin -fno-exceptions -fno-rtti \
        -fomit-frame-pointer -funwind-tables -fvisibility=hidden \
        -Wno-variadic-macros $(LIBSTDCXX_RAW_CXX_CXXFLAGS) \
-       -std=gnu++11
+       -std=gnu++11 $(EXTRA_CXXFLAGS)
 ACLOCAL_AMFLAGS = -I m4
 noinst_LTLIBRARIES = libinterception.la
 interception_files = \
index 34bfb1eef27d719b2b017c9490f59cb4c7011f26..9c752272be1c5fef41714afa175ef744552d39b0 100644 (file)
@@ -39,8 +39,10 @@ WARN_FLAGS = -W -Wall -Wwrite-strings -Wmissing-format-attribute \
 C_WARN_FLAGS = $(WARN_FLAGS) -Wstrict-prototypes -Wmissing-prototypes -Wold-style-definition
 CXX_WARN_FLAGS = $(WARN_FLAGS) -Wno-unused-parameter
 AM_CFLAGS = $(C_WARN_FLAGS)
+AM_CFLAGS += $(EXTRA_CFLAGS)
 AM_CXXFLAGS = $(CXX_WARN_FLAGS) -fno-rtti -fno-exceptions
 AM_CXXFLAGS += -std=gnu++11
+AM_CXXFLAGS += $(EXTRA_CXXFLAGS)
 
 noinst_LTLIBRARIES = libsanitizer_libbacktrace.la
 
index dff04cfa3ea1caa3929136ff0ecd66681b077827..e23aa846a5647efb11ca313b62a8fb246003b172 100644 (file)
@@ -97,7 +97,8 @@ am__aclocal_m4_deps = $(top_srcdir)/../config/acx.m4 \
        $(top_srcdir)/../ltoptions.m4 $(top_srcdir)/../ltsugar.m4 \
        $(top_srcdir)/../ltversion.m4 $(top_srcdir)/../lt~obsolete.m4 \
        $(top_srcdir)/acinclude.m4 $(top_srcdir)/../libtool.m4 \
-       $(top_srcdir)/configure.ac
+       $(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)
 mkinstalldirs = $(SHELL) $(top_srcdir)/../mkinstalldirs
@@ -174,6 +175,9 @@ ECHO_N = @ECHO_N@
 ECHO_T = @ECHO_T@
 EGREP = @EGREP@
 EXEEXT = @EXEEXT@
+EXTRA_ASFLAGS = @EXTRA_ASFLAGS@
+EXTRA_CFLAGS = @EXTRA_CFLAGS@
+EXTRA_CXXFLAGS = @EXTRA_CXXFLAGS@
 FGREP = @FGREP@
 FORMAT_FILE = @FORMAT_FILE@
 GREP = @GREP@
@@ -295,8 +299,9 @@ WARN_FLAGS = -W -Wall -Wwrite-strings -Wmissing-format-attribute \
 
 C_WARN_FLAGS = $(WARN_FLAGS) -Wstrict-prototypes -Wmissing-prototypes -Wold-style-definition
 CXX_WARN_FLAGS = $(WARN_FLAGS) -Wno-unused-parameter
-AM_CFLAGS = $(C_WARN_FLAGS)
-AM_CXXFLAGS = $(CXX_WARN_FLAGS) -fno-rtti -fno-exceptions -std=gnu++11
+AM_CFLAGS = $(C_WARN_FLAGS) $(EXTRA_CFLAGS)
+AM_CXXFLAGS = $(CXX_WARN_FLAGS) -fno-rtti -fno-exceptions -std=gnu++11 \
+       $(EXTRA_CXXFLAGS)
 noinst_LTLIBRARIES = libsanitizer_libbacktrace.la
 libsanitizer_libbacktrace_la_SOURCES = \
        ../../libbacktrace/backtrace.h \
index 700d15fce57c3a2fe55cfcf555947010bc7ed0e8..423ffc249e0b048f0dfde7b3b2c58a033ff5cf7d 100644 (file)
@@ -7,6 +7,7 @@ DEFS = -D_GNU_SOURCE -D_DEBUG -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D
 AM_CXXFLAGS = -Wall -W -Wno-unused-parameter -Wwrite-strings -pedantic -Wno-long-long  -fPIC -fno-builtin -fno-exceptions -fno-rtti -fomit-frame-pointer -funwind-tables -fvisibility=hidden -Wno-variadic-macros
 AM_CXXFLAGS += $(LIBSTDCXX_RAW_CXX_CXXFLAGS)
 AM_CXXFLAGS += -std=gnu++11
+AM_CXXFLAGS += $(EXTRA_CXXFLAGS)
 ACLOCAL_AMFLAGS = -I m4
 
 noinst_LTLIBRARIES = libsanitizer_lsan.la
index 85502500728bb14d67a644b663920a5468382b98..a88d1f82647554c7865e3e979e90172b266422aa 100644 (file)
@@ -67,7 +67,8 @@ am__aclocal_m4_deps = $(top_srcdir)/../config/acx.m4 \
        $(top_srcdir)/../ltoptions.m4 $(top_srcdir)/../ltsugar.m4 \
        $(top_srcdir)/../ltversion.m4 $(top_srcdir)/../lt~obsolete.m4 \
        $(top_srcdir)/acinclude.m4 $(top_srcdir)/../libtool.m4 \
-       $(top_srcdir)/configure.ac
+       $(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)
 mkinstalldirs = $(SHELL) $(top_srcdir)/../mkinstalldirs
@@ -177,6 +178,9 @@ ECHO_N = @ECHO_N@
 ECHO_T = @ECHO_T@
 EGREP = @EGREP@
 EXEEXT = @EXEEXT@
+EXTRA_ASFLAGS = @EXTRA_ASFLAGS@
+EXTRA_CFLAGS = @EXTRA_CFLAGS@
+EXTRA_CXXFLAGS = @EXTRA_CXXFLAGS@
 FGREP = @FGREP@
 FORMAT_FILE = @FORMAT_FILE@
 GREP = @GREP@
@@ -297,7 +301,7 @@ AM_CXXFLAGS = -Wall -W -Wno-unused-parameter -Wwrite-strings -pedantic \
        -Wno-long-long -fPIC -fno-builtin -fno-exceptions -fno-rtti \
        -fomit-frame-pointer -funwind-tables -fvisibility=hidden \
        -Wno-variadic-macros $(LIBSTDCXX_RAW_CXX_CXXFLAGS) \
-       -std=gnu++11
+       -std=gnu++11 $(EXTRA_CXXFLAGS)
 ACLOCAL_AMFLAGS = -I m4
 noinst_LTLIBRARIES = libsanitizer_lsan.la
 @LSAN_SUPPORTED_TRUE@toolexeclib_LTLIBRARIES = liblsan.la
index adaab4cee5485ac7310d82677e22d06b046e1774..246985b9933845bc998b0422c658665a2cf04393 100644 (file)
@@ -7,6 +7,7 @@ DEFS = -D_GNU_SOURCE -D_DEBUG -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D
 AM_CXXFLAGS = -Wall -W -Wno-unused-parameter -Wwrite-strings -pedantic -Wno-long-long  -fPIC -fno-builtin -fno-exceptions -fno-rtti -fomit-frame-pointer -funwind-tables -fvisibility=hidden -Wno-variadic-macros
 AM_CXXFLAGS += $(LIBSTDCXX_RAW_CXX_CXXFLAGS)
 AM_CXXFLAGS += -std=gnu++11
+AM_CXXFLAGS += $(EXTRA_CXXFLAGS)
 if LIBBACKTRACE_SUPPORTED
 AM_CXXFLAGS += -DSANITIZER_LIBBACKTRACE -DSANITIZER_CP_DEMANGLE \
               -I $(top_srcdir)/../libbacktrace \
@@ -14,6 +15,7 @@ AM_CXXFLAGS += -DSANITIZER_LIBBACKTRACE -DSANITIZER_CP_DEMANGLE \
               -I $(top_srcdir)/../include \
               -include $(top_srcdir)/libbacktrace/backtrace-rename.h
 endif
+AM_CCASFLAGS = $(EXTRA_ASFLAGS)
 ACLOCAL_AMFLAGS = -I m4
 
 noinst_LTLIBRARIES = libsanitizer_common.la
index b2acc5caf56c2c5412b8dccb4651a4aff70c8942..b0f5ac25a7f6dc9572879c26a12651b03b5dd520 100644 (file)
@@ -71,7 +71,8 @@ am__aclocal_m4_deps = $(top_srcdir)/../config/acx.m4 \
        $(top_srcdir)/../ltoptions.m4 $(top_srcdir)/../ltsugar.m4 \
        $(top_srcdir)/../ltversion.m4 $(top_srcdir)/../lt~obsolete.m4 \
        $(top_srcdir)/acinclude.m4 $(top_srcdir)/../libtool.m4 \
-       $(top_srcdir)/configure.ac
+       $(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)
 mkinstalldirs = $(SHELL) $(top_srcdir)/../mkinstalldirs
@@ -177,6 +178,9 @@ ECHO_N = @ECHO_N@
 ECHO_T = @ECHO_T@
 EGREP = @EGREP@
 EXEEXT = @EXEEXT@
+EXTRA_ASFLAGS = @EXTRA_ASFLAGS@
+EXTRA_CFLAGS = @EXTRA_CFLAGS@
+EXTRA_CXXFLAGS = @EXTRA_CXXFLAGS@
 FGREP = @FGREP@
 FORMAT_FILE = @FORMAT_FILE@
 GREP = @GREP@
@@ -297,7 +301,8 @@ AM_CXXFLAGS = -Wall -W -Wno-unused-parameter -Wwrite-strings -pedantic \
        -Wno-long-long -fPIC -fno-builtin -fno-exceptions -fno-rtti \
        -fomit-frame-pointer -funwind-tables -fvisibility=hidden \
        -Wno-variadic-macros $(LIBSTDCXX_RAW_CXX_CXXFLAGS) \
-       -std=gnu++11 $(am__append_1)
+       -std=gnu++11 $(EXTRA_CXXFLAGS) $(am__append_1)
+AM_CCASFLAGS = $(EXTRA_ASFLAGS)
 ACLOCAL_AMFLAGS = -I m4
 noinst_LTLIBRARIES = libsanitizer_common.la
 sanitizer_common_files = \
index 8ff909542b681cb79bd40d2e3b08c75e8f8e1a2f..846d1a43370b3c9a9ed451076a4bd80404feec8e 100644 (file)
 #if defined(__linux__) && defined(__x86_64__)
 
 #include "../builtins/assembly.h"
+#include "cet.h"
 
 // If the "naked" function attribute were supported for x86 we could
 // do this via inline asm.
 .text
 .balign 4
 DEFINE_COMPILERRT_FUNCTION(internal_sigreturn)
+       _CET_ENDBR
         mov           $0xf,             %eax    // 0xf == SYS_rt_sigreturn
         mov           %rcx,             %r10
         syscall
index c218983e2fe2d86ae7904991f83fb3a7798fbef3..753cb8f4fc13e000a8724c884ffc5ac86f5dfb20 100644 (file)
@@ -7,6 +7,7 @@ DEFS = -D_GNU_SOURCE -D_DEBUG -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D
 AM_CXXFLAGS = -Wall -W -Wno-unused-parameter -Wwrite-strings -pedantic -Wno-long-long  -fPIC -fno-builtin -fno-exceptions -fno-rtti -fomit-frame-pointer -funwind-tables -fvisibility=hidden -Wno-variadic-macros
 AM_CXXFLAGS += $(LIBSTDCXX_RAW_CXX_CXXFLAGS)
 AM_CXXFLAGS += -std=gnu++11
+AM_CXXFLAGS += $(EXTRA_CXXFLAGS)
 ACLOCAL_AMFLAGS = -I m4
 
 toolexeclib_LTLIBRARIES = libtsan.la
index e32e9c0bfa103994eb5f9889910a7b03055984e3..629056bf17b099f793de3d5d8c4fa0d46b2e2ef9 100644 (file)
@@ -68,7 +68,8 @@ am__aclocal_m4_deps = $(top_srcdir)/../config/acx.m4 \
        $(top_srcdir)/../ltoptions.m4 $(top_srcdir)/../ltsugar.m4 \
        $(top_srcdir)/../ltversion.m4 $(top_srcdir)/../lt~obsolete.m4 \
        $(top_srcdir)/acinclude.m4 $(top_srcdir)/../libtool.m4 \
-       $(top_srcdir)/configure.ac
+       $(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)
 mkinstalldirs = $(SHELL) $(top_srcdir)/../mkinstalldirs
@@ -193,6 +194,9 @@ ECHO_N = @ECHO_N@
 ECHO_T = @ECHO_T@
 EGREP = @EGREP@
 EXEEXT = @EXEEXT@
+EXTRA_ASFLAGS = @EXTRA_ASFLAGS@
+EXTRA_CFLAGS = @EXTRA_CFLAGS@
+EXTRA_CXXFLAGS = @EXTRA_CXXFLAGS@
 FGREP = @FGREP@
 FORMAT_FILE = @FORMAT_FILE@
 GREP = @GREP@
@@ -313,7 +317,7 @@ AM_CXXFLAGS = -Wall -W -Wno-unused-parameter -Wwrite-strings -pedantic \
        -Wno-long-long -fPIC -fno-builtin -fno-exceptions -fno-rtti \
        -fomit-frame-pointer -funwind-tables -fvisibility=hidden \
        -Wno-variadic-macros $(LIBSTDCXX_RAW_CXX_CXXFLAGS) \
-       -std=gnu++11
+       -std=gnu++11 $(EXTRA_CXXFLAGS)
 ACLOCAL_AMFLAGS = -I m4
 toolexeclib_LTLIBRARIES = libtsan.la
 nodist_toolexeclib_HEADERS = libtsan_preinit.o
index 98947fd2a1baa372b1af7c6b22f7c2df50ea4451..4eb1ffdd2b7fa01a6c6ef55d53460455dec51c40 100644 (file)
@@ -2,6 +2,7 @@
 #if defined(__x86_64__)
 
 #include "sanitizer_common/sanitizer_asm.h"
+#include "cet.h"
 
 #if !defined(__APPLE__)
 .section .text
@@ -13,6 +14,7 @@ ASM_HIDDEN(__tsan_trace_switch)
 .globl ASM_TSAN_SYMBOL(__tsan_trace_switch_thunk)
 ASM_TSAN_SYMBOL(__tsan_trace_switch_thunk):
   CFI_STARTPROC
+  _CET_ENDBR
   # Save scratch registers.
   push %rax
   CFI_ADJUST_CFA_OFFSET(8)
@@ -93,6 +95,7 @@ ASM_HIDDEN(__tsan_report_race)
 .globl ASM_TSAN_SYMBOL(__tsan_report_race_thunk)
 ASM_TSAN_SYMBOL(__tsan_report_race_thunk):
   CFI_STARTPROC
+  _CET_ENDBR
   # Save scratch registers.
   push %rax
   CFI_ADJUST_CFA_OFFSET(8)
@@ -177,6 +180,7 @@ ASM_HIDDEN(__tsan_setjmp)
 ASM_TYPE_FUNCTION(ASM_TSAN_SYMBOL_INTERCEPTOR(setjmp))
 ASM_TSAN_SYMBOL_INTERCEPTOR(setjmp):
   CFI_STARTPROC
+  _CET_ENDBR
   // save env parameter
   push %rdi
   CFI_ADJUST_CFA_OFFSET(8)
@@ -218,6 +222,7 @@ ASM_SIZE(ASM_TSAN_SYMBOL_INTERCEPTOR(setjmp))
 ASM_TYPE_FUNCTION(ASM_TSAN_SYMBOL_INTERCEPTOR(_setjmp))
 ASM_TSAN_SYMBOL_INTERCEPTOR(_setjmp):
   CFI_STARTPROC
+  _CET_ENDBR
   // save env parameter
   push %rdi
   CFI_ADJUST_CFA_OFFSET(8)
@@ -259,6 +264,7 @@ ASM_SIZE(ASM_TSAN_SYMBOL_INTERCEPTOR(_setjmp))
 ASM_TYPE_FUNCTION(ASM_TSAN_SYMBOL_INTERCEPTOR(sigsetjmp))
 ASM_TSAN_SYMBOL_INTERCEPTOR(sigsetjmp):
   CFI_STARTPROC
+  _CET_ENDBR
   // save env parameter
   push %rdi
   CFI_ADJUST_CFA_OFFSET(8)
@@ -315,6 +321,7 @@ ASM_SIZE(ASM_TSAN_SYMBOL_INTERCEPTOR(sigsetjmp))
 ASM_TYPE_FUNCTION(ASM_TSAN_SYMBOL_INTERCEPTOR(__sigsetjmp))
 ASM_TSAN_SYMBOL_INTERCEPTOR(__sigsetjmp):
   CFI_STARTPROC
+  _CET_ENDBR
   // save env parameter
   push %rdi
   CFI_ADJUST_CFA_OFFSET(8)
index fea000c0c8ecd2876bdd3f3d7c5f7dd4e4a09a06..2bff6be93b7b38bb4fc1faa698d00b6cf674a816 100644 (file)
@@ -7,6 +7,7 @@ DEFS = -D_GNU_SOURCE -D_DEBUG -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D
 AM_CXXFLAGS = -Wall -W -Wno-unused-parameter -Wwrite-strings -pedantic -Wno-long-long  -fPIC -fno-builtin -fno-exceptions -fno-rtti -fomit-frame-pointer -funwind-tables -fvisibility=hidden -Wno-variadic-macros
 AM_CXXFLAGS += $(LIBSTDCXX_RAW_CXX_CXXFLAGS)
 AM_CXXFLAGS += -std=gnu++11
+AM_CXXFLAGS += $(EXTRA_CXXFLAGS)
 ACLOCAL_AMFLAGS = -I m4
 
 toolexeclib_LTLIBRARIES = libubsan.la
index e757d29cd4a4602a792461c7d1db70da146e44e3..d75260f1ef76c73dd0ff37ea350023ec07e1cf6c 100644 (file)
@@ -67,7 +67,8 @@ am__aclocal_m4_deps = $(top_srcdir)/../config/acx.m4 \
        $(top_srcdir)/../ltoptions.m4 $(top_srcdir)/../ltsugar.m4 \
        $(top_srcdir)/../ltversion.m4 $(top_srcdir)/../lt~obsolete.m4 \
        $(top_srcdir)/acinclude.m4 $(top_srcdir)/../libtool.m4 \
-       $(top_srcdir)/configure.ac
+       $(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)
 mkinstalldirs = $(SHELL) $(top_srcdir)/../mkinstalldirs
@@ -171,6 +172,9 @@ ECHO_N = @ECHO_N@
 ECHO_T = @ECHO_T@
 EGREP = @EGREP@
 EXEEXT = @EXEEXT@
+EXTRA_ASFLAGS = @EXTRA_ASFLAGS@
+EXTRA_CFLAGS = @EXTRA_CFLAGS@
+EXTRA_CXXFLAGS = @EXTRA_CXXFLAGS@
 FGREP = @FGREP@
 FORMAT_FILE = @FORMAT_FILE@
 GREP = @GREP@
@@ -291,7 +295,7 @@ AM_CXXFLAGS = -Wall -W -Wno-unused-parameter -Wwrite-strings -pedantic \
        -Wno-long-long -fPIC -fno-builtin -fno-exceptions -fno-rtti \
        -fomit-frame-pointer -funwind-tables -fvisibility=hidden \
        -Wno-variadic-macros $(LIBSTDCXX_RAW_CXX_CXXFLAGS) \
-       -std=gnu++11
+       -std=gnu++11 $(EXTRA_CXXFLAGS)
 ACLOCAL_AMFLAGS = -I m4
 toolexeclib_LTLIBRARIES = libubsan.la
 ubsan_plugin_files = \