2021-11-29 07:07:20 +00:00
|
|
|
From d10ec6f4bea9d3f07d3ada43da129a4b5812fd65 Mon Sep 17 00:00:00 2001
|
2018-12-12 17:14:55 +00:00
|
|
|
From: Szabolcs Nagy <nsz@port70.net>
|
|
|
|
Date: Sat, 7 Nov 2015 02:08:05 +0000
|
2021-04-25 11:08:48 +00:00
|
|
|
Subject: [PATCH] nopie
|
2018-12-12 17:14:55 +00:00
|
|
|
|
|
|
|
---
|
|
|
|
gcc/configure | 27 +++++++++++++++++++++++++++
|
|
|
|
gcc/configure.ac | 13 +++++++++++++
|
|
|
|
2 files changed, 40 insertions(+)
|
|
|
|
|
|
|
|
diff --git a/gcc/configure b/gcc/configure
|
2021-11-25 09:09:10 +00:00
|
|
|
index 4b977e313b5..592e81e40f6 100755
|
2018-12-12 17:14:55 +00:00
|
|
|
--- a/gcc/configure
|
|
|
|
+++ b/gcc/configure
|
2021-11-25 09:09:10 +00:00
|
|
|
@@ -32300,6 +32300,33 @@ fi
|
2018-12-12 17:14:55 +00:00
|
|
|
$as_echo "$gcc_cv_no_pie" >&6; }
|
|
|
|
if test "$gcc_cv_no_pie" = "yes"; then
|
|
|
|
NO_PIE_FLAG="-no-pie"
|
|
|
|
+else
|
|
|
|
+ # Check if -nopie works.
|
|
|
|
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -nopie option" >&5
|
|
|
|
+$as_echo_n "checking for -nopie option... " >&6; }
|
|
|
|
+if test "${gcc_cv_nopie+set}" = set; then :
|
|
|
|
+ $as_echo_n "(cached) " >&6
|
|
|
|
+else
|
|
|
|
+ saved_LDFLAGS="$LDFLAGS"
|
|
|
|
+ LDFLAGS="$LDFLAGS -nopie"
|
|
|
|
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
|
|
|
+/* end confdefs.h. */
|
|
|
|
+int main(void) {return 0;}
|
|
|
|
+_ACEOF
|
|
|
|
+if ac_fn_cxx_try_link "$LINENO"; then :
|
|
|
|
+ gcc_cv_nopie=yes
|
|
|
|
+else
|
|
|
|
+ gcc_cv_nopie=no
|
|
|
|
+fi
|
|
|
|
+rm -f core conftest.err conftest.$ac_objext \
|
|
|
|
+ conftest$ac_exeext conftest.$ac_ext
|
|
|
|
+ LDFLAGS="$saved_LDFLAGS"
|
|
|
|
+fi
|
|
|
|
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gcc_cv_nopie" >&5
|
|
|
|
+$as_echo "$gcc_cv_nopie" >&6; }
|
|
|
|
+ if test "$gcc_cv_nopie" = "yes"; then
|
|
|
|
+ NO_PIE_FLAG="-nopie"
|
|
|
|
+ fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
diff --git a/gcc/configure.ac b/gcc/configure.ac
|
2021-11-25 09:09:10 +00:00
|
|
|
index 5461bab88a9..1577529ffb7 100644
|
2018-12-12 17:14:55 +00:00
|
|
|
--- a/gcc/configure.ac
|
|
|
|
+++ b/gcc/configure.ac
|
2021-11-25 09:09:10 +00:00
|
|
|
@@ -7571,6 +7571,19 @@ AC_CACHE_CHECK([for -no-pie option],
|
2018-12-12 17:14:55 +00:00
|
|
|
LDFLAGS="$saved_LDFLAGS"])
|
|
|
|
if test "$gcc_cv_no_pie" = "yes"; then
|
|
|
|
NO_PIE_FLAG="-no-pie"
|
|
|
|
+else
|
|
|
|
+ # Check if -nopie works.
|
|
|
|
+ AC_CACHE_CHECK([for -nopie option],
|
|
|
|
+ [gcc_cv_nopie],
|
|
|
|
+ [saved_LDFLAGS="$LDFLAGS"
|
|
|
|
+ LDFLAGS="$LDFLAGS -nopie"
|
|
|
|
+ AC_LINK_IFELSE([int main(void) {return 0;}],
|
|
|
|
+ [gcc_cv_nopie=yes],
|
|
|
|
+ [gcc_cv_nopie=no])
|
|
|
|
+ LDFLAGS="$saved_LDFLAGS"])
|
|
|
|
+ if test "$gcc_cv_nopie" = "yes"; then
|
|
|
|
+ NO_PIE_FLAG="-nopie"
|
|
|
|
+ fi
|
|
|
|
fi
|
|
|
|
AC_SUBST([NO_PIE_FLAG])
|
|
|
|
|
|
|
|
--
|
2021-11-29 07:07:20 +00:00
|
|
|
2.34.0
|
2018-12-12 17:14:55 +00:00
|
|
|
|