On Thu, Sep 16, 2004 at 06:31:56AM -0700, Rasmus Lerdorf wrote: > On Thu, 16 Sep 2004, Joe Orton wrote: > > > On Thu, Sep 16, 2004 at 12:39:39PM +0200, Sascha Schumann wrote: > > > The point is that the current behaviour needs to be retained > > > for installations which would be negatively affected by your > > > patch. Building non-PIC as default is ok, if a switch is > > > provided to build PIC. > > > > Ah, gotcha. Any preference as to flag name? --disable-non-pic would be > > an obvious choice, confusing double negative though. > > There is already a --without-pic/--with-pic flag that just doesn't work. > I'd key it off of that.
It doesn't work because PHP prevents AC_PROG_LIBTOOL from interpreting it by doing "unset with_pic". So one solution would be to remove that hack and in the case where --with-pic or --without-pic is passed to configure, never explicitly specify a pic "preference" to the libtool script. And make the default as if "--without-pic" was passed in the x86* whitelist. 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 14:07:03 -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,21 @@ CPPFLAGS="$CPPFLAGS -D_XPG_IV";; esac +# Disable PIC mode by default where it is known to be safe to do so, +# to avoid the performance hit from the lost register +AC_MSG_CHECKING([whether to force non-PIC code in shared modules]) +case $host_alias in +i?86-*-linux*|i?86-*-freebsd*) + if test "${with_pic+set}" != "set"; then + with_pic=no + AC_MSG_RESULT(yes) + else + AC_MSG_RESULT(no) + fi + ;; +*) AC_MSG_RESULT(no) ;; +esac + dnl Include Zend and TSRM configurations. dnl ------------------------------------------------------------------------- @@ -850,7 +865,6 @@ enable_shared=yes enable_static=yes -unset with_pic case $php_build_target in program|static) @@ -861,7 +875,9 @@ ;; shared) enable_static=no - standard_libtool_flag=-prefer-pic + if test "${with_pic+set}" != set; then + standard_libtool_flag='-prefer-pic' + fi 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 14:07:03 -0000 @@ -772,11 +772,16 @@ php_cxx_post=' && echo > [EMAIL PROTECTED]' php_lo=o + if test "${with_pic+set}" = set; then + shared_c_meta='$(COMMON_FLAGS) $(CFLAGS_CLEAN) $(EXTRA_CFLAGS)' + shared_cxx_meta='$(COMMON_FLAGS) $(CXXFLAGS_CLEAN) $(EXTRA_CXXFLAGS)' + 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,15 @@ install_modules="install-modules" PHP_MODULES="$PHP_MODULES \$(phplibdir)/$1.la" PHP_SUBST($2) + if test ${with_pic+set} != set; then + php_shared_picflag="-prefer-pic" + fi cat >>Makefile.objects<<EOF \$(phplibdir)/$1.la: $3/$1.la \$(LIBTOOL) --mode=install cp $3/$1.la \$(phplibdir) $3/$1.la: \$($2) \$(translit($1,a-z_-,A-Z__)_SHARED_DEPENDENCIES) - \$(LIBTOOL) --mode=link ifelse($4,,[\$(CC)],[\$(CXX)]) \$(COMMON_FLAGS) \$(CFLAGS_CLEAN) \$(EXTRA_CFLAGS) \$(LDFLAGS) -o \[$]@ -export-dynamic -avoid-version -prefer-pic -module -rpath \$(phplibdir) \$(EXTRA_LDFLAGS) \$($2) \$(translit($1,a-z_-,A-Z__)_SHARED_LIBADD) + \$(LIBTOOL) --mode=link ifelse($4,,[\$(CC)],[\$(CXX)]) \$(COMMON_FLAGS) \$(CFLAGS_CLEAN) \$(EXTRA_CFLAGS) \$(LDFLAGS) -o \[$]@ -export-dynamic -avoid-version $php_shared_picflag -module -rpath \$(phplibdir) \$(EXTRA_LDFLAGS) \$($2) \$(translit($1,a-z_-,A-Z__)_SHARED_LIBADD) EOF ]) -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php