about summary refs log tree commit diff
path: root/configure.ac
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2017-12-18 12:24:26 -0800
committerH.J. Lu <hjl.tools@gmail.com>2017-12-18 12:24:38 -0800
commit00c714df398b63934540d95ce3792596f7a94a6c (patch)
treef96ed5735a44f5a6afff6efafe5dc86f1b93fecb /configure.ac
parent8e1472d2c1e25e6eabc2059170731365f6d5b3d1 (diff)
downloadglibc-00c714df398b63934540d95ce3792596f7a94a6c.tar.gz
glibc-00c714df398b63934540d95ce3792596f7a94a6c.tar.xz
glibc-00c714df398b63934540d95ce3792596f7a94a6c.zip
Pass -no-pie to GCC only if GCC defaults to PIE [BZ #22614]
After --enable-static-pie is added to configure, libc_cv_pie_default is
set to yes when either --enable-static-pie is used to configure glibc
or GCC defaults to PIE.  We should set no-pie-ldflag to -no-pie, which
is supported on GCC 6 and later, only if GCC defaults to PIE, not when
--enable-static-pie is used to configure glibc.

Tested on x32 with --enable-static-pie using GCC 5 and without
--enable-static-pie using GCC 7.

	[BZ #22614]
	* Makeconfig (no-pie-ldflag): Set to -no-pie only if
	$(cc-pie-default) == yes.
	* config.make.in (cc-pie-default): New.
	* configure.ac (libc_cv_pie_default): Renamed to ...
	(libc_cv_cc_pie_default): This.
	(libc_cv_pie_default): Set to $libc_cv_cc_pie_default.
	* configure: Regenerated.
Diffstat (limited to 'configure.ac')
-rw-r--r--configure.ac8
1 files changed, 5 insertions, 3 deletions
diff --git a/configure.ac b/configure.ac
index 8e4006f0a9..ca1282a6b3 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1794,17 +1794,19 @@ fi
 rm -f conftest.*])
 AC_SUBST(libc_cv_pic_default)
 
-AC_CACHE_CHECK([whether -fPIE is default], libc_cv_pie_default,
-[libc_cv_pie_default=yes
+AC_CACHE_CHECK([whether -fPIE is default], libc_cv_cc_pie_default,
+[libc_cv_cc_pie_default=yes
 cat > conftest.c <<EOF
 #if defined __PIE__ || defined __pie__ || defined PIE || defined pie
 # error PIE is default.
 #endif
 EOF
 if eval "${CC-cc} -S conftest.c 2>&AS_MESSAGE_LOG_FD 1>&AS_MESSAGE_LOG_FD"; then
-  libc_cv_pie_default=no
+  libc_cv_cc_pie_default=no
 fi
 rm -f conftest.*])
+libc_cv_pie_default=$libc_cv_cc_pie_default
+AC_SUBST(libc_cv_cc_pie_default)
 AC_SUBST(libc_cv_pie_default)
 
 # Set the `multidir' variable by grabbing the variable from the compiler.