Subject: Heads up: mvme68k will soon switch to ELF in -current
To: None <port-mvme68k@netbsd.org>
From: Steve Woodford <scw@netbsd.org>
List: port-mvme68k
Date: 12/02/2000 21:26:08
Hi folks,
Those of you who follow source-changes will perhaps have noticed a bunch
of commits I made which hint at moving mvme68k over to the ELF object file
format.
Basically, most NetBSD ports use the ELF capable toolchain, including
gnu/usr.bin/gas.new and gnu/usr.bin/ld.new. However, all of the m68k-based
ports currently use the old a.out toolchain. It has long been a goal of
the Project to migrate all m68k ports over to ELF; it's just taking
somewhat longer than we'd like. :-/
That said, mvme68k is *almost* ready to make the switch. I still have some
issues with the bootloaders to fix (installboot doesn't grok ELF
files) which shouldn't take too long.
Once I make the switch, I'll upload a snapshot to the ftp server which you
can use to upgrade your systems. Those of you tracking -current who wish
to upgrade by compiling from source will have a slightly harder
time. Details of how to do this will be made available.
Note: The switch to ELF involvs an ABI change. This affects you in a
couple of ways, including:
1) structure padding/alignment constraints have changed. Thus, the
following structure will have a different size under ELF compared to
a.out, and `baz' will be at a different offset due to padding:
struct foo {
short bar; /* a.out: offset 0, ELF: offset 0 */
int baz; /* a.out: offset 2, ELF: offset 4 */
};
a.out: sizeof(struct foo) == 6
ELF: sizeof(struct foo) == 8
The reason for this ABI change is to avoid inventing another m68k ELF ABI
since there is prior art in the form of the SVR4 ABI.
If you have software which is sensitive to structure padding, it will
likely break. One way around this is to wrap the structure declaration
between "#pragma pack(2)" and "#pragma pack()". Alternatively you can use
__attribute__((__packed__)) to force the structure to be byte-packed. Note
that both of these are non-portable Gnu C extensions ...
2) If you have assembly language code which interacts with C, you should
note that the SVR4 ABI requires functions returning pointers to put the
return value in A0, not D0 as with a.out.
3) Existing m68k a.out binaries, including pre-ELF mvme68k binaries need a
kernel config option: "options COMPAT_AOUT_M68K". This provides an ABI
translation layer for system calls which are affected by the change. At
the time of writing, only `stat(2)' is catered for, but this is enough to
get most a.out m68k binaries running. Certain ioctl(2) calls are still
problematic, but these are mostly used by tools in /sbin and /usr/sbin
which you'll be replacing with their native ELF versions anyway. These
ioctls will be supported in the future.
As I said, once I formally make the switch to ELF, I'll post details on
how to upgrade your systems.
Finally, this will not affect those of you running NetBSD 1.5; there are
no plans to change from a.out on the 1.5 release branch.
Cheers, Steve