Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for Atari FreeMiNT platform #11284

Closed
p5pRT opened this issue Apr 28, 2011 · 46 comments
Closed

Add support for Atari FreeMiNT platform #11284

p5pRT opened this issue Apr 28, 2011 · 46 comments

Comments

@p5pRT
Copy link

p5pRT commented Apr 28, 2011

Migrated from rt.perl.org#89502 (status was 'resolved')

Searchable as RT89502$

@p5pRT
Copy link
Author

p5pRT commented Apr 28, 2011

From alanh@fairlite.co.uk

Created by alanh@fairlite.co.uk

This patch adds support for the Atari FreeMiNT platform.

This is directly related to ticket 73786.

Perl Info

Flags:
    category=core
    severity=low

Site configuration information for perl 5.12.3:

Configured by Gentoo at Fri Apr 15 00:54:02 Local time zone must be
set--see zic
manual page 2011.

Summary of my perl5 (revision 5 version 12 subversion 3) configuration:
   
  Platform:
    osname=freemint, osvers=1.18a, archname=m68k-freemint
    uname='freemint unknown 1.18a 4.4 atarist mc68060 atarist mint '
    config_args='-des -Duseshrplib -Darchname=m68k-linux
-Dcc=m68k-atari-mint-gcc
 -Doptimize=-O2 -pipe -Dldflags= -Dprefix=/usr -Dinstallprefix=/usr
-Dsiteprefix=
/usr -Dvendorprefix=/usr -Dscriptdir=/usr/bin
-Dprivlib=/usr/lib/perl5/5.12.3 -Da
rchlib=/usr/lib/perl5/5.12.3/m68k-linux
-Dsitelib=/usr/lib/perl5/site_perl/5.12.3
 -Dsitearch=/usr/lib/perl5/site_perl/5.12.3/m68k-linux
-Dvendorlib=/usr/lib/perl5
/vendor_perl/5.12.3
-Dvendorarch=/usr/lib/perl5/vendor_perl/5.12.3/m68k-linux -Dm
an1dir=/usr/share/man/man1 -Dman3dir=/usr/share/man/man3
-Dsiteman1dir=/usr/share
/man/man1 -Dsiteman3dir=/usr/share/man/man3
-Dvendorman1dir=/usr/share/man/man1 -
Dvendorman3dir=/usr/share/man/man3 -Dman1ext=1 -Dman3ext=3pm
-Dlibperl=libperl.ir
relevant -Dlocincpth=/usr/include  -Dglibpth=/lib /usr/lib 
-Duselargefiles -Dd_s
emctl_semun -Dcf_by=Gentoo -Dmyhostname=localhost
-Dperladmin=${PORTAGE_ROOT_USER
}@localhost -Dinstallusrbinperl=n -Ud_csh -Uusenm -Dccdlflags=-rdynamic
-Ui_ndbm
-Ui_gdbm -Ui_db -DDEBUGGING=none -Dinc_version_list=5.12.2/m68k-linux
5.12.2 5.12
.1/m68k-linux 5.12.1 5.12.0/m68k-linux 5.12.0  -Dlibpth=/lib /usr/lib 
-Dnoextens
ions=ODBM_File'
    hint=recommended, useposix=true, d_sigaction=define
    useithreads=undef, usemultiplicity=undef
    useperlio=define, d_sfio=undef, uselargefiles=define, usesocks=undef
    use64bitint=undef, use64bitall=undef, uselongdouble=undef
    usemymalloc=y, bincompat5005=undef
  Compiler:
    cc='m68k-atari-mint-gcc', ccflags ='-D_GNU_SOURCE
-fno-strict-aliasing -pipe'
,
    optimize='-O2 -pipe',
    cppflags='-D_GNU_SOURCE -fno-strict-aliasing -pipe'
    ccversion='', gccversion='4.5.2', gccosandvers=''
    intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=4321
    d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=12
    ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t',
lseeksize=
4
    alignbytes=2, prototype=define
  Linker and Libraries:
    ld='ld', ldflags ='-static'
    libpth=/usr/lib /usr/local/lib
    libs=-lm -ldld
    perllibs=-lm -ldld
    libc=, so=none, useshrplib=false, libperl=libperl.a
    gnulibc_version=''
  Dynamic Linking:
    dlsrc=dl_dld.xs, dlext=o, d_dlsymun=undef,
ccdlflags='-Wl,-whole-archive -lgc
c -lpthread -Wl,-no-whole-archive'
    cccdlflags=' ', lddlflags='-r '

Locally applied patches:
    0001-gentoo_MakeMaker-RUNPATH.diff
    0002-gentoo_config_over.diff
    0003-gentoo_cpan_definstalldirs.diff
    0004-gentoo_cpanplus_definstalldirs.diff
    0005-gentoo_create-libperl-soname.diff
    0006-gentoo_MakeMaker-delete_packlist.diff
    0007-fixes_8d66b3f9_h2hp_fix.diff
    0008-fixes_f178b03b_h2ph_using_deprecated_goto.diff
    0009-gentoo_mod-paths.diff
    0010-gentoo_enc2xs.diff
    0011-gentoo_IO-Compress_AutoLoader_dropped_from_Compress-Zlib.diff
    0012-gentoo_drop-fstack-protector.diff


@INC for perl 5.12.3:
    /etc/perl
    /usr/lib/perl5/site_perl/5.12.3/m68k-linux
    /usr/lib/perl5/site_perl/5.12.3
    /usr/lib/perl5/vendor_perl/5.12.3/m68k-linux
    /usr/lib/perl5/vendor_perl/5.12.3
    /usr/lib/perl5/site_perl
    /usr/lib/perl5/vendor_perl/5.12.2/m68k-linux
    /usr/lib/perl5/vendor_perl/5.12.2
    /usr/lib/perl5/vendor_perl/5.12.1/m68k-linux
    /usr/lib/perl5/vendor_perl/5.12.1
    /usr/lib/perl5/vendor_perl
    /usr/lib/perl5/5.12.3/m68k-linux
    /usr/lib/perl5/5.12.3
    /usr/local/lib/site_perl
    .


Environment for perl 5.12.3:
    HOME=/root
    LANG (unset)
    LANGUAGE (unset)
    LD_LIBRARY_PATH (unset)
    LOGDIR (unset)
   
PATH=/usr/sbin:/usr/bin:/sbin:/bin:/opt/bin:/usr/m68k-atari-mint/gcc-bin/4.5.
2:/usr/sbin:/usr/bin:/sbin:/bin
    PERL_BADLANG (unset)
    SHELL=/bin/bash


@p5pRT
Copy link
Author

p5pRT commented Apr 29, 2011

From alanh@fairlite.co.uk

Here's the patch.

Thanks,

Alan.

@p5pRT
Copy link
Author

p5pRT commented Apr 29, 2011

From alanh@fairlite.co.uk

perl-5.12.3-mint.patch
diff -ur perl-5.12.3/Configure perl-5.12.3-mint/Configure
--- perl-5.12.3/Configure	2011-02-21 09:18:09.000000000 +0000
+++ perl-5.12.3-mint/Configure	2011-02-21 09:38:49.000000000 +0000
@@ -1275,6 +1275,9 @@
 elif test -n "$DJGPP"; then
 : DOS DJGPP
     _exe=".exe"
+elif test -f "/kern/cookiejar"; then
+: MiNT
+    _exe=""
 elif test -d c:/. -o -n "$is_os2" ; then
 : OS/2 or cygwin
     _exe=".exe"
@@ -1402,7 +1405,7 @@
 	xcat=/bin/cat
 	test -f $xcat$_exe || xcat=/usr/bin/cat
 	if test ! -f $xcat$_exe; then
