summaryrefslogtreecommitdiff
path: root/aclocal.m4
diff options
context:
space:
mode:
authorBen Gamari <bgamari.foss@gmail.com>2016-11-10 13:18:09 -0500
committerBen Gamari <ben@smart-cactus.org>2016-11-10 13:21:09 -0500
commitbae4a55b1fb403f610b4b55a1b6fb3f03e9c2026 (patch)
tree114191a265045a30ea86dcaa81e8e9c107fca41a /aclocal.m4
parent9030d8e4dc321dbcd32baae33f150b4e7c8ed141 (diff)
downloadhaskell-bae4a55b1fb403f610b4b55a1b6fb3f03e9c2026.tar.gz
Pass -no-pie to GCC
Certain distributions (e.g. Debian and Ubuntu) have enabled PIE be default in their GCC packaging. This breaks our abuse of GCC as a linker which requires that we pass -Wl,-r, which is incompatible with PIE (since the former implies that we are generating a relocatable object file and the latter an executable). Test Plan: Validate Reviewers: hvr, austin Subscribers: rwbarton, thomie, erikd Differential Revision: https://phabricator.haskell.org/D2691 GHC Trac Issues: #12759
Diffstat (limited to 'aclocal.m4')
-rw-r--r--aclocal.m418
1 files changed, 18 insertions, 0 deletions
diff --git a/aclocal.m4 b/aclocal.m4
index df9d42028d..3a35fe9b64 100644
--- a/aclocal.m4
+++ b/aclocal.m4
@@ -1322,6 +1322,24 @@ AC_SUBST(GccIsClang)
rm -f conftest.txt
])
+# FP_GCC_SUPPORTS_NO_PIE
+# ----------------------
+# Does gcc support the -no-pie option? If so we should pass it to gcc when
+# joining objects since -pie may be enabled by default.
+AC_DEFUN([FP_GCC_SUPPORTS_NO_PIE],
+[
+ AC_REQUIRE([AC_PROG_CC])
+ AC_MSG_CHECKING([whether GCC supports -no-pie])
+ echo 'int main() { return 0; }' > conftest.c
+ if ${CC-cc} -o conftest -no-pie conftest.c > /dev/null 2>&1; then
+ AC_DEFINE(GCC_SUPPORTS_NO_PIE, 1, [gcc supports -no-pie])
+ AC_MSG_RESULT([yes])
+ else
+ AC_MSG_RESULT([no])
+ fi
+ rm -f conftest.c conftest.o conftest
+])
+
dnl Small feature test for perl version. Assumes PerlCmd
dnl contains path to perl binary.
dnl