diff options
author | Frank Ch. Eigler <fche@elastic.org> | 2008-05-01 17:31:26 -0400 |
---|---|---|
committer | Frank Ch. Eigler <fche@elastic.org> | 2008-05-01 17:31:26 -0400 |
commit | 8730f3776c97c4f40681e7ddcd6143363dc4a35e (patch) | |
tree | 658c26ad466f2966948e0128da08073a6230f121 /configure.ac | |
parent | ee6ce753f583e660e4c974ec7ea2b7fe91b46912 (diff) | |
download | systemtap-steved-8730f3776c97c4f40681e7ddcd6143363dc4a35e.tar.gz systemtap-steved-8730f3776c97c4f40681e7ddcd6143363dc4a35e.tar.xz systemtap-steved-8730f3776c97c4f40681e7ddcd6143363dc4a35e.zip |
PR6474: use position-independent-executable security c/ld-flags for stap* binaries
tested on rhel5 i386/x86-64, fedora7 x86-64
Diffstat (limited to 'configure.ac')
-rw-r--r-- | configure.ac | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/configure.ac b/configure.ac index 51ed83a7..4d0a4263 100644 --- a/configure.ac +++ b/configure.ac @@ -81,6 +81,29 @@ AS_IF([test "x$enable_ssp" != xno],[ CFLAGS="$save_CFLAGS" CXXFLAGS="$save_CXXFLAGS"])]) +AC_ARG_ENABLE([pie], + [AS_HELP_STRING([--disable-pie], [disable position-independent-executable])]) +AS_IF([test "x$enable_pie" != xno],[ + save_CFLAGS="$CFLAGS" + save_CXXFLAGS="$CXXFLAGS" + save_LDFLAGS="$LDFLAGS" + CFLAGS="$CFLAGS -fpie" + CXXFLAGS="$CXXFLAGS -fpie" + LDFLAGS="$LDFLAGS -pie -Wl,-z,relro -Wl,-z,now" + AC_LINK_IFELSE([void main () {}], [ + AC_MSG_NOTICE([Compiling with gcc pie et al.]) + # LDFLAGS is special since it may be passed down to bundled-elfutils, + # and interfere with the .so's built therein + PIELDFLAGS="$LDFLAGS -pie -Wl,-z,relro -Wl,-z,now" + LDFLAGS="$save_LDFLAGS" + ],[ + AC_MSG_NOTICE([Compiler does not support -pie et al.]) + CFLAGS="$save_CFLAGS" + CXXFLAGS="$save_CXXFLAGS" + PIELDFLAGS="" + LDFLAGS="$save_LDFLAGS"])]) +AC_SUBST(PIELDFLAGS) + dnl Handle optional sqlite support. If enabled/disabled by the user, dnl do the right thing. If not specified by the user, use it if dnl present. |