-		for p in `echo $PATH | sed -e "s/$p_/ /g"` $paths; do
+		for p in `echo $PATH | sed -e 's/$p_/ /g'` $paths; do
 			if test -f $p/cat$_exe; then
 				xcat=$p/cat
 				break
diff -ur perl-5.12.3/ext/DynaLoader/dl_dld.xs perl-5.12.3-mint/ext/DynaLoader/dl_dld.xs
--- perl-5.12.3/ext/DynaLoader/dl_dld.xs	2010-11-21 21:40:55.000000000 +0000
+++ perl-5.12.3-mint/ext/DynaLoader/dl_dld.xs	2011-02-21 09:38:51.000000000 +0000
@@ -116,6 +116,18 @@
 	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));
diff -ur perl-5.12.3/malloc.c perl-5.12.3-mint/malloc.c
--- perl-5.12.3/malloc.c	2011-01-09 20:20:57.000000000 +0000
+++ perl-5.12.3-mint/malloc.c	2011-02-21 09:38:51.000000000 +0000
@@ -264,7 +264,7 @@
 #define MIN_BUC_POW2 (sizeof(void*) > 4 ? 3 : 2) /* Allow for 4-byte arena. */
 #define MIN_BUCKET (MIN_BUC_POW2 * BUCKETS_PER_POW2)
 
-#if !(defined(I286) || defined(atarist))
+#if !defined(I286)
 	/* take 2k unless the block is bigger than that */
 #  define LOG_OF_MIN_ARENA 11
 #else
@@ -551,8 +551,8 @@
  */
 #define u_short unsigned short
 
-/* 286 and atarist like big chunks, which gives too much overhead. */
-#if (defined(RCHECK) || defined(I286) || defined(atarist)) && defined(PACK_MALLOC)
+/* 286 like big chunks, which gives too much overhead. */
+#if (defined(RCHECK) || defined(I286)) && defined(PACK_MALLOC)
 #  undef PACK_MALLOC
 #endif 
 
@@ -1734,16 +1734,14 @@
 	/* Second, check alignment. */
 	slack = 0;
 
-#if !defined(atarist) /* on the atari we dont have to worry about this */
-#  ifndef I286 	/* The sbrk(0) call on the I286 always returns the next segment */
+#ifndef I286 	/* The sbrk(0) call on the I286 always returns the next segment */
 	/* WANTED_ALIGNMENT may be more than NEEDED_ALIGNMENT, but this may
 	   improve performance of memory access. */
 	if (PTR2UV(cp) & (WANTED_ALIGNMENT - 1)) { /* Not aligned. */
 	    slack = WANTED_ALIGNMENT - (PTR2UV(cp) & (WANTED_ALIGNMENT - 1));
 	    add += slack;
 	}
