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
c116f5d4a4e0d7a0cc22844cbd2a3cf267fb1a8e)
Conflicts:
configure.ac
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)