Wietse Venema:
> Indeed. PIE support is a new feature. New features are not added
> during the code freeze. You're welcome to back-port this new feature
> once we have tested it in Postfix 3.1 with multiple build options
> (shared/nonshared) and with multiple OS distributions. This does
> not appear to require tests on multiple hardware architectures.
Very lighty-tested patch follows. No INSTALL documentation until
this has been tested.
Usage: $ make makefiles pie=yes ...
Wietse
diff -ur /var/tmp/postfix-3.1-20150201/makedefs ./makedefs
--- /var/tmp/postfix-3.1-20150201/makedefs 2015-01-31 19:06:20.000000000
-0500
+++ ./makedefs 2015-02-04 12:50:05.000000000 -0500
@@ -105,6 +105,13 @@
# "dynamicmaps=yes" implicitly enables Postfix shared libraries.
#
# This feature was introduced with Postfix 3.0.
+# .IP \fBpie=yes\fR
+# .IP \fBpie=no\fR
+#
+# Enable (disable) Postfix builds with position-independent
+# executables, on platforms where this is supported.
+#
+# This feature was introduced with Postfix 3.1.
# .IP \fIinstallation_parameter\fB=\fIvalue\fR...
# Override the compiled-in default value of the specified
# installation parameter(s). The following parameters are
@@ -142,6 +149,7 @@
echo "# AUXLIBS=$AUXLIBS"
env | grep '^AUXLIBS_' | sed 's/^/# /'
echo "# dynamicmaps=$dynamicmaps"
+echo "# pie=$pie"
# Defaults for most sane systems
@@ -1082,6 +1090,19 @@
'`
esac
+# Choose between PIE and non-PIE builds.
+
+case "$pie" in
+ yes) case "$CCARGS" in
+ *" -fPIC "*) ;;
+ *) CCARGS_PIE="-fPIC";;
+ esac
+ SYSLIBS_PIE="-pie";;
+""|no) ;;
+ *) error "Specify \"pie=yes\" or \"pie=no\"";;
+esac
+
+
# Finally...
sed 's/ */ /g' <<EOF
@@ -1090,8 +1111,8 @@
_AR = $_AR
ARFL = $ARFL
_RANLIB = $_RANLIB
-SYSLIBS = $AUXLIBS $SYSLIBS $PLUGIN_AUXLIBS
-CC = $CC $CCARGS \$(WARN)
+SYSLIBS = $SYSLIBS_PIE $AUXLIBS $SYSLIBS $PLUGIN_AUXLIBS
+CC = $CC $CCARGS_PIE $CCARGS \$(WARN)
OPT = $OPT
DEBUG = $DEBUG
AWK = $AWK