-#  endif
-#endif /* !atarist */
+#endif
 		
 	if (add) {
 	    DEBUG_m(PerlIO_printf(Perl_debug_log, 
diff -ur perl-5.12.3/miniperlmain.c perl-5.12.3-mint/miniperlmain.c
--- perl-5.12.3/miniperlmain.c	2011-01-09 20:20:57.000000000 +0000
+++ perl-5.12.3-mint/miniperlmain.c	2011-02-21 09:38:49.000000000 +0000
@@ -45,7 +45,7 @@
 #if defined (atarist)
 /* The Atari operating system doesn't have a dynamic stack.  The
    stack size is determined from this value.  */
-long _stksize = 64 * 1024;
+long _stksize = 256 * 1024;
 #endif
 
 #if defined(PERL_GLOBAL_STRUCT_PRIVATE)
diff -ur perl-5.12.3/os2/perlrexx.c perl-5.12.3-mint/os2/perlrexx.c
--- perl-5.12.3/os2/perlrexx.c	2010-11-21 21:40:56.000000000 +0000
+++ perl-5.12.3-mint/os2/perlrexx.c	2011-02-21 09:42:49.000000000 +0000
@@ -38,7 +38,7 @@
 #if defined (atarist)
 /* The Atari operating system doesn't have a dynamic stack.  The
    stack size is determined from this value.  */
-long _stksize = 64 * 1024;
+long _stksize = 256 * 1024;
 #endif
 
 /* Register any extra external extensions */
diff -ur perl-5.12.3/perl.c perl-5.12.3-mint/perl.c
--- perl-5.12.3/perl.c	2011-02-21 09:17:19.000000000 +0000
+++ perl-5.12.3-mint/perl.c	2011-02-21 09:38:50.000000000 +0000
@@ -3272,10 +3272,6 @@
 		      "\n\nOS/2 port Copyright (c) 1990, 1991, Raymond Chen, Kai Uwe Rommel\n"
 		      "Version 5 port Copyright (c) 1994-2002, Andreas Kaiser, Ilya Zakharevich\n");
 #endif
-#ifdef atarist
-	PerlIO_printf(PerlIO_stdout(),
-		      "atariST series port, ++jrb  bammi@cadence.com\n");
-#endif
 #ifdef __BEOS__
 	PerlIO_printf(PerlIO_stdout(),
 		      "BeOS port Copyright Tom Spindler, 1997-1999\n");
diff -ur perl-5.12.3/perl.h perl-5.12.3-mint/perl.h
--- perl-5.12.3/perl.h	2011-01-09 20:20:57.000000000 +0000
+++ perl-5.12.3-mint/perl.h	2011-02-21 09:38:50.000000000 +0000
@@ -497,7 +497,7 @@
  */
 
 /* define this once if either system, instead of cluttering up the src */
-#if defined(MSDOS) || defined(atarist) || defined(WIN32) || defined(NETWARE)
+#if defined(MSDOS) || defined(WIN32) || defined(NETWARE)
 #define DOSISH 1
 #endif
 
diff -ur --new-file perl-5.12.3/perlio.c perl-5.12.3-mint/perlio.c
--- perl-5.12.3/perlio.c	2009-04-14 23:47:25.000000000 +0000
+++ perl-5.12.3-mint/perlio.c	2010-03-23 18:36:15.000000000 +0000
@@ -135,17 +135,6 @@
      * This used to be contents of do_binmode in doio.c
      */
 #ifdef DOSISH
-#  if defined(atarist)
-    PERL_UNUSED_ARG(iotype);
-    if (!fflush(fp)) {
-        if (mode & O_BINARY)
-            ((FILE *) fp)->_flag |= _IOBIN;
-        else
-            ((FILE *) fp)->_flag &= ~_IOBIN;
-        return 1;
-    }
-    return 0;
-#  else
     dTHX;
     PERL_UNUSED_ARG(iotype);
 #ifdef NETWARE
@@ -153,7 +142,7 @@
 #else
     if (PerlLIO_setmode(fileno(fp), mode) != -1) {
 #endif
-#    if defined(WIN32) && defined(__BORLANDC__)
+#  if defined(WIN32) && defined(__BORLANDC__)
         /*
          * The translation mode of the stream is maintained independent 
 of
@@ -169,12 +158,11 @@
             fp->flags |= _F_BIN;
         else
             fp->flags &= ~_F_BIN;
-#    endif
+#  endif
         return 1;
     }
     else
         return 0;
-#  endif
 #else
 #  if defined(USEMYBINMODE)
     dTHX;
diff -ur perl-5.12.3/pp_sys.c perl-5.12.3-mint/pp_sys.c
--- perl-5.12.3/pp_sys.c	2011-01-09 20:20:58.000000000 +0000
+++ perl-5.12.3-mint/pp_sys.c	2011-02-21 09:38:50.000000000 +0000
@@ -3308,14 +3308,6 @@
     RETPUSHNO;
 }
 
-#if defined(atarist) /* this will work with atariST. Configure will
-			make guesses for other systems. */
-# define FILE_base(f) ((f)->_base)
-# define FILE_ptr(f) ((f)->_ptr)
-# define FILE_cnt(f) ((f)->_cnt)
-# define FILE_bufsiz(f) ((f)->_cnt + ((f)->_ptr - (f)->_base))
-#endif
-
 PP(pp_fttext)
 {
     dVAR;
@@ -5567,30 +5559,6 @@
     case 8:
 	retval = syscall(a[0],a[1],a[2],a[3],a[4],a[5],a[6],a[7]);
 	break;
-#ifdef atarist
-    case 9:
-	retval = syscall(a[0],a[1],a[2],a[3],a[4],a[5],a[6],a[7],a[8]);
-	break;
-    case 10:
-	retval = syscall(a[0],a[1],a[2],a[3],a[4],a[5],a[6],a[7],a[8],a[9]);
-	break;
-    case 11:
-	retval = syscall(a[0],a[1],a[2],a[3],a[4],a[5],a[6],a[7],a[8],a[9],
-	  a[10]);
-	break;
-    case 12:
-	retval = syscall(a[0],a[1],a[2],a[3],a[4],a[5],a[6],a[7],a[8],a[9],
-	  a[10],a[11]);
-	break;
-    case 13:
-	retval = syscall(a[0],a[1],a[2],a[3],a[4],a[5],a[6],a[7],a[8],a[9],
-	  a[10],a[11],a[12]);
-	break;
-    case 14:
-	retval = syscall(a[0],a[1],a[2],a[3],a[4],a[5],a[6],a[7],a[8],a[9],
-	  a[10],a[11],a[12],a[13]);
-	break;
-#endif /* atarist */
     }
     SP = ORIGMARK;
     PUSHi(retval);
diff -ur perl-5.12.3/util.c perl-5.12.3-mint/util.c
--- perl-5.12.3/util.c	2011-01-09 20:20:58.000000000 +0000
+++ perl-5.12.3-mint/util.c	2011-02-21 09:38:51.000000000 +0000
@@ -2545,7 +2545,7 @@
     return PerlIO_fdopen(p[This], mode);
 }
 #else
-#if defined(atarist) || defined(EPOC)
+#if defined(EPOC)
 FILE *popen();
 PerlIO *
 Perl_my_popen(pTHX_ const char *cmd, const char *mode)
@@ -2994,7 +2994,7 @@
 }
 #endif
 
-#if defined(atarist) || defined(OS2) || defined(EPOC)
+#if defined(OS2) || defined(EPOC)
 int pclose();
 #ifdef HAS_FORK
 int					/* Cannot prototype with I32
@@ -3111,7 +3111,7 @@
     I32 len = 0;
     int retval;
     char *bufend;
-#if defined(DOSISH) && !defined(OS2) && !defined(atarist)
+#if defined(DOSISH) && !defined(OS2)
 #  define SEARCH_EXTS ".bat", ".cmd", NULL
 #  define MAX_EXT_LEN 4
 #endif
@@ -3234,28 +3234,25 @@
 
 	bufend = s + strlen(s);
 	while (s < bufend) {
-#if defined(atarist) || defined(DOSISH)
+#if defined(DOSISH)
 	    for (len = 0; *s
-#  ifdef atarist
-		    && *s != ','
-#  endif
 		    && *s != ';'; len++, s++) {
 		if (len < sizeof tmpbuf)
 		    tmpbuf[len] = *s;
 	    }
 	    if (len < sizeof tmpbuf)
 		tmpbuf[len] = '\0';
-#else  /* ! (atarist || DOSISH) */
+#else  /* ! (DOSISH) */
 	    s = delimcpy(tmpbuf, tmpbuf + sizeof tmpbuf, s, bufend,
 			':',
 			&len);
-#endif /* ! (atarist || DOSISH) */
+#endif /* ! (DOSISH) */
 	    if (s < bufend)
 		s++;
 	    if (len + 1 + strlen(scriptname) + MAX_EXT_LEN >= sizeof tmpbuf)
 		continue;	/* don't search dir with too-long name */
 	    if (len
-#  if defined(atarist) || defined(DOSISH)
+#  if defined(DOSISH)
 		&& tmpbuf[len - 1] != '/'
 		&& tmpbuf[len - 1] != '\\'
 #  endif
--- /dev/null	2011-02-19 16:37:30.000000000 +0000
+++ perl-5.12.3-mint/hints/freemint.sh	2011-02-21 09:43:21.000000000 +0000
@@ -0,0 +1,34 @@
+# hints/freemint.sh
+#
+# talk to guido@freemint.de if you want to change this file.
+# Please read the README.mint file.
+#
+# misc stuff
+
+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_dld.xs'
+dlext='o'
+lddlflags='-r'
+ldflags='-static'
+so='none'
+useshrplib='false'
+
+#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. We crash if -Ox used.
+locale_cflags='optimize="-O0"'
+LC_ALL=C; export LC_ALL;
+LANG=C; export LANG;

@p5pRT
Copy link
Author

p5pRT commented Apr 29, 2011

From @Tux

On Thu, 28 Apr 2011 20​:37​:05 +0100, Alan Hourihane
<alanh@​fairlite.co.uk> wrote​:

Here's the patch.

Sorry to say it is just too late for 5.14.0

Inline Patch
--- perl-5.12.3/Configure	2011-02-21 09:18:09.000000000 +0000
+++ perl-5.12.3-mint/Configure	2011-02-21 09:38:49.000000000 +0000
@@ -1275,6 +1275,9 @@
 elif test -n "$DJGPP"; then
 : DOS DJGPP
     _exe=".exe"
+elif test -f "/kern/cookiejar"; then
+: MiNT
+    _exe=""
 elif test -d c:/. -o -n "$is_os2" ; then
 : OS/2 or cygwin
     _exe=".exe"

Why exactly is this needed? As "" is the default. What other test would trigger it to be something else\, and in that case\, could that other test be amended by adding criteria?

@​@​ -1402,7 +1405,7 @​@​
  xcat=/bin/cat
  test -f $xcat$_exe || xcat=/usr/bin/cat
  if test ! -f $xcat$_exe; then
- for p in `echo $PATH | sed -e "s/$p_/ /g"` $paths; do
+ for p in `echo $PATH | sed -e 's/$p_/ /g'` $paths; do
  if test -f $p/cat$_exe; then
  xcat=$p/cat
  break

Looks sane, but again not in time for 5.14.0. This is btw an unchanged
item from the original "dist" metaconfig package. I'll contact Rafaël
(the maintainer of dist) for his opinion, as that unit is still
unchanged in his svn repo. (git++ for giving me git svn clone)

Thanks,
Alan.

--
H.Merijn Brand http​://tux.nl Perl Monger http​://amsterdam.pm.org/
using 5.00307 through 5.12 and porting perl5.13.x on HP-UX 10.20, 11.00,
11.11, 11.23 and 11.31, OpenSuSE 10.1, 11.0 .. 11.3 and AIX 5.2 and 5.3.
http​://mirrors.develooper.com/hpux/ http​://www.test-smoke.org/
http​://qa.perl.org http​://www.goldmark.org/jeff/stupid-disclaimers/

@p5pRT
Copy link
Author

p5pRT commented Apr 29, 2011

The RT System itself - Status changed from 'new' to 'open'

@p5pRT
Copy link
Author

p5pRT commented Apr 29, 2011

From @cpansprout

Grrr! RT’s pop-up menus made me delete the freemint and 5.12.3 values.

@p5pRT
Copy link
Author

p5pRT commented Oct 17, 2011

From @cpansprout

Is there any chance this could be integrated before 5.16?

On Fri Apr 29 03​:19​:00 2011, hmbrand wrote​:

On Thu, 28 Apr 2011 20​:37​:05 +0100, Alan Hourihane
<alanh@​fairlite.co.uk> wrote​:

Here's the patch.

Sorry to say it is just too late for 5.14.0

--- perl-5.12.3/Configure 2011-02-21 09​:18​:09.000000000 +0000
+++ perl-5.12.3-mint/Configure 2011-02-21 09​:38​:49.000000000 +0000
@​@​ -1275,6 +1275,9 @​@​
elif test -n "$DJGPP"; then
: DOS DJGPP
_exe=".exe"
+elif test -f "/kern/cookiejar"; then
+​: MiNT
+ _exe=""
elif test -d c​:/. -o -n "$is_os2" ; then
: OS/2 or cygwin
_exe=".exe"

Why exactly is this needed? As "" is the default. What other test would
trigger it to be something else, and in that case, could that other
test be amended by adding criteria?

@​@​ -1402,7 +1405,7 @​@​
xcat=/bin/cat
test -f $xcat$_exe || xcat=/usr/bin/cat
if test ! -f $xcat$_exe; then
- for p in `echo $PATH | sed -e "s/$p_/ /g"` $paths; do
+ for p in `echo $PATH | sed -e 's/$p_/ /g'` $paths; do
if test -f $p/cat$_exe; then
xcat=$p/cat
break

Looks sane, but again not in time for 5.14.0. This is btw an unchanged
item from the original "dist" metaconfig package. I'll contact Rafa�l
(the maintainer of dist) for his opinion, as that unit is still
unchanged in his svn repo. (git++ for giving me git svn clone)

Thanks,
Alan.

@p5pRT
Copy link
Author

p5pRT commented Oct 17, 2011

From [Unknown Contact. See original ticket]

Is there any chance this could be integrated before 5.16?

On Fri Apr 29 03​:19​:00 2011, hmbrand wrote​:

On Thu, 28 Apr 2011 20​:37​:05 +0100, Alan Hourihane
<alanh@​fairlite.co.uk> wrote​:

Here's the patch.

Sorry to say it is just too late for 5.14.0

--- perl-5.12.3/Configure 2011-02-21 09​:18​:09.000000000 +0000
+++ perl-5.12.3-mint/Configure 2011-02-21 09​:38​:49.000000000 +0000
@​@​ -1275,6 +1275,9 @​@​
elif test -n "$DJGPP"; then
: DOS DJGPP
_exe=".exe"
+elif test -f "/kern/cookiejar"; then
+​: MiNT
+ _exe=""
elif test -d c​:/. -o -n "$is_os2" ; then
: OS/2 or cygwin
_exe=".exe"

Why exactly is this needed? As "" is the default. What other test would
trigger it to be something else, and in that case, could that other
test be amended by adding criteria?

@​@​ -1402,7 +1405,7 @​@​
xcat=/bin/cat
test -f $xcat$_exe || xcat=/usr/bin/cat
if test ! -f $xcat$_exe; then
- for p in `echo $PATH | sed -e "s/$p_/ /g"` $paths; do
+ for p in `echo $PATH | sed -e 's/$p_/ /g'` $paths; do
if test -f $p/cat$_exe; then
xcat=$p/cat
break

Looks sane, but again not in time for 5.14.0. This is btw an unchanged
item from the original "dist" metaconfig package. I'll contact Rafa�l
(the maintainer of dist) for his opinion, as that unit is still
unchanged in his svn repo. (git++ for giving me git svn clone)

Thanks,
Alan.

@p5pRT
Copy link
Author

p5pRT commented Oct 17, 2011

From @Tux

On Sun, 16 Oct 2011 17​:41​:18 -0700, "Father Chrysostomos via RT"
<perlbug-comment@​perl.org> wrote​:

Is there any chance this could be integrated before 5.16?

I don't think so, as there was no reply at all on the first part, and
the second part is plain wrong. I tested it after I posted the "sane"
comment.

On Fri Apr 29 03​:19​:00 2011, hmbrand wrote​:

On Thu, 28 Apr 2011 20​:37​:05 +0100, Alan Hourihane
<alanh@​fairlite.co.uk> wrote​:

Here's the patch.

Sorry to say it is just too late for 5.14.0

--- perl-5.12.3/Configure 2011-02-21 09​:18​:09.000000000 +0000
+++ perl-5.12.3-mint/Configure 2011-02-21 09​:38​:49.000000000 +0000
@​@​ -1275,6 +1275,9 @​@​
elif test -n "$DJGPP"; then
: DOS DJGPP
_exe=".exe"
+elif test -f "/kern/cookiejar"; then
+​: MiNT
+ _exe=""
elif test -d c​:/. -o -n "$is_os2" ; then
: OS/2 or cygwin
_exe=".exe"

Why exactly is this needed? As "" is the default. What other test would
trigger it to be something else, and in that case, could that other
test be amended by adding criteria?

@​@​ -1402,7 +1405,7 @​@​
xcat=/bin/cat
test -f $xcat$_exe || xcat=/usr/bin/cat
if test ! -f $xcat$_exe; then
- for p in `echo $PATH | sed -e "s/$p_/ /g"` $paths; do
+ for p in `echo $PATH | sed -e 's/$p_/ /g'` $paths; do
if test -f $p/cat$_exe; then
xcat=$p/cat
break

Looks sane, but again not in time for 5.14.0. This is btw an unchanged
item from the original "dist" metaconfig package. I'll contact Rafa�l
(the maintainer of dist) for his opinion, as that unit is still
unchanged in his svn repo. (git++ for giving me git svn clone)

Thanks,
Alan.

--
H.Merijn Brand http​://tux.nl Perl Monger http​://amsterdam.pm.org/
using 5.00307 through 5.14 and porting perl5.15.x on HP-UX 10.20, 11.00,
11.11, 11.23 and 11.31, OpenSuSE 10.1, 11.0 .. 11.4 and AIX 5.2 and 5.3.
http​://mirrors.develooper.com/hpux/ http​://www.test-smoke.org/
http​://qa.perl.org http​://www.goldmark.org/jeff/stupid-disclaimers/

@p5pRT
Copy link
Author

p5pRT commented Jun 24, 2013

From @tonycoz

On Sun Oct 16 22​:56​:47 2011, hmbrand wrote​:

On Sun, 16 Oct 2011 17​:41​:18 -0700, "Father Chrysostomos via RT"
<perlbug-comment@​perl.org> wrote​:

Is there any chance this could be integrated before 5.16?

I don't think so, as there was no reply at all on the first part, and
the second part is plain wrong. I tested it after I posted the "sane"
comment.

There's a followup for the first part at​:

http​://www.nntp.perl.org/group/perl.perl5.porters/2012/08/msg191018.html

which doesn't seem to have been picked up by RT.

Presumably the cygwin test for -d c​:/. is matching.

Tony

@p5pRT
Copy link
Author

p5pRT commented Jun 28, 2013

From @deven

What is the logic behind the second part of the patch? It only appears to
be replacing double quotes with single quotes. On any Unix-like system,
this is clearly wrong, since single quotes would prevent the $p from being
interpolated into the string. Does FreeMiNT have different semantics?

Deven

On Mon, Jun 24, 2013 at 1​:35 AM, Tony Cook via RT <perlbug-followup@​perl.org

wrote​:

On Sun Oct 16 22​:56​:47 2011, hmbrand wrote​:

On Sun, 16 Oct 2011 17​:41​:18 -0700, "Father Chrysostomos via RT"
<perlbug-comment@​perl.org> wrote​:

Is there any chance this could be integrated before 5.16?

I don't think so, as there was no reply at all on the first part, and
the second part is plain wrong. I tested it after I posted the "sane"
comment.

There's a followup for the first part at​:

http​://www.nntp.perl.org/group/perl.perl5.porters/2012/08/msg191018.html

which doesn't seem to have been picked up by RT.

Presumably the cygwin test for -d c​:/. is matching.

Tony

---
via perlbug​: queue​: perl5 status​: open
https://rt-archive.perl.org/perl5/Ticket/Display.html?id=89502

@p5pRT
Copy link
Author

p5pRT commented Jul 8, 2013

From @deven

On Thu, Jul 4, 2013 at 6​:36 AM, Alan Hourihane <alanh@​fairlite.co.uk> wrote​:

No. FreeMiNT doesn't have different semantics.

Maybe it's a bash 4.2 thing. I'd need to check.

The distinction between single and double quotes goes back decades to the
original Bourne shell. Every version of bash will treat "$" inside single
quotes as literal text.

What was broken about the Configure script that the patch was attempting to
fix?

Deven

@p5pRT
Copy link
Author

p5pRT commented Sep 5, 2013

From @nwc10

On Thu Apr 28 12​:32​:18 2011, alanh wrote​:

This patch adds support for the Atari FreeMiNT platform.

This is directly related to ticket 73786.

See
http​://www.xray.mpe.mpg.de/mailing-lists/perl5-porters/2013-09/msg00174.html
relating to dl_dld.xs

Nicholas Clark

@p5pRT
Copy link
Author

p5pRT commented Sep 16, 2013

From alanh@fairlite.co.uk

On Fri Apr 29 03​:19​:00 2011, hmbrand wrote​:

On Thu, 28 Apr 2011 20​:37​:05 +0100, Alan Hourihane
<alanh@​fairlite.co.uk> wrote​:

Here's the patch.

Sorry to say it is just too late for 5.14.0

--- perl-5.12.3/Configure 2011-02-21 09​:18​:09.000000000 +0000
+++ perl-5.12.3-mint/Configure 2011-02-21 09​:38​:49.000000000 +0000
@​@​ -1275,6 +1275,9 @​@​
elif test -n "$DJGPP"; then
: DOS DJGPP
_exe=".exe"
+elif test -f "/kern/cookiejar"; then
+​: MiNT
+ _exe=""
elif test -d c​:/. -o -n "$is_os2" ; then
: OS/2 or cygwin
_exe=".exe"

Why exactly is this needed? As "" is the default. What other test would
trigger it to be something else, and in that case, could that other
test be amended by adding criteria?

@​@​ -1402,7 +1405,7 @​@​
xcat=/bin/cat
test -f $xcat$_exe || xcat=/usr/bin/cat
if test ! -f $xcat$_exe; then
- for p in `echo $PATH | sed -e "s/$p_/ /g"` $paths; do
+ for p in `echo $PATH | sed -e 's/$p_/ /g'` $paths; do
if test -f $p/cat$_exe; then
xcat=$p/cat
break

Looks sane, but again not in time for 5.14.0. This is btw an unchanged
item from the original "dist" metaconfig package. I'll contact Rafa�l
(the maintainer of dist) for his opinion, as that unit is still
unchanged in his svn repo. (git++ for giving me git svn clone)

Thanks,
Alan.

Just to go over the Configure patch again.

The first hunk is required because otherwise the OS2/Cygwin test
succeeds on this platform, and that's incorrect.

The second hunk isn't required. I've just retested without it.

Can this be committed without that hunk ?

Also, we need the above comment rectifying so we don't lose dld support.

Thanks.

@p5pRT
Copy link
Author

p5pRT commented Sep 17, 2013

From @Tux

On Mon, 16 Sep 2013 14​:16​:02 -0700, "Alan Hourihane via RT"
<perlbug-followup@​perl.org> wrote​:

On Fri Apr 29 03​:19​:00 2011, hmbrand wrote​:

On Thu, 28 Apr 2011 20​:37​:05 +0100, Alan Hourihane
<alanh@​fairlite.co.uk> wrote​:

Here's the patch.

Sorry to say it is just too late for 5.14.0

--- perl-5.12.3/Configure 2011-02-21 09​:18​:09.000000000 +0000
+++ perl-5.12.3-mint/Configure 2011-02-21 09​:38​:49.000000000 +0000
@​@​ -1275,6 +1275,9 @​@​
elif test -n "$DJGPP"; then
: DOS DJGPP
_exe=".exe"
+elif test -f "/kern/cookiejar"; then
  ^ ^

As part of the original patch is about quotes, I might add that those
are not needed here, right?

+​: MiNT
+ _exe=""
elif test -d c​:/. -o -n "$is_os2" ; then
: OS/2 or cygwin
_exe=".exe"

Why exactly is this needed? As "" is the default. What other test would
trigger it to be something else, and in that case, could that other
test be amended by adding criteria?

@​@​ -1402,7 +1405,7 @​@​
xcat=/bin/cat
test -f $xcat$_exe || xcat=/usr/bin/cat
if test ! -f $xcat$_exe; then
- for p in `echo $PATH | sed -e "s/$p_/ /g"` $paths; do
+ for p in `echo $PATH | sed -e 's/$p_/ /g'` $paths; do
if test -f $p/cat$_exe; then
xcat=$p/cat
break

Looks sane, but again not in time for 5.14.0. This is btw an unchanged
item from the original "dist" metaconfig package. I'll contact Rafa�l
(the maintainer of dist) for his opinion, as that unit is still
unchanged in his svn repo. (git++ for giving me git svn clone)

Thanks,
Alan.

Just to go over the Configure patch again.

The first hunk is required because otherwise the OS2/Cygwin test
succeeds on this platform, and that's incorrect.

The second hunk isn't required. I've just retested without it.

Then do not change it. This is most likely what was holding the patch
from being applied anyway. Here is the comments (slightly simplified)
from the maintainer of meta, just for some clarification​:
--8<---
The correct line is of course the one that reads​:

  for p in `echo $PATH | sed -e "s/$p_/ /g"` $paths; do

but this patch seems to prefer the one where the substitution pattern
would be enclosed in simple quotes. That is of course wrong, since the
then $p_ variable will not be expanded (p_ is the path separator, as
computed in Head.U).

In the SVN repository, the line present in spitshell.U is the correct one.
-->8---

Can this be committed without that hunk ?

I think so

Also, we need the above comment rectifying so we don't lose dld support.

Thanks.

--
H.Merijn Brand http​://tux.nl Perl Monger http​://amsterdam.pm.org/
using perl5.00307 .. 5.19 porting perl5 on HP-UX, AIX, and openSUSE
http​://mirrors.develooper.com/hpux/ http​://www.test-smoke.org/
http​://qa.perl.org http​://www.goldmark.org/jeff/stupid-disclaimers/

@p5pRT
Copy link
Author

p5pRT commented Sep 17, 2013

From @nwc10

On Mon, Sep 16, 2013 at 02​:16​:02PM -0700, Alan Hourihane via RT wrote​:

Also, we need the above comment rectifying so we don't lose dld support.

The dl_dld.xs file makes no use of any of the probing done by Configure -
for example, it unconditionally includes <dld.h> instead of wrapping it in
C pre-processor macros. So we don't need to re-instate the probes.

Also, no other platform is using dld, so if we put the file back as
dl_mint.xs, I believe that Configure (as-is) will automatically pick it up
for MiNT. ($osname is set to 'mint', correct?)

That keeps Configure simpler, without stopping MiNT working.

Nicholas Clark

@p5pRT
Copy link
Author

p5pRT commented Sep 17, 2013

From alanh@fairlite.co.uk

On 09/17/13 08​:12, Nicholas Clark via RT wrote​:

On Mon, Sep 16, 2013 at 02​:16​:02PM -0700, Alan Hourihane via RT wrote​:

Also, we need the above comment rectifying so we don't lose dld support.
The dl_dld.xs file makes no use of any of the probing done by Configure -
for example, it unconditionally includes <dld.h> instead of wrapping it in
C pre-processor macros. So we don't need to re-instate the probes.

Also, no other platform is using dld, so if we put the file back as
dl_mint.xs, I believe that Configure (as-is) will automatically pick it up
for MiNT. ($osname is set to 'mint', correct?)

That keeps Configure simpler, without stopping MiNT working.

Great. Thanks.

Let me know when to grab something to test.

Alan.

@p5pRT
Copy link
Author

p5pRT commented Oct 30, 2013

From @bulk88

On Tue Sep 17 01​:24​:49 2013, alanh wrote​:

Let me know when to grab something to test.

Alan.

To move this ticket along.

As a 3rd party who understands very little of this ticket, I think you need to remove the double to single quotes change in Configure. Also your patch is a diff patch, not a git patch. Here at p5p, we prefer, but don't require, git patches with commit messages. Mention this ticket number in the commit message body. Also since dld was removed per http​://www.xray.mpe.mpg.de/mailing-lists/perl5-porters/2013-09/msg00174.html , this patch seems uncommitable now. Note the OP diff patch is from 5.12, not 5.19.

Also, some [of my] questions to answer either here in this ticket or in commit message.

Why did the fixed stack size change in the OS?

____________________________________________________

Inline Patch
diff -ur perl-5.12.3/ext/DynaLoader/dl_dld.xs perl-5.12.3-mint/ext/DynaLoader/dl_dld.xs
--- perl-5.12.3/ext/DynaLoader/dl_dld.xs	2010-11-21 21:40:55.000000000 +0000
+++ perl-5.12.3-mint/ext/DynaLoader/dl_dld.xs	2011-02-21 09:38:51.000000000 +0000
@@ -116,6 +116,18 @@
 	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));
