Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:12854 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 66366 invoked by uid 1010); 16 Sep 2004 09:39:02 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 66304 invoked from network); 16 Sep 2004 09:39:02 -0000 Received: from unknown (HELO mx1.redhat.com) (66.187.233.31) by pb1.pair.com with SMTP; 16 Sep 2004 09:39:02 -0000 Received: from int-mx1.corp.redhat.com (int-mx1.corp.redhat.com [172.16.52.254]) by mx1.redhat.com (8.12.11/8.12.10) with ESMTP id i8G9d2Dg000480 for ; Thu, 16 Sep 2004 05:39:02 -0400 Received: from radish.cambridge.redhat.com (radish.cambridge.redhat.com [172.16.18.90]) by int-mx1.corp.redhat.com (8.11.6/8.11.6) with ESMTP id i8G9d1r07368 for ; Thu, 16 Sep 2004 05:39:01 -0400 Received: from radish.cambridge.redhat.com (localhost.localdomain [127.0.0.1]) by radish.cambridge.redhat.com (8.12.10/8.12.7) with ESMTP id i8G9d0NE006964 for ; Thu, 16 Sep 2004 10:39:00 +0100 Received: (from jorton@localhost) by radish.cambridge.redhat.com (8.12.10/8.12.10/Submit) id i8G9d0TN006963 for internals@lists.php.net; Thu, 16 Sep 2004 10:39:00 +0100 Date: Thu, 16 Sep 2004 10:39:00 +0100 To: internals@lists.php.net Message-ID: <20040916093900.GA6842@redhat.com> Mail-Followup-To: internals@lists.php.net Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline User-Agent: Mutt/1.4.1i Subject: [PATCH] use -prefer-non-pic on x86-{freebsd,linux} From: jorton@redhat.com (Joe Orton) This is Rasmus' patch but only enabled on platforms where it's known to work. Applies to HEAD: the apache2handler SAPI builds and loads a shared extension OK like this on Linux/i686. It looks like some people preferred a configure flag for this and some preferred to do it by default. Consensus? Index: configure.in =================================================================== RCS file: /repository/php-src/configure.in,v retrieving revision 1.516 diff -u -r1.516 configure.in --- configure.in 21 Jul 2004 23:02:28 -0000 1.516 +++ configure.in 16 Sep 2004 09:26:39 -0000 @@ -1,4 +1,4 @@ -dnl ## $Id: configure.in,v 1.516 2004/07/21 23:02:28 edink Exp $ -*- sh -*- +dnl ## $Id: configure.in,v 1.516 2004/07/21 23:02:28 edink Exp $ -*- autoconf -*- dnl ## Process this file with autoconf to produce a configure script. divert(1) @@ -222,6 +222,19 @@ CPPFLAGS="$CPPFLAGS -D_XPG_IV";; esac +AC_MSG_CHECKING([whether to force non-PIC code in shared modules]) +# Disable PIC where it is known to be safe to do so, +# to avoid the performance hit from the lost register +case $host_alias in +i?86-*-linux*|i?86-*-freebsd*) + force_nonpic=yes + ;; +*) + force_nonpic=no + ;; +esac +AC_MSG_RESULT([$force_nonpic]) + dnl Include Zend and TSRM configurations. dnl ------------------------------------------------------------------------- @@ -860,8 +873,12 @@ fi ;; shared) + if test $force_nonpic = yes; then + standard_libtool_flag='-prefer-non-pic' + else + standard_libtool_flag='-prefer-pic' + fi enable_static=no - standard_libtool_flag=-prefer-pic EXTRA_LDFLAGS="$EXTRA_LDFLAGS -avoid-version -module" ;; esac Index: acinclude.m4 =================================================================== RCS file: /repository/php-src/acinclude.m4,v retrieving revision 1.273 diff -u -r1.273 acinclude.m4 --- acinclude.m4 12 Sep 2004 06:35:51 -0000 1.273 +++ acinclude.m4 16 Sep 2004 09:26:39 -0000 @@ -772,11 +772,16 @@ php_cxx_post=' && echo > $[@]' php_lo=o + if test $force_nonpic = yes; then + shared_c_meta='$(COMMON_FLAGS) $(CFLAGS_CLEAN) $(EXTRA_CFLAGS) -prefer-non-pic' + shared_cxx_meta='$(COMMON_FLAGS) $(CXXFLAGS_CLEAN) $(EXTRA_CXXFLAGS) -prefer-non-pic' + else + shared_c_meta='$(COMMON_FLAGS) $(CFLAGS_CLEAN) $(EXTRA_CFLAGS) -prefer-pic' + shared_cxx_meta='$(COMMON_FLAGS) $(CXXFLAGS_CLEAN) $(EXTRA_CXXFLAGS) -prefer-pic' + fi shared_c_pre='$(LIBTOOL) --mode=compile $(CC)' - shared_c_meta='$(COMMON_FLAGS) $(CFLAGS_CLEAN) $(EXTRA_CFLAGS) -prefer-pic' shared_c_post= shared_cxx_pre='$(LIBTOOL) --mode=compile $(CXX)' - shared_cxx_meta='$(COMMON_FLAGS) $(CXXFLAGS_CLEAN) $(EXTRA_CXXFLAGS) -prefer-pic' shared_cxx_post= shared_lo=lo @@ -1158,12 +1163,17 @@ install_modules="install-modules" PHP_MODULES="$PHP_MODULES \$(phplibdir)/$1.la" PHP_SUBST($2) + if test $force_nonpic = yes; then + php_shared_picflag="-prefer-non-pic" + else + php_shared_picflag="-prefer-pic" + fi cat >>Makefile.objects<