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
CFLAGS="$PIE_CFLAGS $CFLAGS"
CXXFLAGS="$PIE_CFLAGS $CXXFLAGS"
-LDFLAGS="$RELRO_LDFLAGS $LDFLAGS"
+LDFLAGS="$PIE_LDFLAGS $RELRO_LDFLAGS $LDFLAGS"
AC_SUBST(LIBS)