____________________________________________________ Why more error cases for dld?

--
bulk88 ~ bulk88 at hotmail.com

@p5pRT
Copy link
Author

p5pRT commented Oct 30, 2013

From alanh@fairlite.co.uk

On 10/30/13 03​:16, bulk88 via RT wrote​:

To move this ticket along.

As a 3rd party who understands very little of this ticket, I think you need to remove the double to single quotes change in Configure. Also your patch is a diff patch, not a git patch. Here at p5p, we prefer, but don't require, git patches with commit messages. Mention this ticket number in the commit message body. Also since dld was removed per http​://www.xray.mpe.mpg.de/mailing-lists/perl5-porters/2013-09/msg00174.html , this patch seems uncommitable now. Note the OP diff patch is from 5.12, not 5.19.

As previous tickets have mentioned that dld will be added back with a
freemint renamed file. And as mentioned the Configure quotes can be
reverted.

Also, some [of my] questions to answer either here in this ticket or in commit message.

Why did the fixed stack size change in the OS?

Because the app needs more stack.

____________________________________________________
diff -ur perl-5.12.3/ext/DynaLoader/dl_dld.xs perl-5.12.3-mint/ext/DynaLoader/dl_dld.xs
--- perl-5.12.3/ext/DynaLoader/dl_dld.xs 2010-11-21 21​:40​:55.000000000 +0000
+++ perl-5.12.3-mint/ext/DynaLoader/dl_dld.xs 2011-02-21 09​:38​:51.000000000 +0000
@​@​ -116,6 +116,18 @​@​
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));
____________________________________________________
Why more error cases for dld?

