Android only runs PIE executables, and linking non-PIE host tools (cc1,
cc1plus, ...) overflows the aarch64 copy relocation for stderr.
Treat *-*-android* like Darwin: default host_pie to yes, force it on
when --disable-host-pie is given, and forward --enable-host-pie to the
gcc directory.
ChangeLog:
* configure.ac: Default to PIE on an Android host.
* configure: Regenerate.
---
configure | 14 ++++++++++++++
configure.ac | 13 +++++++++++++
2 files changed, 27 insertions(+)
diff --git a/configure b/configure
index df39d3ef032..01354e6466f 100755
--- a/configure
+++ b/configure
@@ -9828,6 +9828,15 @@ $as_echo "$as_me: WARNING: PIE executables are required
for the configured host,
host_pie=yes
gcc_host_pie=--enable-host-pie
fi ;;
+ *-*-android*)
+ if test x$host_pie != xyes ; then
+ # Android only runs PIE executables.
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: PIE executables are
required for an Android host, host-pie setting ignored." >&5
+$as_echo "$as_me: WARNING: PIE executables are required for an Android host,
host-pie setting ignored." >&2;}
+ fi
+ host_pie=yes
+ gcc_host_pie=--enable-host-pie
+ ;;
*) ;;
esac
else
@@ -9837,6 +9846,11 @@ else
host_pie=yes
gcc_host_pie=--enable-host-pie
;;
+ *-*-android*)
+ # Android only runs PIE executables.
+ host_pie=yes
+ gcc_host_pie=--enable-host-pie
+ ;;
*) host_pie=no ;;
esac
fi
diff --git a/configure.ac b/configure.ac
index fa48409f7a3..2c7601a384d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2103,6 +2103,14 @@ AC_ARG_ENABLE(host-pie,
host_pie=yes
gcc_host_pie=--enable-host-pie
fi ;;
+ *-*-android*)
+ if test x$host_pie != xyes ; then
+ # Android only runs PIE executables.
+ AC_MSG_WARN([PIE executables are required for an Android host, host-pie
setting ignored.])
+ fi
+ host_pie=yes
+ gcc_host_pie=--enable-host-pie
+ ;;
*) ;;
esac],
[case $host in
@@ -2111,6 +2119,11 @@ AC_ARG_ENABLE(host-pie,
host_pie=yes
gcc_host_pie=--enable-host-pie
;;
+ *-*-android*)
+ # Android only runs PIE executables.
+ host_pie=yes
+ gcc_host_pie=--enable-host-pie
+ ;;
*) host_pie=no ;;
esac])
--
2.56.0