This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Weaken PIE configure test to a compile test


One remaining configure test that produces different results in
bootstrap builds because it tries linking against a preexisting libc
is the test for position-independent executable support.

I propose this patch, weakening it to a compile test.  (Really it
could probably be eliminated completely and PIE support hardwired to
be on; this is just a more conservative patch, and only fairly limited
cleanups are made possible through hardwiring PIE support on.)  If for
some reason PIE support is problematic for an architecture it's
certainly better for GCC to diagnose that at compile time rather than
accept the option and then fail to link.  But given PIC support, there
isn't much more involved in PIE support, and part of what is involved
is bits of statically linked libc code being suitable for linking into
PIEs - something that of course is a property of the newly built libc,
not the old one.

Tested x86_64.  I am not aware of any systems supported by libc or
ports that do not support PIEs.  (EGLIBC has hardwired the answer to
this test to "yes" for the past five years and I see no sign of Debian
having needed to revert that for any system.)

2012-05-28  Joseph Myers  <joseph@codesourcery.com>

	* configure.in (libc_cv_fpie): Weaken to a compile test using
	LIBC_TRY_CC_OPTION.
	* configure: Regenerated.

diff --git a/configure.in b/configure.in
index 6fac085..81b14c9 100644
--- a/configure.in
+++ b/configure.in
@@ -1618,18 +1618,8 @@ rm -f conftest*])
 AC_SUBST(libc_cv_z_execstack)
 
 AC_CACHE_CHECK(for -fpie, libc_cv_fpie, [dnl
-cat > conftest.c <<EOF
-int foo;
-main () { return 0;}
-EOF
-if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS -pie -fpie
-			    -o conftest conftest.c 1>&AS_MESSAGE_LOG_FD])
-then
-  libc_cv_fpie=yes
-else
-  libc_cv_fpie=no
-fi
-rm -f conftest*])
+LIBC_TRY_CC_OPTION([-fpie], [libc_cv_fpie=yes], [libc_cv_fpie=no])
+])
 
 AC_SUBST(libc_cv_fpie)
 

-- 
Joseph S. Myers
joseph@codesourcery.com


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]