Because dld needs to link with system libraries.

Alan.

@p5pRT
Copy link
Author

p5pRT commented Nov 11, 2013

From @tonycoz

On Tue Sep 17 01​:24​:49 2013, alanh wrote​:

Let me know when to grab something to test.

I've pushed an update to tonyc/freemint reinstating dld renamed as dld_freemint,
*and* with the extra dld_links for libc and libm from your original patch.

You can download a snapshot to test from​:

http​://perl5.git.perl.org/perl.git/snapshot/refs/heads/tonyc/freemint.tar.gz

Tony

@p5pRT
Copy link
Author

p5pRT commented Nov 11, 2013

From alanh@fairlite.co.uk

On 11/11/13 00​:40, Tony Cook via RT wrote​:

On Tue Sep 17 01​:24​:49 2013, alanh wrote​:

Let me know when to grab something to test.
I've pushed an update to tonyc/freemint reinstating dld renamed as dld_freemint,
*and* with the extra dld_links for libc and libm from your original patch.

You can download a snapshot to test from​:

http​://perl5.git.perl.org/perl.git/snapshot/refs/heads/tonyc/freemint.tar.gz

Thanks Tony, I'll grab it and report back.

Alan.

@p5pRT
Copy link
Author

p5pRT commented Nov 13, 2013

