Subject: Re: Converting NetBSD 3.0 for Sun3 to default a.out format
To: None <SigmFSK@aol.com>
From: Izumi Tsutsui <tsutsui@ceres.dti.ne.jp>
List: port-m68k
Date: 09/22/2006 23:45:18
SigmFSK@aol.com wrote:
> My questions are:
> 1) how do I view the source-code changes made for "CHS 20010222" (or any
> particular change) so that I can determine what to "undo" to make a custom
> NetBSD 3.0 release with a.out default format that will hopefully work with my old
> a.out executables.
Newer toolchains no longer support (NetBSD derived) a.out with shlib
(the latest one is egcs-1.1.1). That was the reason we switched
from a.out to ELF. The major change on it was just a compiler, and
most other changes were minor tweaks to adapt some a.out dependent
pieces to ELF format. Actually when I switched news68k to ELF,
NetBSD/news68k kernel could be compiled by both a.out and ELF toolchains.
But there are ABI differences between m68k a.out and ELF,
so you can't use binaries which refer structures with possible
incompatibility.
The problem could occur on passing syscall args from a.out userland
to ELF kernel. The ELF kernel assumes 32bit variables in structures
are 4 byte aligned, but it's not true on a.out userland binaries.
I guess the biggest problem is that we have no support for a.out
compatibility in COMPAT_SUNOS code, though COMPAT_AOUT_M68K has
only minimum compat support anyway.
See how src/sys/compat/aoutm68k/aoutm68k_stat.c etc. handles
incompatibilities in structures.
> 2) are there any major problems with building a custom NetBSD Sun3 current
> release with default a.out format instead of elf
I also doubt current sources can be compiled under a.out toolchains
because new toolchains don't support m68k a.out anymore and many of
current sources also use new features of newer gcc.
> 3) has anybody done this?
Maybe no. There was an m68k-netbsd a.out cross package, but it looks
already removed though you could dig it out from Attic:
http://cvsweb.netbsd.org/bsdweb.cgi/pkgsrc/cross/m68k-netbsd/
> So I can run NetBSD 1.5.3, and it works quite well, but after running a day
> or so, it gets an "awk" process that takes 50% of the cpu time. I'm sure
> this can be fixed,
sun3x pmap had had several bugs. IIRC some of them are fixed before 1.4,
but I also fixed one more recently. Maybe you could try to apply changes
in sun3x/pmap.c rev 1.91:
http://cvsweb.netbsd.org/bsdweb.cgi/src/sys/arch/sun3/sun3x/pmap.c#rev1.91
to netbsd-1-5 branch. (though you might have to resolve a bunch of *.rej)
> but rather than being permanently stuck at NetBSD 1.5.3, I'd
> rather just always be able to run the latest version of NetBSD, just with
> default a.out format (hopefully allowing my SunOS 4.1.1 a.out executables to
> run).
If you could get a.out toolchains, a.out NetBSD 3.x kernel might
work with 1.5.3 a.out userland, but I'm afraid it isn't easy to build
working kernel. (link_set-* sections might be problematic)
I think it's the right way to track which syscalls fails (by ktrace(1))
and to implement a.out compat support for such syscalls in
both src/sys/compat/sunos and src/sys/compat/aoutm68k.
---
Izumi Tsutsui