Permalink
Browse files

Make executables position-independent

Pass -pie to the linker

before:
ruben@yourmomma: pdns (master %=)$ checksec --file pdns/pdns_server
RELRO           STACK CANARY      NX            PIE             RPATH      RUNPATH      FILE
Full RELRO     Canary found     NX enabled   No PIE         No RPATH   No RUNPATH   pdns/pdns_server
ruben@yourmomma: pdns (master %=)$ checksec --file pdns/pdns_control
RELRO           STACK CANARY      NX            PIE             RPATH      RUNPATH      FILE
Full RELRO     Canary found     NX enabled   No PIE         No RPATH   No RUNPATH   pdns/pdns_control

after:
ruben@yourmomma: pdns (master *%=)$ checksec --file pdns/pdns_control
RELRO           STACK CANARY      NX            PIE             RPATH      RUNPATH      FILE
Full RELRO     Canary found     NX enabled   PIE enabled    No RPATH   No RUNPATH   pdns/pdns_control
ruben@yourmomma: pdns (master *%=)$ checksec --file pdns/pdns_server
RELRO           STACK CANARY      NX            PIE             RPATH      RUNPATH      FILE
Full RELRO     Canary found     NX enabled   PIE enabled    No RPATH   No RUNPATH   pdns/pdns_server

(cherry picked from commit c116f5d)

Conflicts:
	configure.ac
  • Loading branch information...
1 parent 075006f commit b418d5262ef641559369609980253ad6dbec0c22 @rubenk rubenk committed Jan 2, 2015
Showing with 3 additions and 3 deletions.
  1. +3 −3 configure.ac
View
@@ -345,9 +345,9 @@ for a in $dynmodules; do
moduledirs="$moduledirs ${a}backend"
done
-CFLAGS="$CFLAGS $PIE_CFLAGS"
-CXXFLAGS="$CXXFLAGS $PIE_CFLAGS"
-LDFLAGS="$LDFLAGS $RELRO_LDFLAGS"
+CFLAGS="$PIE_CFLAGS $CFLAGS"
+CXXFLAGS="$PIE_CFLAGS $CXXFLAGS"
+LDFLAGS="$PIE_LDFLAGS $RELRO_LDFLAGS $LDFLAGS"
AC_SUBST(LIBS)

0 comments on commit b418d52

Please sign in to comment.