From alanh@fairlite.co.uk

Hi Tony,

So I'm building a copy now and get these warnings when building
dl_freemint.xs...

../../miniperl "-I../../lib" "-I../../lib" ../../lib/ExtUtils/xsubpp
-noprototypes -typemap ../../lib/ExtUtils/typemap DynaLoader.xs >
DynaLoader.xsc && mv DynaLoader.xsc DynaLoader.c
Warning​: Found a 'CODE' section which seems to be using 'RETVAL' but no
'OUTPUT' section. in DynaLoader.xs, line 146
Warning​: Found a 'CODE' section which seems to be using 'RETVAL' but no
'OUTPUT' section. in DynaLoader.xs, line 163
cc -c -D_GNU_SOURCE -fno-strict-aliasing -pipe -O -DVERSION=\"1.21\"
-DXS_VERSION=\"1.21\" "-I../.." -DLIBC="/usr/lib/libc.a" DynaLoader.c
DynaLoader.xs​: In function 'dl_private_init'​:
DynaLoader.xs​:74​:15​: warning​: initialization discards 'const' qualifier
from pointer target type [enabled by default]

We're just missing "const" on line 74, but I'm not sure how line 146 &
163 should be fixed ?

Also, we can remove the __linux__ references in this file too.

I need to send a new files for FreeMiNT hints and another minor patch
that I'll update next.

Alan.

@p5pRT
Copy link
Author

p5pRT commented Nov 14, 2013

From alanh@fairlite.co.uk

Attached is a patch against the renamed dl_freemint.xs file.

@p5pRT
Copy link
Author

p5pRT commented Nov 14, 2013

From alanh@fairlite.co.uk

dl_freemint.xs.patch
--- /tmp/dl_freemint.xs	2013-11-13 14:26:51.000000000 +0000
+++ ext/DynaLoader/dl_freemint.xs	2013-11-14 16:39:07.000000000 +0000
@@ -65,19 +65,15 @@
 
 	dl_resolve_using   = get_av("DynaLoader::dl_resolve_using", GV_ADDMULTI);
 	dl_require_symbols = get_av("DynaLoader::dl_require_symbols", GV_ADDMULTI);
