Page MenuHomePhabricator

Enlightenment should check if PIE is supported
Closed, ResolvedPublic

Description

Enlightenment supposes that -pie is always available. Recent gcc (5.x) are more restrictive about it and doesn't claim that they support pie, when they really don't.
The following patch solves the issue:

--- enlightenment-0.19.3/configure.ac.1 2016-09-01 14:45:27.400238352 +0300
+++ enlightenment-0.19.3/configure.ac   2016-09-01 14:54:48.922121488 +0300
@@ -1025,8 +1025,26 @@
     EFL_COMPILER_FLAG([-Wformat=2])
    ])
 
-SUID_CFLAGS=-fPIE
-SUID_LDFLAGS=-pie
+SUID_CFLAGS=
+SUID_LDFLAGS=
+if test -n "$GCC"; then
+  AC_MSG_CHECKING(if GCC supports -fPIE)
+
+  OLDCFLAGS="$CFLAGS"
+  OLDLDFLAGS="$LDFLAGS"
+
+  CFLAGS="$CFLAGS -fPIE"
+  LDFLAGS="$LDFLAGS -pie"
+
+  AC_TRY_LINK(,,
+       [ 
+        SUID_CFLAGS="-fPIE"
+       SUID_LDFLAGS="-pie"
+       AC_MSG_RESULT(yes)],
+       AC_MSG_RESULT(no))
+  CFLAGS="$OLDCFLAGS"
+  LDFLAGS="$OLDLFDLAGS"
+fi
 AC_SUBST([SUID_CFLAGS])
 AC_SUBST([SUID_LDFLAGS])
apyhalov created this task.Sep 1 2016, 5:08 AM
zmike added a comment.Sep 8 2016, 7:12 AM

Can you resubmit this patch with authorship? Alternatively you can email it to zmike@enlightenment.org

I've uploaded git patch

. Modified it to apply to HEAD. I don't know why PIE was explicitly disabled on BSDs, so left it as is.

zmike closed this task as Resolved.Oct 20 2016, 7:31 AM

Thanks!