diff options
author | John (J5) Palmieri <johnp@redhat.com> | 2007-10-03 15:21:57 -0400 |
---|---|---|
committer | John (J5) Palmieri <johnp@redhat.com> | 2007-10-03 15:21:57 -0400 |
commit | 8a92100bbed2ba5cb16a1ede36214fa7d2f43e43 (patch) | |
tree | c91d8cdc7b1e4ea67cba0082327b75990292f4f0 /configure.in | |
parent | f6ec4a80abbfd4e4f4969747c39e625b2689df08 (diff) |
Correctly implement -fPIC and -fPIE
* For security reasons we want possition independent code for libraries
and possition independent executable for executables
* before we were just enabling -fPIC
* now we correctly enable -fPIC and -PIE for libdbus and the bus respectively
* propper LD_FLAGS are set for each also
Diffstat (limited to 'configure.in')
-rw-r--r-- | configure.in | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/configure.in b/configure.in index 3dcd8bc6..ee0d40ba 100644 --- a/configure.in +++ b/configure.in @@ -211,7 +211,17 @@ if test "x$GCC" = "xyes"; then case " $CFLAGS " in *[\ \ ]-fPIC[\ \ ]*) ;; *) if cc_supports_flag -fPIC; then - CFLAGS="$CFLAGS -fPIC" + PIC_CFLAGS="-fPIC" + PIC_LDFLAGS="-Wl,-z,relro" + fi + ;; + esac + + case " $CFLAGS " in + *[\ \ ]-fPIE[\ \ ]*) ;; + *) if cc_supports_flag -fPIE; then + PIE_CFLAGS="-fPIE" + PIE_LDFLAGS="-pie -Wl,-z,relro" fi ;; esac @@ -257,6 +267,11 @@ else fi fi +AC_SUBST(PIC_CFLAGS) +AC_SUBST(PIC_LDFLAGS) +AC_SUBST(PIE_CFLAGS) +AC_SUBST(PIE_LDFLAGS) + # Check for -Wl,--gc-sections AC_MSG_CHECKING([for ld that supports "-Wl,--gc-sections"]) AC_TRY_LINK([ |