-#ifdef __linux__
-	dlderr = dld_init("/proc/self/exe");
+	dlderr = dld_init("/kern/self/exe");
 	if (dlderr) {
-#endif
 	    dlderr = dld_init(dld_find_executable(PL_origargv[0]));
 	    if (dlderr) {
 		char *msg = dld_strerror(dlderr);
-		SaveError(aTHX_ "dld_init(%s) failed: %s", PL_origargv[0], msg);
+		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));
 	    }
-#ifdef __linux__
 	}
-#endif
     }
 }
 
@@ -97,7 +93,6 @@
     GV *gv;
     dMY_CXT;
     CODE:
-    RETVAL = filename;
     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);
@@ -139,28 +127,31 @@
 	    goto haverror;
 	}
     }
-    DLDEBUG(2,PerlIO_printf(Perl_debug_log, "libref=%s\n", RETVAL));
+    DLDEBUG(2,PerlIO_printf(Perl_debug_log, "libref=%s\n", filename));
 haverror:
     ST(0) = sv_newmortal() ;
     if (dlderr == 0)
-	sv_setiv(ST(0), PTR2IV(RETVAL));
+	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));
-    RETVAL = (void *)dld_get_func(symbolname);
-    /* if RETVAL==NULL we should try looking for a non-function symbol */
-    DLDEBUG(2,PerlIO_printf(Perl_debug_log, "  symbolref = %x\n", RETVAL));
+    retv = (void *)dld_get_func(symbolname);
+    DLDEBUG(2,PerlIO_printf(Perl_debug_log, "  symbolref = %x\n", (unsigned int)retv));
     ST(0) = sv_newmortal() ;
-    if (RETVAL == NULL)
+    if (retv == NULL)
 	SaveError(aTHX_ "dl_find_symbol: Unable to find '%s' symbol", symbolname) ;
     else
-	sv_setiv(ST(0), PTR2IV(RETVAL));
+	sv_setiv(ST(0), PTR2IV(retv));
+    XSRETURN(1);
 
 
 void
@@ -191,6 +182,7 @@
 					      (void(*)(pTHX_ CV *))symref,
 					      filename, NULL,
 					      XS_DYNAMIC_FILENAME)));
+    XSRETURN(1);
 
 char *
 dl_error()

@p5pRT
Copy link
Author

p5pRT commented Nov 14, 2013

From alanh@fairlite.co.uk

Attached is a patch to ext/POSIX/Makefile.PL to stop including libm for freemint as well.

@p5pRT
Copy link
Author

p5pRT commented Nov 14, 2013

@p5pRT
Copy link
Author

p5pRT commented Nov 14, 2013

From alanh@fairlite.co.uk

Finally a hints file for FreeMiNT.

@p5pRT
Copy link
Author

p5pRT commented Nov 14, 2013

From alanh@fairlite.co.uk

freemint.sh

@p5pRT
Copy link
Author

p5pRT commented Nov 14, 2013

From alanh@fairlite.co.uk

Actually, scrap that last freemint.sh hints file and use this as I've updated the comments.

@p5pRT
Copy link
Author

p5pRT commented Nov 14, 2013

From alanh@fairlite.co.uk

freemint.sh

@p5pRT
Copy link
Author

p5pRT commented Nov 15, 2013

From @tonycoz

On Thu Nov 14 08​:51​:52 2013, alanh wrote​:

Actually, scrap that last freemint.sh hints file and use this as I've
updated the comments.

I'm confused by this.

Your hints file enabled shared libraries through dl_freeminit.xs, but sets "so" to 'none' - does that mean non-XS shared libraries are not supported?

Other comments​:

1) Instead of setting malloc_cflags, you might want to set usemymalloc=n, so perl uses the system malloc instead of its own, though possibly you could use both so someone could enable usemymalloc with -Dusemymalloc=y at Configure time​:

case "$usemymalloc" in
'') usemymalloc='n' ;;
esac
malloc_cflags='ccflags="-DUSE_PERL_SBRK -DPERL_SBRK_VIA_MALLOC $ccflags"'

2) are you writing a README.mint file? The hints file refers to one, but blead doesn't include it.

Tony

@p5pRT
Copy link
Author

p5pRT commented Nov 15, 2013

From @tonycoz

On Thu Nov 14 08​:51​:52 2013, alanh wrote​:

Actually, scrap that last freemint.sh hints file and use this as I've
updated the comments.

I've pushed an updated branch with your changes.

The same link​:

http​://perl5.git.perl.org/perl.git/snapshot/refs/heads/tonyc/freemint.tar.gz

should download the new changes.

Tony

@p5pRT
Copy link
Author

p5pRT commented Nov 15, 2013

From alanh@fairlite.co.uk

On 11/15/13 00​:47, Tony Cook via RT wrote​:

On Thu Nov 14 08​:51​:52 2013, alanh wrote​:

Actually, scrap that last freemint.sh hints file and use this as I've
updated the comments.
I'm confused by this.

Your hints file enabled shared libraries through dl_freeminit.xs, but sets "so" to 'none' - does that mean non-XS shared libraries are not supported?

That's correct. The system doesn't have generalized shared libraries.
That's why we only support XS shared objects through our dld interface.

Other comments​:

1) Instead of setting malloc_cflags, you might want to set usemymalloc=n, so perl uses the system malloc instead of its own, though possibly you could use both so someone could enable usemymalloc with -Dusemymalloc=y at Configure time​:

case "$usemymalloc" in
'') usemymalloc='n' ;;
esac
malloc_cflags='ccflags="-DUSE_PERL_SBRK -DPERL_SBRK_VIA_MALLOC $ccflags"'

Gotcha. I see darwin does this too, so I'll add the case/esac clause.

2) are you writing a README.mint file? The hints file refers to one, but blead doesn't include it.

No, that reference can be dropped.

Alan.

@p5pRT
Copy link
Author

p5pRT commented Nov 15, 2013

From alanh@fairlite.co.uk

On 11/15/13 01​:01, Tony Cook via RT wrote​:

On Thu Nov 14 08​:51​:52 2013, alanh wrote​:

Actually, scrap that last freemint.sh hints file and use this as I've
updated the comments.
I've pushed an updated branch with your changes.

The same link​:

http​://perl5.git.perl.org/perl.git/snapshot/refs/heads/tonyc/freemint.tar.gz

should download the new changes.

Thanks, I'm compiling now.

Alan.

@p5pRT
Copy link
Author

p5pRT commented Nov 15, 2013

From alanh@fairlite.co.uk

Hi Tony,

Final freemint.sh hints patch attached.

There's a few test failures, but they're nothing to do with the build
process now, looks like they are libc/system level bugs.

Thanks,

Alan.

@p5pRT
Copy link
Author

p5pRT commented Nov 15, 2013

From alanh@fairlite.co.uk

freemint.sh.patch
--- hints/freemint.sh.old	2013-11-15 00:56:46.000000000 +0000
+++ hints/freemint.sh	2013-11-15 13:11:01.987496982 +0000
@@ -1,9 +1,6 @@
 # hints/freemint.sh
 #
-# talk to alanh@freemint.org if you want to change this file.
-# Please read the README.mint file.
-#
-# misc stuff
+# Contact alanh@freemint.org if you want to change this file.
 
 archname="m68k-freemint"
 
@@ -24,6 +21,16 @@
 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"'

@p5pRT
Copy link
Author

p5pRT commented Nov 17, 2013

From @tonycoz

On Fri Nov 15 05​:52​:47 2013, alanh wrote​:

Hi Tony,

Final freemint.sh hints patch attached.

There's a few test failures, but they're nothing to do with the build
process now, looks like they are libc/system level bugs.

I've applied that change, squashing it into the original hints change, and pushed
back to the same branch, please try​:

