In perl.git, the branch blead has been updated

<http://perl5.git.perl.org/perl.git/commitdiff/538c35adb246109e8617e5ef821061ca1958bc66?hp=58cc991cef605c5daf03cb2abcfea200a46d3614>

- Log -----------------------------------------------------------------
commit 538c35adb246109e8617e5ef821061ca1958bc66
Merge: 58cc991 dcfa750
Author: Tony Cook <t...@develop-help.com>
Date:   Thu Jan 16 15:37:27 2014 +1100

    [perl #89502] improved FreeMINT support

commit dcfa7505f02754d9e15a4fdc725df3b60cf57c06
Author: Tony Cook <t...@develop-help.com>
Date:   Thu Jan 16 15:11:50 2014 +1100

    describe the level of FreeMINT support

M       pod/perlport.pod

commit 16ef6ddfef6c2f8ca35702aceff4a7d27ce94c01
Author: Tony Cook <t...@develop-help.com>
Date:   Fri Nov 15 11:56:46 2013 +1100

    add Alan Hourihane to AUTHORS

M       AUTHORS

commit fa1b2c4275e53adb349f1a988aec8a194d8763f3
Author: Alan Hourihane <al...@fairlite.co.uk>
Date:   Fri Nov 15 11:53:16 2013 +1100

    new freemint hints file

M       MANIFEST
A       hints/freemint.sh

commit cbc0b8140a1ef2e1a7119bb461f48395a4a8fc4d
Author: Alan Hourihane <al...@fairlite.co.uk>
Date:   Fri Nov 15 11:37:52 2013 +1100

    freemint doesn't need the extra -lm -lposix either

M       ext/POSIX/Makefile.PL

commit f48d8d9daf0f92cffbbef9a80e5f2c4d260c320c
Author: Alan Hourihane <al...@fairlite.co.uk>
Date:   Fri Nov 15 11:30:50 2013 +1100

    fix some linuxisms and RETVAL warnings from xsubpp
    
    Original patch by Alan, modified by Tony Cook to remove unused return
    types.

M       ext/DynaLoader/dl_freemint.xs

commit 817bb5726ea19a5cf60d1aa249e44880d3267fab
Author: Tony Cook <t...@develop-help.com>
Date:   Mon Nov 11 11:45:40 2013 +1100

    [perl #89502] support for dld on Atari FreeMINT

M       MANIFEST
A       ext/DynaLoader/dl_freemint.xs
-----------------------------------------------------------------------

Summary of changes:
 AUTHORS                       |   1 +
 MANIFEST                      |   2 +
 ext/DynaLoader/dl_freemint.xs | 220 ++++++++++++++++++++++++++++++++++++++++++
 ext/POSIX/Makefile.PL         |   2 +-
 hints/freemint.sh             |  36 +++++++
 pod/perlport.pod              |   8 ++
 6 files changed, 268 insertions(+), 1 deletion(-)
 create mode 100644 ext/DynaLoader/dl_freemint.xs
 create mode 100644 hints/freemint.sh

diff --git a/AUTHORS b/AUTHORS
index 2d6c583..e66c276 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -40,6 +40,7 @@ Alan Grover                   <awgro...@gmail.com>
 Alan Grow                      <ag...@thegotonerd.com>
 Alan Haggai Alavi              <alanhag...@alanhaggai.org>
 Alan Harder                    <alan.har...@ebay.sun.com>
+Alan Hourihane                 <al...@fairlite.co.uk>
 Alan Modra
 Alan Ferrency                  <a...@pair.com>
 Alastair Douglas               <alastair.doug...@gmail.com>
diff --git a/MANIFEST b/MANIFEST
index 6611b88..055beb9 100644
--- a/MANIFEST
+++ b/MANIFEST
@@ -3539,6 +3539,7 @@ ext/DynaLoader/dl_aix.xs  AIX implementation
 ext/DynaLoader/dl_dllload.xs   S/390 dllload() style implementation
 ext/DynaLoader/dl_dlopen.xs    BSD/SunOS4&5 dlopen() style implementation
 ext/DynaLoader/dl_dyld.xs      NeXT/Apple dyld implementation
+ext/DynaLoader/dl_freemint.xs  GNU dld style implementation for FreeMINT
 ext/DynaLoader/dl_hpux.xs      HP-UX implementation
 ext/DynaLoader/dl_next.xs      NeXT implementation
 ext/DynaLoader/dl_none.xs      Stub implementation
@@ -3978,6 +3979,7 @@ hints/epix.sh                     Hints for named 
architecture
 hints/esix4.sh                 Hints for named architecture
 hints/fps.sh                   Hints for named architecture
 hints/freebsd.sh               Hints for named architecture
+hints/freemint.sh              Hints for named architecture
 hints/genix.sh                 Hints for named architecture
 hints/gnukfreebsd.sh           Hints for named architecture
 hints/gnuknetbsd.sh            Hints for named architecture
diff --git a/ext/DynaLoader/dl_freemint.xs b/ext/DynaLoader/dl_freemint.xs
new file mode 100644
index 0000000..6970a76
--- /dev/null
+++ b/ext/DynaLoader/dl_freemint.xs
@@ -0,0 +1,220 @@
+/*
+ *    Written 3/1/94, Robert Sanders <robert.sand...@linux.org>
+ *
+ * based upon the file "dl.c", which is
+ *    Copyright (c) 1994, Larry Wall
+ *
+ *    You may distribute under the terms of either the GNU General Public
+ *    License or the Artistic License, as specified in the README file.
+ *
+ * $Date: 1994/03/07 00:21:43 $
+ * $Source: /home/rsanders/src/perl5alpha6/RCS/dld_dl.c,v $
+ * $Revision: 1.4 $
+ * $State: Exp $
+ *
+ * Adapted for use with FreeMINT after dld support was removed from perl.
+ *
+ * $Log: dld_dl.c,v $
+ * Removed implicit link against libc.  1994/09/14 William Setzer.
+ *
+ * Integrated other DynaLoader changes. 1994/06/08 Tim Bunce.
+ *
+ * rewrote dl_load_file, misc updates.  1994/09/03 William Setzer.
+ *
+ * Revision 1.4  1994/03/07  00:21:43  rsanders
+ * added min symbol count for load_libs and switched order so system libs
+ * are loaded after app-specified libs.
+ *
+ * Revision 1.3  1994/03/05  01:17:26  rsanders
+ * added path searching.
+ *
+ * Revision 1.2  1994/03/05  00:52:39  rsanders
+ * added package-specified libraries.
+ *
+ * Revision 1.1  1994/03/05  00:33:40  rsanders
+ * Initial revision
+ *
+ *
+ */
+
+#include "EXTERN.h"
+#include "perl.h"
+#include "XSUB.h"
+
+#include <dld.h>       /* GNU DLD header file */
+#include <unistd.h>
+
+typedef struct {
+    AV *       x_resolve_using;
+    AV *       x_require_symbols;
+} my_cxtx_t;           /* this *must* be named my_cxtx_t */
+
+#define DL_CXT_EXTRA   /* ask for dl_cxtx to be defined in dlutils.c */
+#include "dlutils.c"   /* for SaveError() etc */
+
+#define dl_resolve_using       (dl_cxtx.x_resolve_using)
+#define dl_require_symbols     (dl_cxtx.x_require_symbols)
+
+static void
+dl_private_init(pTHX)
+{
+    dl_generic_private_init(aTHX);
+    {
+       int dlderr;
+       dMY_CXT;
+
+       dl_resolve_using   = get_av("DynaLoader::dl_resolve_using", 
GV_ADDMULTI);
+       dl_require_symbols = get_av("DynaLoader::dl_require_symbols", 
GV_ADDMULTI);
+       dlderr = dld_init("/kern/self/exe");
+       if (dlderr) {
+           dlderr = dld_init(dld_find_executable(PL_origargv[0]));
+           if (dlderr) {
+               char *msg = dld_strerror(dlderr);
+               SaveError(aTHX_ "dld_init(%s) failed: %s", 
dld_find_executable(PL_origargv[0]), msg);
+               DLDEBUG(1,PerlIO_printf(Perl_debug_log, "%s", dl_last_error));
+           }
+       }
+    }
+}
+
+
+MODULE = DynaLoader     PACKAGE = DynaLoader
+
+BOOT:
+    (void)dl_private_init();
+
+
+void
+dl_load_file(filename, flags=0)
+    char *     filename
+    int                flags
+    PREINIT:
+    int dlderr,x,max;
+    GV *gv;
+    dMY_CXT;
+    CODE:
+    DLDEBUG(1,PerlIO_printf(Perl_debug_log, "dl_load_file(%s,%x):\n", 
filename,flags));
+    if (flags & 0x01)
+       Perl_croak(aTHX_ "Can't make loaded symbols global on this platform 
while loading %s",filename);
+    max = AvFILL(dl_require_symbols);
+    for (x = 0; x <= max; x++) {
+       char *sym = SvPVX(*av_fetch(dl_require_symbols, x, 0));
+       DLDEBUG(1,PerlIO_printf(Perl_debug_log, "dld_create_ref(%s)\n", sym));
+       if (dlderr = dld_create_reference(sym)) {
+           SaveError(aTHX_ "dld_create_reference(%s): %s", sym,
+                     dld_strerror(dlderr));
+           goto haverror;
+       }
+    }
+
+    DLDEBUG(1,PerlIO_printf(Perl_debug_log, "dld_link(%s)\n", filename));
+    if (dlderr = dld_link(filename)) {
+       SaveError(aTHX_ "dld_link(%s): %s", filename, dld_strerror(dlderr));
+       goto haverror;
+    }
+
+    DLDEBUG(1,PerlIO_printf(Perl_debug_log, "dld_link(libm.a)\n"));
+    if (dlderr = dld_link("/usr/lib/libm.a")) {
+       SaveError(aTHX_ "dld_link(libm.a): %s", dld_strerror(dlderr));
+       goto haverror;
+    }
+
+    DLDEBUG(1,PerlIO_printf(Perl_debug_log, "dld_link(libc.a)\n"));
+    if (dlderr = dld_link("/usr/lib/libc.a")) {
+       SaveError(aTHX_ "dld_link(libc.a): %s", dld_strerror(dlderr));
+       goto haverror;
+    }
+
+    max = AvFILL(dl_resolve_using);
+    for (x = 0; x <= max; x++) {
+       char *sym = SvPVX(*av_fetch(dl_resolve_using, x, 0));
+       DLDEBUG(1,PerlIO_printf(Perl_debug_log, "dld_link(%s)\n", sym));
+       if (dlderr = dld_link(sym)) {
+           SaveError(aTHX_ "dld_link(%s): %s", sym, dld_strerror(dlderr));
+           goto haverror;
+       }
+    }
+    DLDEBUG(2,PerlIO_printf(Perl_debug_log, "libref=%s\n", filename));
+haverror:
+    ST(0) = sv_newmortal() ;
+    if (dlderr == 0)
+       sv_setiv(ST(0), PTR2IV(filename));
+    XSRETURN(1);
+
+
+void
+dl_find_symbol(libhandle, symbolname)
+    void *     libhandle
+    char *     symbolname
+    PREINIT:
+    void *retv;
+    CODE:
+    DLDEBUG(2,PerlIO_printf(Perl_debug_log, "dl_find_symbol(handle=%x, 
symbol=%s)\n",
+           libhandle, symbolname));
+    retv = (void *)dld_get_func(symbolname);
+    DLDEBUG(2,PerlIO_printf(Perl_debug_log, "  symbolref = %x\n", (unsigned 
int)retv));
+    ST(0) = sv_newmortal() ;
+    if (retv == NULL)
+       SaveError(aTHX_ "dl_find_symbol: Unable to find '%s' symbol", 
symbolname) ;
+    else
+       sv_setiv(ST(0), PTR2IV(retv));
+    XSRETURN(1);
+
+
+void
+dl_undef_symbols()
+    PPCODE:
+    if (dld_undefined_sym_count) {
+       int x;
+       char **undef_syms = dld_list_undefined_sym();
+       EXTEND(SP, dld_undefined_sym_count);
+       for (x=0; x < dld_undefined_sym_count; x++)
+           PUSHs(sv_2mortal(newSVpv(undef_syms[x]+1, 0)));
+       free(undef_syms);
+    }
+
+
+
+# These functions should not need changing on any platform:
+
+void
+dl_install_xsub(perl_name, symref, filename="$Package")
+    char *     perl_name
+    void *     symref
+    const char *       filename
+    CODE:
+    DLDEBUG(2,PerlIO_printf(Perl_debug_log, "dl_install_xsub(name=%s, 
symref=%x)\n",
+           perl_name, symref));
+    ST(0) = sv_2mortal(newRV((SV*)newXS_flags(perl_name,
+                                             (void(*)(pTHX_ CV *))symref,
+                                             filename, NULL,
+                                             XS_DYNAMIC_FILENAME)));
+    XSRETURN(1);
+
+char *
+dl_error()
+    PREINIT:
+    dMY_CXT;
+    CODE:
+    RETVAL = dl_last_error ;
+    OUTPUT:
+    RETVAL
+
+#if defined(USE_ITHREADS)
+
+void
+CLONE(...)
+    CODE:
+    MY_CXT_CLONE;
+
+    /* MY_CXT_CLONE just does a memcpy on the whole structure, so to avoid
+     * using Perl variables that belong to another thread, we create our
+     * own for this thread.
+     */
+    MY_CXT.x_dl_last_error = newSVpvn("", 0);
+    dl_resolve_using   = get_av("DynaLoader::dl_resolve_using", GV_ADDMULTI);
+    dl_require_symbols = get_av("DynaLoader::dl_require_symbols", GV_ADDMULTI);
+
+#endif
+
+# end.
diff --git a/ext/POSIX/Makefile.PL b/ext/POSIX/Makefile.PL
index e6e621c..77ebae7 100644
--- a/ext/POSIX/Makefile.PL
+++ b/ext/POSIX/Makefile.PL
@@ -11,7 +11,7 @@ if ($Config{sig_name} =~ /\bRTMIN\b/ && $Config{sig_name} =~ 
/\bRTMAX\b/) {
 }
 
 my @libs;
-if ($^O ne 'MSWin32') {
+if ($^O ne 'MSWin32' && $^O ne 'freemint') {
     @libs = ('LIBS' => ["-lm -lposix -lcposix"]);
 }
 WriteMakefile(
diff --git a/hints/freemint.sh b/hints/freemint.sh
new file mode 100644
index 0000000..c5894d4
--- /dev/null
+++ b/hints/freemint.sh
@@ -0,0 +1,36 @@
+# hints/freemint.sh
+#
+# Contact al...@freemint.org if you want to change this file.
+
+archname="m68k-freemint"
+
+cccdlflags=' '; # avoid -fPIC
+ccdlflags="-Wl,-whole-archive -lgcc -lpthread -Wl,-no-whole-archive"
+
+# libs
+libpth="$prefix/lib /usr/local/lib /usr/lib"
+glibpth="$libpth"
+xlibpth="$libpth"
+
+ccflags="$ccflags -D_GNU_SOURCE"
+libswanted='m dld'
+dl_src='dl_freemint.xs'
+dlext='o'
+lddlflags='-r'
+ldflags='-static'
+so='none'
+useshrplib='false'
+
+case "$usemymalloc" in
+'') usemymalloc='n' ;;
+esac
+#sbrk() returns -1 (failure) somewhere in lib/unicore/mktables at
+#around 14M, so we need to use system malloc() as our sbrk()
+malloc_cflags='ccflags="-DUSE_PERL_SBRK -DPERL_SBRK_VIA_MALLOC $ccflags"'
+
+# Locales aren't feeling well.
+LC_ALL=C; export LC_ALL;
+LANG=C; export LANG;
+
+# We crash if -Ox used.
+locale_cflags='optimize="-O0"'
diff --git a/pod/perlport.pod b/pod/perlport.pod
index 91eee23..7fef42f 100644
--- a/pod/perlport.pod
+++ b/pod/perlport.pod
@@ -2140,6 +2140,14 @@ Caveats:
 
 =item AIX
 
+=item FreeMINT
+
+Perl now builds with FreeMiNT/Atari. It fails a few tests, that needs
+some investigation.
+
+The FreeMiNT port uses GNU dld for loadable module capabilities. So
+ensure you have that library installed when building perl.
+
 =back
 
 =head1 EOL Platforms 

--
Perl5 Master Repository

Reply via email to