develooper Front page | perl.perl5.porters | Postings from June 2008

[perl #51762] PERL_NO_SHORT_NAMES incompatible with perl.h

From:
Bram via RT
Date:
June 29, 2008 10:56
Subject:
[perl #51762] PERL_NO_SHORT_NAMES incompatible with perl.h
Message ID:
rt-3.6.HEAD-6656-1214734939-1594.51762-15-0@perl.org
On Sat Mar 15 03:49:59 2008, mfowler wrote:
> This is a bug report for perl from michael@shoebox.net,
> generated with the help of perlbug 1.35 running under perl v5.8.8.
> 
> 
> -----------------------------------------------------------------
> [Please enter your report here]
> 
> 
> perl.h (at the very least) isn't fully compatible with the
> PERL_NO_SHORT_NAMES define.
> 
> The immediately obvious offender is MALLOC_CHECK_TAINT in perl.h.  It
>    uses
> doing_taint, instead of Perl_doing_taint.  When attempting to compile
>    using
> PERL_NO_SHORT_NAMES and MYMALLOC defined this results in doing_taint
>    being
> implicitly declared, and subsequent linking fails.
> 
> For example, given the example from perlembed:
> 
>     #include <EXTERN.h>
>     #include <perl.h>
> 
>     static PerlInterpreter *my_perl;
> 
>     int main(int argc, char **argv, char **env)
>     {
>         PERL_SYS_INIT3(&argc,&argv,&env);
>         my_perl = perl_alloc();
>         perl_construct(my_perl);
>         PL_exit_flags |= PERL_EXIT_DESTRUCT_END;
>         perl_parse(my_perl, NULL, argc, argv, (char **)NULL);
>         perl_run(my_perl);
>         perl_destruct(my_perl);
>         perl_free(my_perl);
>         PERL_SYS_TERM();
>         return 1;
>     }
> 
> 
> Compiled with:
> 
>     $ gcc -Wall -o interp interp.c `perl -MExtUtils::Embed -e ccopts
>    -e ldopts`
> 
> results in no errors.  However, compiled with:
> 
>     $ gcc -DMYMALLOC -DPERL_NO_SHORT_NAMES -Wall -o interp interp.c
>       `perl -MExtUtils::Embed -e ccopts -e ldopts`
> 
> results in the errors:
> 
>     interp.c: In function 'main':
>     interp.c:10: warning: implicit declaration of function
>    'doing_taint'
>     /tmp/cchPQGD6.o: In function `main':
>     interp.c:(.text+0x2f): undefined reference to `doing_taint'
>     interp.c:(.text+0x38): undefined reference to `MallocCfg_ptr'
>     interp.c:(.text+0x69): undefined reference to `PL_malloc_mutex'
>     interp.c:(.text+0x162): undefined reference to `PL_malloc_mutex'
>     collect2: ld returned 1 exit status
> 
> (My perl was not compiled with usemymalloc, which explains the other
> undefined references.)
> 
> From reading the 5.10 sources, it appears perl.h has the same problem
>    there.
> 

Can you try this with perl 5.10.0 and/or blead?

gcc -DMYMALLOC -DPERL_NO_SHORT_NAMES -Wall -o interp interp.c `/opt/
perl/bin/perl5100 -MExtUtils::Embed -e ccopts -e ldopts`

(no output)


gcc -DMYMALLOC -DPERL_NO_SHORT_NAMES -Wall -o interp interp.c `/opt/
perl/bin/perl588 -MExtUtils::Embed -e ccopts -e ldopts`
interp.c: In function `main':
interp.c:8: warning: implicit declaration of function `doing_taint'
/tmp/cc3u9yvu.o(.text+0x28): In function `main':
: undefined reference to `doing_taint'
/tmp/cc3u9yvu.o(.text+0x34): In function `main':
: undefined reference to `MallocCfg_ptr'
collect2: ld returned 1 exit status


Looking at the Changes of 5.10.0 I see:

[ 19882] By: rgs                           on 2003/06/29  13:17:09
        Log: Perl_doing_taint must be public, for programs that embed 
perl
     Branch: perl
           ! embed.fnc embed.h global.sym


Which correspondences with:
http://public.activestate.com/cgi-bin/perlbrowse/p/19882


Kind regards,

Bram



nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About