You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Jarkko Hietaniemi <jh...@iki.fi> on 2001/03/14 00:10:41 UTC

Re: [gsar@ActiveState.com: v5.6.1 trial2 is available]

Hi,

sorry for not answering sooner.  The suggested patch seems to work
find with the development branch of Perl, and I believe Sarathy
will apply the patch also to the maintenance branch.

On Wed, Feb 21, 2001 at 09:32:04PM +0100, Jens-Uwe Mager wrote:
> On Fri, Feb 16, 2001 at 05:44:34PM +0100, Ciaran.Deignan@bull.net wrote:
> > On Fri, 16 Feb 2001 Ciaran.Deignan@bull.net wrote:
> > 
> > > Hi Jarkko,
> > >
> > > > > I'll try to do one or two more builds. I'd really like to try it with
> > > > > Apache's mod_perl and mod_embed, these really didn't work at all with
> > > > > perl-5.6.0, but I'm not sure I'll find the time.
> > 
> > [AIX-4.3.2, IBM's C compiler, Apache apxs shared modules]
> > 
> > I tried to get mod_perl-1.25 (an Apache/perl module that's
> > supposed to let you use perl to implement script-based apache modules)
> > working with perl-5.6.1-trial2, and failed. I can get mod_perl
> > working with perl-5.5.3, but I never succeeded with perl-5.6.0.
> > 
> > With perl-5.6.1-trial2, the mod-perl initialisation is successful, but I
> > get a segmentation fault as soon as I try to access the perl script
> > (test.pl or test.perl).
> 
> A short while ago the Apache distribution did change over to the native
> dlopen library if the AIX version 4.3 and above. For previous versions
> the dlopen emulation layer is still used. Perl does always use the
> emulation, which produces a conflict if Apache uses the native one in
> the modperl case. I attach a patch below that changes the perl
> distribution to also use the native AIX dlopen on AIX 4.3 and above as
> in the Apache case.
> 
> For getting some more involved modperl modules like Embperl to work we
> probably need to change the modperl.exp file to include the magic "#! ."
> instead of simply "#!" at the beginning, this signals the native dlopen
> to import symbols from the main program. The patch already does that in
> makedef.pl for the perl.exp file, but only on AIX 4.3 and above because
> the older AIX linkers do strange things if this option is used.
> 
> -- 
> Jens-Uwe Mager
> 
> HELIOS Software GmbH
> Steinriede 3
> 30827 Garbsen
> Germany
> 
> Phone:		+49 5131 709320
> FAX:		+49 5131 709325
> Internet:	jum@helios.de

> --- perl-5.6.1-TRIAL2/ext/DynaLoader/dl_aix.xs.orig	Wed Feb 21 19:45:18 2001
> +++ perl-5.6.1-TRIAL2/ext/DynaLoader/dl_aix.xs	Wed Feb 21 21:16:53 2001
> @@ -14,6 +14,21 @@
>  #define PERLIO_NOT_STDIO 0
>  
>  /*
> + * On AIX 4.3 and above the emulation layer is not needed any more, and
> + * indeed if perl uses its emulation and perl is linked into apache
> + * which is supposed to use the native dlopen conflicts arise.
> + * Jens-Uwe Mager jum@helios.de
> + */
> +#ifdef USE_NATIVE_DLOPEN
> +
> +#include "EXTERN.h"
> +#include "perl.h"
> +#include "XSUB.h"
> +#include <dlfcn.h>
> +
> +#else
> +
> +/*
>   * @(#)dlfcn.c	1.5 revision of 93/02/14  20:14:17
>   * This is an unpublished work copyright (c) 1992 Helios Software GmbH
>   * 3000 Hannover 1, Germany
> @@ -89,6 +104,13 @@
>  # define FREAD(p,s,n,ldptr)	fread(p,s,n,IOPTR(ldptr))
>  #endif
>  
> +#ifndef RTLD_LAZY
> +# define RTLD_LAZY 0
> +#endif
> +#ifndef RTLD_GLOBAL
> +# define RTLD_GLOBAL 0
> +#endif
> +
>  /*
>   * We simulate dlopen() et al. through a call to load. Because AIX has
>   * no call to find an exported symbol we read the loader section of the
> @@ -627,6 +649,7 @@
>  	safefree(buf);
>  	return ret;
>  }
> +#endif /* USE_NATIVE_DLOPEN */
>  
>  /* dl_dlopen.xs
>   * 
> @@ -672,7 +695,7 @@
>  	DLDEBUG(1,PerlIO_printf(Perl_debug_log, "dl_load_file(%s,%x):\n", filename,flags));
>  	if (flags & 0x01)
>  	    Perl_warn(aTHX_ "Can't make loaded symbols global on this platform while loading %s",filename);
> -	RETVAL = dlopen(filename, 1) ;
> +	RETVAL = dlopen(filename, RTLD_GLOBAL|RTLD_LAZY) ;
>  	DLDEBUG(2,PerlIO_printf(Perl_debug_log, " libref=%x\n", RETVAL));
>  	ST(0) = sv_newmortal() ;
>  	if (RETVAL == NULL)
> --- perl-5.6.1-TRIAL2/hints/aix.sh.orig	Wed Feb 21 19:39:30 2001
> +++ perl-5.6.1-TRIAL2/hints/aix.sh	Wed Feb 21 19:45:00 2001
> @@ -55,9 +55,11 @@
>  case "$osvers" in
>     3.*|4.1.*|4.2.*)
>        usenm='undef'
> +      usenativedlopen='false'
>        ;;
>     *)
>        usenm='true'
> +      usenativedlopen='true'
>        ;;
>  esac
>  
> @@ -405,20 +407,25 @@
>  esac
>  EOCBU
>  
> -# If the C++ libraries, libC and libC_r, are available we will prefer them
> -# over the vanilla libc, because the libC contain loadAndInit() and
> -# terminateAndUnload() which work correctly with C++ statics while libc
> -# load() and unload() do not.  See ext/DynaLoader/dl_aix.xs.
> -# The C-to-C_r switch is done by usethreads.cbu, if needed.
> -if test -f /lib/libC.a -a X"`$cc -v 2>&1 | grep gcc`" = X; then
> -    # Cify libswanted.
> -    set `echo X "$libswanted "| sed -e 's/ c / C c /'`
> -    shift
> -    libswanted="$*"
> -    # Cify lddlflags.
> -    set `echo X "$lddlflags "| sed -e 's/ -lc / -lC -lc /'`
> -    shift
> -    lddlflags="$*"
> +if test $usenativedlopen = 'true'
> +then
> +        ccflags="$ccflags -DUSE_NATIVE_DLOPEN"
> +else
> +    # If the C++ libraries, libC and libC_r, are available we will prefer them
> +    # over the vanilla libc, because the libC contain loadAndInit() and
> +    # terminateAndUnload() which work correctly with C++ statics while libc
> +    # load() and unload() do not.  See ext/DynaLoader/dl_aix.xs.
> +    # The C-to-C_r switch is done by usethreads.cbu, if needed.
> +    if test -f /lib/libC.a -a X"`$cc -v 2>&1 | grep gcc`" = X; then
> +	# Cify libswanted.
> +	set `echo X "$libswanted "| sed -e 's/ c / C c /'`
> +	shift
> +	libswanted="$*"
> +	# Cify lddlflags.
> +	set `echo X "$lddlflags "| sed -e 's/ -lc / -lC -lc /'`
> +	shift
> +	lddlflags="$*"
> +    fi
>  fi
>  
>  # EOF
> --- perl-5.6.1-TRIAL2/makedef.pl.orig	Wed Feb 21 19:06:38 2001
> +++ perl-5.6.1-TRIAL2/makedef.pl	Wed Feb 21 19:06:42 2001
> @@ -165,7 +165,15 @@
>  ---EOP---
>  }
>  elsif ($PLATFORM eq 'aix') {
> -    print "#!\n";
> +    $OSVER = `uname -v`;
> +    chop $OSVER;
> +    $OSREL = `uname -r`;
> +    chop $OSREL;
> +    if ($OSVER > 4 || ($OSVER == 4 && $OSREL >= 3)) {
> +	print "#! .\n";
> +    } else {
> +	print "#!\n";
> +    }
>  }
>  
>  my %skip;


-- 
$jhi++; # http://www.iki.fi/jhi/
        # There is this special biologist word we use for 'stable'.
        # It is 'dead'. -- Jack Cohen

Re: [gsar@ActiveState.com: v5.6.1 trial2 is available]

Posted by Jens-Uwe Mager <ju...@helios.de>.
On Tue, Mar 13, 2001 at 05:57:20PM -0800, Gurusamy Sarathy wrote:
> There is a change in behavior here that looks somewhat suspect
> because the comments didn't mention it.
> 
> >On Wed, Feb 21, 2001 at 09:32:04PM +0100, Jens-Uwe Mager wrote:
> >> +#ifdef USE_NATIVE_DLOPEN
> [...]
> >> +#else
> [...]
> >> +#ifndef RTLD_LAZY
> >> +# define RTLD_LAZY 0
> >> +#endif
> >> +#ifndef RTLD_GLOBAL
> >> +# define RTLD_GLOBAL 0
> >> +#endif
> [...]
> >> -	RETVAL = dlopen(filename, 1) ;
> >> +	RETVAL = dlopen(filename, RTLD_GLOBAL|RTLD_LAZY) ;
> 
> It seems to me that dlopen() is now being called with a second
> argument of 0 instead of 1 if USE_NATIVE_DLOPEN wasn't set and
> those two constants aren't defined in the system headers.
> 
> Is this an intentional change?  Does it have potential to break
> anything on the pre-4.3 AIX versions?

If you look in the source you will see that the mode argument of dlopen
is not used at all in the dlopen emulation case, the argument "1" was
not used in the previous version at all. And in fact in the dlopen
emulator case there was no definition for the mode constants at all. I
did change the arguments so the dlopen call can be used in both cases,
with the emulator and with the native dlopen.

-- 
Jens-Uwe Mager

HELIOS Software GmbH
Steinriede 3
30827 Garbsen
Germany

Phone:		+49 5131 709320
FAX:		+49 5131 709325
Internet:	jum@helios.de