http​://perl5.git.perl.org/perl.git/snapshot/refs/heads/tonyc/freemint.tar.gz

again.

Thanks,
Tony

@p5pRT
Copy link
Author

p5pRT commented Nov 18, 2013

From alanh@fairlite.co.uk

On 11/17/13 23​:04, Tony Cook via RT wrote​:

On Fri Nov 15 05​:52​:47 2013, alanh wrote​:

Hi Tony,

Final freemint.sh hints patch attached.

There's a few test failures, but they're nothing to do with the build
process now, looks like they are libc/system level bugs.
I've applied that change, squashing it into the original hints change, and pushed
back to the same branch, please try​:

http​://perl5.git.perl.org/perl.git/snapshot/refs/heads/tonyc/freemint.tar.gz

All good Tony. Thanks !

@p5pRT
Copy link
Author

p5pRT commented Nov 18, 2013

From @tonycoz

On Mon Nov 18 01​:54​:45 2013, alanh wrote​:

On 11/17/13 23​:04, Tony Cook via RT wrote​:

On Fri Nov 15 05​:52​:47 2013, alanh wrote​:

Hi Tony,

Final freemint.sh hints patch attached.

There's a few test failures, but they're nothing to do with the
build
process now, looks like they are libc/system level bugs.
I've applied that change, squashing it into the original hints
change, and pushed
back to the same branch, please try​:

http​://perl5.git.perl.org/perl.git/snapshot/refs/heads/tonyc/freemint.tar.gz

All good Tony. Thanks !

Can you summarize how well FreeMINT support works for use in perldelta?

eg. Perl now builds on FreeMINT but fails (many|a few|specific) tests.

Tony

@p5pRT
Copy link
Author

p5pRT commented Nov 18, 2013

From @Hugmeir

On Mon, Nov 18, 2013 at 8​:38 PM, Tony Cook via RT <perlbug-followup@​perl.org

wrote​:

On Mon Nov 18 01​:54​:45 2013, alanh wrote​:

On 11/17/13 23​:04, Tony Cook via RT wrote​:

On Fri Nov 15 05​:52​:47 2013, alanh wrote​:

Hi Tony,

Final freemint.sh hints patch attached.

There's a few test failures, but they're nothing to do with the
build
process now, looks like they are libc/system level bugs.
I've applied that change, squashing it into the original hints
change, and pushed
back to the same branch, please try​:

http​://perl5.git.perl.org/perl.git/snapshot/refs/heads/tonyc/freemint.tar.gz

All good Tony. Thanks !

Can you summarize how well FreeMINT support works for use in perldelta?

eg. Perl now builds on FreeMINT but fails (many|a few|specific) tests.

I went through those steps for Android a while back; if I recall correctly,
what more or else needs doing for a "new" platform is​:
An entry in Perl​::OSType.
An update to perlport.pod, at least to the list of supported OSs, and
optionally to the main body of the file if there's any particular gotcha's
in the system.
An entry in perldelta.
A README.platform, particularly if it requires some particular building
steps or some build types are not possible/problematic (e.g. threads,
shared libperl)
Possibly an entry in Porting/todo.pod if some parts of the port need some
love?

@p5pRT
Copy link
Author

p5pRT commented Nov 27, 2013

From @Leont

On Tue, Sep 17, 2013 at 9​:11 AM, Nicholas Clark <nick@​ccl4.org> wrote​:

On Mon, Sep 16, 2013 at 02​:16​:02PM -0700, Alan Hourihane via RT wrote​:

Also, we need the above comment rectifying so we don't lose dld support.

The dl_dld.xs file makes no use of any of the probing done by Configure -
for example, it unconditionally includes <dld.h> instead of wrapping it in
C pre-processor macros. So we don't need to re-instate the probes.

Also, no other platform is using dld, so if we put the file back as
dl_mint.xs, I believe that Configure (as-is) will automatically pick it up
for MiNT. ($osname is set to 'mint', correct?)

That keeps Configure simpler, without stopping MiNT working.

Nicholas Clark

ExtUtils​::Mkbootstrap contains some specific code for «$Config{'dlsrc'} =~
/^dl_dld/». I have no idea if this should be updated or simply removed,
someone with more clue of dld/mint should take a look at it. It might
explain the «libc/system level bugs» mentioned below.

Leon

@p5pRT
Copy link
Author

p5pRT commented Jan 15, 2014

From @tonycoz

On Mon Nov 18 15​:38​:39 2013, tonyc wrote​:

On Mon Nov 18 01​:54​:45 2013, alanh wrote​:

On 11/17/13 23​:04, Tony Cook via RT wrote​:

On Fri Nov 15 05​:52​:47 2013, alanh wrote​:

Hi Tony,

Final freemint.sh hints patch attached.

There's a few test failures, but they're nothing to do with the
build
process now, looks like they are libc/system level bugs.
I've applied that change, squashing it into the original hints
change, and pushed
back to the same branch, please try​:

http​://perl5.git.perl.org/perl.git/snapshot/refs/heads/tonyc/freemint.tar.gz

All good Tony. Thanks !

Can you summarize how well FreeMINT support works for use in
perldelta?

eg. Perl now builds on FreeMINT but fails (many|a few|specific)
tests.

Hi Alan,

Any chance of getting this summary?

Tony

@p5pRT
Copy link
Author

p5pRT commented Jan 15, 2014

From alanh@fairlite.co.uk

On 01/15/14 03​:54, Tony Cook via RT wrote​:

On Mon Nov 18 15​:38​:39 2013, tonyc wrote​:

On Mon Nov 18 01​:54​:45 2013, alanh wrote​:

On 11/17/13 23​:04, Tony Cook via RT wrote​:

On Fri Nov 15 05​:52​:47 2013, alanh wrote​:

Hi Tony,

Final freemint.sh hints patch attached.

There's a few test failures, but they're nothing to do with the
build
process now, looks like they are libc/system level bugs.
I've applied that change, squashing it into the original hints
change, and pushed
back to the same branch, please try​:

http​://perl5.git.perl.org/perl.git/snapshot/refs/heads/tonyc/freemint.tar.gz

All good Tony. Thanks !
Can you summarize how well FreeMINT support works for use in
perldelta?

eg. Perl now builds on FreeMINT but fails (many|a few|specific)
tests.
Hi Alan,

Any chance of getting this summary?

Yes, sorry Tony.

"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."

That's all really. Nothing more needed.

Alan.

@p5pRT
Copy link
Author

p5pRT commented Jan 16, 2014

From @tonycoz

On Wed Jan 15 04​:11​:29 2014, alanh wrote​:

"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."

That's all really. Nothing more needed.

All the various patches applied as​:

817bb57 dld support for FreeMINT
f48d8d9 your changes
cbc0b81 remove -lm -lposix
fa1b2c4 hints file
16ef6dd welcome to AUTHORS
dcfa750 a note in perlport.

Tony

@p5pRT
Copy link
Author

p5pRT commented Jan 16, 2014

From alanh@fairlite.co.uk

On 01/16/14 04​:41, Tony Cook via RT wrote​:

On Wed Jan 15 04​:11​:29 2014, alanh wrote​:

"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."

That's all really. Nothing more needed.
All the various patches applied as​:

817bb57 dld support for FreeMINT
f48d8d9 your changes
cbc0b81 remove -lm -lposix
fa1b2c4 hints file
16ef6dd welcome to AUTHORS
dcfa750 a note in perlport.

Thanks Tony !

Alan.

@p5pRT
Copy link
Author

p5pRT commented Jan 21, 2014

@tonycoz - Status changed from 'open' to 'resolved'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant