about summary refs log tree commit diff
diff options
context:
space:
mode:
authorLiubov Dmitrieva <ldmitrie@sourceware.org>2013-09-02 13:21:47 +0400
committerLiubov Dmitrieva <ldmitrie@sourceware.org>2013-10-23 18:14:51 +0400
commit851ab32c89bba91205e11ddd5dfe8a041d999479 (patch)
treef5386cf12b0a92ada4a1e09c527f14991a9e6127
parentb7835e3223de60d3f5bf1fed66468b5052cd595f (diff)
downloadglibc-851ab32c89bba91205e11ddd5dfe8a041d999479.tar.gz
glibc-851ab32c89bba91205e11ddd5dfe8a041d999479.tar.xz
glibc-851ab32c89bba91205e11ddd5dfe8a041d999479.zip
Add --enable-mpx and --enable-mpx-write-only option to configure for Intel MPX support.
-rw-r--r--config.make.in3
-rwxr-xr-xconfigure38
-rw-r--r--configure.in27
-rw-r--r--manual/install.texi6
4 files changed, 74 insertions, 0 deletions
diff --git a/config.make.in b/config.make.in
index 7b04568a22..36ee5e6b61 100644
--- a/config.make.in
+++ b/config.make.in
@@ -96,12 +96,15 @@ build-nscd = @build_nscd@
 use-nscd = @use_nscd@
 build-hardcoded-path-in-tests= @hardcoded_path_in_tests@
 build-pt-chown = @build_pt_chown@
+enable-mpx = @enable_mpx@
+enable-mpx-write-only = @enable_mpx_write_only@
 
 # Build tools.
 CC = @CC@
 CXX = @CXX@
 BUILD_CC = @BUILD_CC@
 CFLAGS = @CFLAGS@
+ASFLAGS = @ASFLAGS@
 CPPFLAGS-config = @CPPFLAGS@
 CPPUNDEFS = @CPPUNDEFS@
 ASFLAGS-config = @ASFLAGS_config@
diff --git a/configure b/configure
index afe7821057..2c7dec17f3 100755
--- a/configure
+++ b/configure
@@ -653,6 +653,9 @@ link_obsolete_rpc
 libc_cv_nss_crypt
 all_warnings
 force_install
+ASFLAGS
+enable_mpx_write_only
+enable_mpx
 bindnow
 hardcoded_path_in_tests
 oldest_abi
@@ -747,6 +750,8 @@ enable_lock_elision
 enable_add_ons
 enable_hidden_plt
 enable_bind_now
+enable_mpx
+enable_mpx_write_only
 enable_static_nss
 enable_force_install
 enable_kernel
@@ -1409,6 +1414,8 @@ Optional Features:
                           for add-ons if no parameter given
   --disable-hidden-plt    do not hide internal function calls to avoid PLT
   --enable-bind-now       disable lazy relocations in DSOs
+  --enable-mpx            turn on Intel MPX extension
+  --enable-mpx-write-only turn on Intel MPX extension
   --enable-static-nss     build static NSS modules [default=no]
   --disable-force-install don't force installation of files from this package,
                           even if they are older than the installed files
@@ -3519,6 +3526,37 @@ fi
 
 
 
+# Check whether --enable-mpx was given.
+if test "${enable_mpx+set}" = set; then :
+  enableval=$enable_mpx; enable_mpx=$enableval
+else
+  enable_mpx=no
+fi
+
+
+
+# Check whether --enable-mpx-write-only was given.
+if test "${enable_mpx_write_only+set}" = set; then :
+  enableval=$enable_mpx_write_only; enable_mpx_write_only=$enableval
+else
+  enable_mpx_write_only=no
+fi
+
+
+
+
+
+if test "$enable_mpx" = yes ; then
+	CFLAGS="$CFLAGS -g -fcheck-pointers -mmpx -fno-chkp-check-incomplete-type -fchkp-zero-input-bounds-for-main";
+   ASFLAGS="$ASFLAGS -g -D__CHKP__ -mmpx -Wa,-madd-bnd-prefix"
+fi
+
+if test "$enable_mpx_write_only" = yes ; then
+	CFLAGS="$CFLAGS -g -fcheck-pointers -fno-chkp-check-read -mmpx -fno-chkp-check-incomplete-type -fchkp-zero-input-bounds-for-main";
+	ASFLAGS="$ASFLAGS -g -D__CHKWR__ -mmpx -Wa,-madd-bnd-prefix"
+	enable_mpx=yes
+fi
+
 # Check whether --enable-static-nss was given.
 if test "${enable_static_nss+set}" = set; then :
   enableval=$enable_static_nss; static_nss=$enableval
diff --git a/configure.in b/configure.in
index 9172ad10e4..7e83cec58d 100644
--- a/configure.in
+++ b/configure.in
@@ -216,6 +216,33 @@ AC_ARG_ENABLE([bind-now],
 	      [bindnow=no])
 AC_SUBST(bindnow)
 
+AC_ARG_ENABLE([mpx],
+	      AC_HELP_STRING([--enable-mpx],
+			     [turn on Intel MPX extension]),
+	      [enable_mpx=$enableval],
+	      [enable_mpx=no])
+AC_SUBST(enable_mpx)
+
+AC_ARG_ENABLE([mpx-write-only],
+	      AC_HELP_STRING([--enable-mpx-write-only],
+			     [turn on Intel MPX extension]),
+	      [enable_mpx_write_only=$enableval],
+	      [enable_mpx_write_only=no])
+AC_SUBST(enable_mpx_write_only)
+
+AC_SUBST(ASFLAGS)
+
+if test "$enable_mpx" = yes ; then
+	CFLAGS="$CFLAGS -g -fcheck-pointers -mmpx -fno-chkp-check-incomplete-type -fchkp-zero-input-bounds-for-main";
+   ASFLAGS="$ASFLAGS -g -D__CHKP__ -mmpx -Wa,-madd-bnd-prefix"
+fi
+
+if test "$enable_mpx_write_only" = yes ; then
+	CFLAGS="$CFLAGS -g -fcheck-pointers -fno-chkp-check-read -mmpx -fno-chkp-check-incomplete-type -fchkp-zero-input-bounds-for-main";
+	ASFLAGS="$ASFLAGS -g -D__CHKWR__ -mmpx -Wa,-madd-bnd-prefix"
+	enable_mpx=yes
+fi
+
 dnl On some platforms we cannot use dynamic loading.  We must provide
 dnl static NSS modules.
 AC_ARG_ENABLE([static-nss],
diff --git a/manual/install.texi b/manual/install.texi
index 4575d22319..03977e5828 100644
--- a/manual/install.texi
+++ b/manual/install.texi
@@ -177,6 +177,12 @@ setuid and owned by @code{root}.  The use of @file{pt_chown} introduces
 additional security risks to the system and you should enable it only if
 you understand and accept those risks.
 
+@item --enable-mpx
+By default, Intel MPX extension is disabled. This option turns it on.
+@item --enable-mpx-write-only
+By default, Intel MPX extension is disabled. This option turns it on for
+write only checks.
+
 @item --build=@var{build-system}
 @itemx --host=@var{host-system}
 These options are for cross-compiling.  If you specify both options and