Ticket #512 (closed bug: fixed)

Opened 13 years ago

Last modified 13 years ago

Porting parrot 1.0.0 to NetBSD/macppc

Reported by: heidnes Owned by:
Priority: normal Milestone: 1.1
Component: core Version: 1.0.0
Severity: medium Keywords:
Cc: he@… Language:
Patch status: applied Platform: netbsd

Description

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! (But there's another bug report on the way about a non-portable use of the == operator to the "test" program...)

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

1) The assembler on NetBSD/macppc insists that powerpc registers

must be named with a % prefix. I have verified that Linux/ppc accepts that syntax as well.

2) There is some strange difference going on with respect to

whether externally visible symbols in assembly should have a leading underscore or not, apparently. This affects the minimal assembly fragment for saving the non-volatile registers. Since the assembly code is apparently passed through the preprocessor, a simple #ifdef cured this problem.

3) A couple of ELF-related PPC preprocessor symbols are named

differently in NetBSD. I'm not entirely sure where the correct place is for that workaround -- feel free to relocate to a more appropriate spot.

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)

Your already tracked issue for OpenBSD at

 http://rt.perl.org/rt3//Public/Bug/Display.html?id=40959

should also be fixed by this particular bugfix.

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)));

--- osname= netbsd osvers= 4.0 arch= powerpc-netbsd-thread-multi cc= cc --- Flags:

category=core severity=medium ack=no

--- Summary of my parrot 1.0.0 (r0) configuration:

configdate='Mon Mar 23 17:27:34 2009 GMT' Platform:

osname=netbsd, archname=powerpc-netbsd-thread-multi jitcapable=1, jitarchname=ppc-netbsd, jitosname=NETBSD, jitcpuarch=ppc execcapable=1 perl=perl

Compiler:

cc='cc', ccflags=' -pipe -pthread -DHASATTRIBUTE_CONST -DHASATTRIBUTE_DEPRECATED -DHASATTRIBUTE_MALLOC -DHASATTRIBUTE_NONNULL -DHASATTRIBUTE_NORETURN -DHASATTRIBUTE_PURE -DHASATTRIBUTE_UNUSED -DHASATTRIBUTE_WARN_UNUSED_RESULT -falign-functions=16 -fvisibility=hidden -funit-at-a-time -W -Wall -Waggregate-return -Wcast-align -Wcast-qual -Wchar-subscripts -Wcomment -Wdisabled-optimization -Wendif-labels -Wextra -Wformat -Wformat-extra-args -Wformat-nonliteral -Wformat-security -Wformat-y2k -Wimplicit -Wimport -Winit-self -Winline -Winvalid-pch -Wmissing-braces -Wmissing-field-initializers -Wno-missing-format-attribute -Wmissing-include-dirs -Wpacked -Wparentheses -Wpointer-arith -Wreturn-type -Wsequence-point -Wno-shadow -Wsign-compare -Wstrict-aliasing -Wstrict-aliasing=2 -Wswitch -Wswitch-default -Wtrigraphs -Wundef -Wunknown-pragmas -Wno-unused -Wvariadic-macros -Wwrite-strings -Wbad-function-cast -Wc++-compat -Wdeclaration-after-statement -Wimplicit-function-declaration -Wimplicit-int -Wmain -Wmissing-declarations -Wmissing-prototypes -Wnested-externs -Wnonnull -DHAS_GETTEXT',

Linker and Libraries:

ld='cc', ldflags='-Wl,-R/usr/pkg/lib ', cc_ldflags=, libs='-lm -lcrypt -lpthread -lintl'

Dynamic Linking:

share_ext='.so', ld_share_flags='-Wl,-R/usr/pkg/lib --whole-archive -shared ', load_ext='.so', ld_load_flags='-Wl,-R/usr/pkg/lib --whole-archive -shared '

Types:

iv=long, intvalsize=4, intsize=4, opcode_t=long, opcode_t_size=4, ptrsize=4, ptr_alignment=1 byteorder=4321, nv=double, numvalsize=8, doublesize=8, longdoublesize=8

--- Environment:

HOME =/usr/users/he LANG (unset) LANGUAGE (unset) LD_LIBRARY_PATH (unset) LOGDIR (unset) PATH =/usr/users/he/bin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/X11R6/bin:/usr/pkg/bin:/usr/pkg/sbin:/usr/games:/usr/local/bin:/usr/local/sbin SHELL =/bin/csh

Attachments

ppc-diffs Download (1.8 KB) - added by heidnes 13 years ago.
diffs for porting parrot 1.0.0 to NetBSD/macppc 4.0
patch-ab Download (1.1 KB) - added by heidnes 13 years ago.
Alternative patch to src/exec_save.c
exec_save.c.diff Download (2.0 KB) - added by heidnes 13 years ago.
New diff moving the fix for NetBSD/OpenBSD to the correct place.

Change History

Changed 13 years ago by heidnes

diffs for porting parrot 1.0.0 to NetBSD/macppc 4.0

Changed 13 years ago by heidnes

See also https://trac.parrot.org/parrot/ticket/454 for probably a cleaner way of dealing with problem 3) above.

Changed 13 years ago by heidnes

Alternative patch to src/exec_save.c

Changed 13 years ago by heidnes

I retract the suggestion that https://trac.parrot.org/parrot/ticket/454 is a better fix, the patch in patch-ab has additional portability to NetBSD/powerpc 3.x.

Changed 13 years ago by heidnes

BTW, I've verified that Linux accepts the %rNN register notation. I've been told the diff needs to be verified on OSX/ppc as well.

Changed 13 years ago by heidnes

BTW, I've submitted smolder reports for NetBSD/macppc 4.0 and NetBSD/macppc 3.1 at  http://smolder.plusthree.com/app/public_projects/report_details/20015 and  http://smolder.plusthree.com/app/public_projects/report_details/20009 are those results, 100% pass.

Changed 13 years ago by Infinoid

  • status changed from new to closed
  • resolution set to fixed
  • patch set to applied

Thanks, applied (with some modifications as discussed on IRC) in r38186. Please test on the platforms you have available and reopen (and let me know) if you have any more build issues.

Changed 13 years ago by heidnes

New diff moving the fix for NetBSD/OpenBSD to the correct place.

Note: See TracTickets for help on using tickets.