parrot 1.0.0 on NetBSD/macppc 4.0

Havard Eidnes he at NetBSD.org
Mon Mar 23 18:19:16 UTC 2009


Hi,

I decided to look at how difficult it would be to get the
recently released parrot 1.0.0 going on NetBSD/macppc 4.0.

The answer turned out to be "not very". :)  Cheers for good
portability!

I had to make a few minor adjustments to the code, due to the
following differences between Linux/ppc and NetBSD/macppc (or
generally NetBSD/powerpc) targets:

1) The assembler on NetBSD/macppc insists that powerpc registers
   are named with a % prefix.  I'm assuming linux accepts that
   syntax.

2) The C compiler on NetBSD does not prepend underscores to
   symbols when emitting ELF objects, so the small assembly code
   fragment to save the non-volatile registers had to be adjusted
   accordingly.  It appears that preprocessor symbols are
   available while compiling the assembly code, so I just did a
   simple #ifdef.

3) A couple of ELF-related PPC preprocessor symbols are named
   differently in NetBSD (not sure where the appropriate place is
   for that workaround).

I've attached my local changes to deal with these three issues.
With these in place, my build completed, and a "make test"
succeeded with

All tests successful, 17 tests and 580 subtests skipped.
Files=398, Tests=11569, 584 wallclock secs (429.43 cusr + 106.05 csys = 535.48 CPU)

I noticed that after "make test" I was left with a core dump from
parrot, but closer inspection reveals this appears to test the
"hcf" op, so that's to be expected (and the tests passed).

I'll also note that during the build a number of warnings are
emitted, similar to this:

src/ops/core_ops_switch.c
src/ops/core.ops: In function 'switch_core':
src/ops/core.ops:165: warning: cast increases required alignment of target type
src/ops/core.ops:191: warning: cast increases required alignment of target type
src/ops/core.ops:204: warning: cast increases required alignment of target type
src/ops/core.ops:212: warning: cast increases required alignment of target type
src/ops/core.ops:236: warning: cast increases required alignment of target type

(the list goes on, also for several other files...)  The first
one of these appears to be (from src/ops/core_ops_switch.c:

case 8: /* load_bytecode_s */ {
#line 165 "src/ops/core.ops"
    Parrot_load_bytecode(interp, (*(STRING **)OP_AS_OFFS(1)));


Lastly, I'll just note that I'm not a member of this list, so
please include me in CCs of follow-up messages.

Best regards,

- Håvard
-------------- next part --------------
--- src/jit/ppc/asm.s.orig      2009-03-08 21:32:42.000000000 +0100
+++ src/jit/ppc/asm.s
@@ -1,25 +1,30 @@
 .text
     .align 12
+#ifdef __linux__
     .globl _Parrot_ppc_jit_restore_nonvolatile_registers
 _Parrot_ppc_jit_restore_nonvolatile_registers:
+#else
+    .globl Parrot_ppc_jit_restore_nonvolatile_registers
+Parrot_ppc_jit_restore_nonvolatile_registers:
+#endif
 
-    lfd     f14,-84(r1)
-    lfd     f15,-92(r1)
-    lfd     f16,-100(r1)
-    lfd     f17,-108(r1)
-    lfd     f18,-116(r1)
-    lfd     f19,-124(r1)
-    lfd     f20,-132(r1)
-    lfd     f21,-140(r1)
-    lfd     f22,-148(r1)
-    lfd     f23,-156(r1)
-    lfd     f24,-164(r1)
-    lfd     f25,-172(r1)
-    lfd     f26,-180(r1)
-    lfd     f27,-188(r1)
-    lfd     f28,-196(r1)
-    lfd     f29,-204(r1)
-    lfd     f30,-212(r1)
-    lfd     f31,-220(r1)
+    lfd     %f14,-84(%r1)
+    lfd     %f15,-92(%r1)
+    lfd     %f16,-100(%r1)
+    lfd     %f17,-108(%r1)
+    lfd     %f18,-116(%r1)
+    lfd     %f19,-124(%r1)
+    lfd     %f20,-132(%r1)
+    lfd     %f21,-140(%r1)
+    lfd     %f22,-148(%r1)
+    lfd     %f23,-156(%r1)
+    lfd     %f24,-164(%r1)
+    lfd     %f25,-172(%r1)
+    lfd     %f26,-180(%r1)
+    lfd     %f27,-188(%r1)
+    lfd     %f28,-196(%r1)
+    lfd     %f29,-204(%r1)
+    lfd     %f30,-212(%r1)
+    lfd     %f31,-220(%r1)
 
     blr
-------------- next part --------------
--- src/exec_save.c.orig        2009-03-08 21:32:43.000000000 +0100
+++ src/exec_save.c
@@ -30,6 +30,11 @@ static void save_int(FILE *fp, int i);
 static void save_short(FILE *fp, short s);
 static void save_struct(FILE *fp, void *sp, size_t size);
 
+#if defined(PARROT_PPC) && defined(__NetBSD__)
+#define        R_PPC_ADDR16_HI R_PPC_16_HI
+#define        R_PPC_ADDR16_LO R_PPC_16_LO
+#endif /* PARROT_PPC && __NetBSD__ */
+
 #ifdef EXEC_A_OUT
 
 #  include <a.out.h>


More information about the parrot-dev mailing list