libperl leaks a THREAD_KEY each time it is reloaded
[p5sagit/p5-mst-13.2.git] / makedef.pl
index 8a9953c..256eddd 100644 (file)
@@ -55,6 +55,7 @@ my $global_sym  = "global.sym";
 my $pp_sym      = "pp.sym";
 my $globvar_sym = "globvar.sym";
 my $perlio_sym  = "perlio.sym";
+my $static_ext = "";
 
 if ($PLATFORM eq 'aix') {
     # Nothing for now.
@@ -88,6 +89,13 @@ unless ($PLATFORM eq 'win32' || $PLATFORM eq 'wince' || $PLATFORM eq 'MacOS' ||
     }
     close(CFG);
 }
+if ($PLATFORM eq 'win32' || $PLATFORM eq 'wince') {
+    open(CFG,"<..\\$config_sh") || die "Cannot open ..\\$config_sh: $!\n";
+    if ((join '', <CFG>) =~ /^static_ext='(.*)'$/m) {
+        $static_ext = $1;
+    }
+    close(CFG);
+}
 
 open(CFG,$config_h) || die "Cannot open $config_h: $!\n";
 while (<CFG>) {
@@ -295,7 +303,6 @@ if ($PLATFORM eq 'wince') {
                     Perl_sv_collxfrm
                     setgid
                     setuid
-                    win32_async_check
                     win32_free_childdir
                     win32_free_childenv
                     win32_get_childdir
@@ -378,6 +385,8 @@ elsif ($PLATFORM eq 'os2') {
                    dlsym
                    dlerror
                    dlclose
+                   dup2
+                   dup
                    my_tmpfile
                    my_tmpnam
                    my_flock
@@ -399,6 +408,10 @@ elsif ($PLATFORM eq 'os2') {
                    nthreads_cond
                    os2_cond_wait
                    os2_stat
+                   os2_execname
+                   async_mssleep
+                   msCounter
+                   InfoTable
                    pthread_join
                    pthread_create
                    pthread_detach
@@ -583,14 +596,6 @@ unless ($define{'PERL_COPY_ON_WRITE'}) {
                  )];
 }
 
-unless ($define{'PERL_FLEXIBLE_EXCEPTIONS'}) {
-    skip_symbols [qw(
-                   PL_protect
-                   Perl_default_protect
-                   Perl_vdefault_protect
-                   )];
-}
-
 unless ($define{'USE_REENTRANT_API'}) {
     skip_symbols [qw(
                    PL_reentrant_buffer
@@ -603,6 +608,8 @@ if ($define{'MYMALLOC'}) {
                    Perl_get_mstats
                    Perl_strdup
                    Perl_putenv
+                   MallocCfg_ptr
+                   MallocCfgP_ptr
                    )];
     if ($define{'USE_ITHREADS'}) {
        emit_symbols [qw(
@@ -621,6 +628,14 @@ else {
                    Perl_dump_mstats
                    Perl_get_mstats
                    Perl_malloced_size
+                   MallocCfg_ptr
+                   MallocCfgP_ptr
+                   )];
+}
+
+if ($define{'PERL_MALLOC_WRAP'}) {
+    emit_symbols [qw(
+                   PL_memory_wrap
                    )];
 }
 
@@ -733,6 +748,8 @@ unless ($define{'PL_OP_SLAB_ALLOC'}) {
                      PL_OpPtr
                      PL_OpSlab
                      PL_OpSpace
+                    Perl_Slab_Alloc
+                    Perl_Slab_Free
                     )];
 }
 
@@ -779,6 +796,7 @@ my @layer_syms = qw(
                    PerlIOBase_noop_fail
                    PerlIOBase_noop_ok
                    PerlIOBase_popped
+                   PerlIOBase_pushed
                    PerlIOBase_read
                    PerlIOBase_setlinebuf
                    PerlIOBase_unread
@@ -800,10 +818,12 @@ my @layer_syms = qw(
                    PerlIOBuf_unread
                    PerlIOBuf_write
                    PerlIO_allocate
+                   PerlIO_apply_layera
                    PerlIO_apply_layers
                    PerlIO_arg_fetch
                    PerlIO_debug
                    PerlIO_define_layer
+                   PerlIO_isutf8
                    PerlIO_layer_fetch
                    PerlIO_list_free
                    PerlIO_modestr
@@ -1018,6 +1038,7 @@ if ($PLATFORM =~ /^win(?:32|ce)$/) {
                            win32_pclose
                            win32_rename
                            win32_setmode
+                           win32_chsize
                            win32_lseek
                            win32_tell
                            win32_dup
@@ -1324,6 +1345,15 @@ foreach my $symbol (qw(
     }
 }
 
+# records of type boot_module for statically linked modules (except Dynaloader)
+$static_ext =~ s/\//__/g;
+$static_ext =~ s/\bDynaLoader\b//;
+my @stat_mods = map {"boot_$_"} grep {/\S/} split /\s+/, $static_ext;
+foreach my $symbol (@stat_mods)
+    {
+       try_symbol($symbol);
+    }
+
 # Now all symbols should be defined because
 # next we are going to output them.
 
@@ -1332,7 +1362,14 @@ foreach my $symbol (sort keys %export) {
 }
 
 if ($PLATFORM eq 'os2') {
-       print "; LAST_ORDINAL=$sym_ord\n";
+       print <<EOP;
+    dll_perlmain=main
+    fill_extLibpath
+    dir_subst
+    Perl_OS2_handler_install
+
+; LAST_ORDINAL=$sym_ord
+EOP
 }
 
 sub emit_symbol {