Switching to ELF

MINIX3 is switching to ELF as its new default binary format. a.out executables will still run for a while of course. But switching to ELF means taking into account a new toolchain and library (object) format, both mutually incompatible with the a.out toolchain and library format. This page describes the assumptions and mechanics of the switch.

Compilers

The compilers in the game are gcc, clang and ack. ack will only generate a.out, and will be obsolete in the future. gcc and clang are switching to generating ELF objects.

The Problem

The problem is that ELF-generating compilers require ELF binutils (i.e. assembler, linker), and these are mutually incompatible with the current a.out-producing binutils. So binutils and both (gcc, clang) compilers have to be synchronized.

The next problem is that linking ELF executables requires ELF libraries, again mutually incompatible with a.out, so libraries in the base system and binary packages in pkgsrc have to be synchronized with versions of compilers and binutils.

The Solution

The solution is that, starting at Minix 3.2.0, the base system detects whether ELF-generating binutils and clang are installed. If so, existing top-level Make targets gcc-libraries and clang-libraries won't work any more, they are obsolete. The elf-libraries changes from being a crossbuilt curiosity to a first class citizen; elf-libraries is the new gcc-libraries (built by clang, and used by both clang and gcc). As clang is available in the base system, elf-libraries is then also linked with world, thus promoting gcc-only libraries to a first class citizen.

Starting at the Minix 3.2.0 packages repository, all libraries are in ELF format. So the Minix version number is used to synchronize that switch. If you upgrade to 3.2.0, de-install the library packages you want to use, and re-install them from 3.2.0.

The Switch

(!) The easiest option by far is reinstall using a 3.2.0 .iso.

If you prefer upgrading from source instead:

then reboot with the new image.

Don't be too alarmed if it takes a long time - an extra set of libraries is built now (the ELF ones) with clang, which is a little slower than ack, and the first time around a little slower still because of the extra (quite slowly) one-time generated dependencies.

Example: the first time, 'make clean world' takes 5:34 on a certain test machine; the second time a mere 4:07.

The ACK set of libraries will disappear in the future, alleviating this problem.

If so, you are fully switched, congratulations.

a.out, ack and the future

a.out and ack will still be around for a while, partly because we can't boot from ELF executables yet, partly because the boot monitor is a 16-bit program and cannot be build with just clang, and perhaps other reasons. But the goal is to run the base system exclusively with clang, sharing a common object format with gcc, so we have a single library format.

MinixWiki: UsersGuide/ELFSwitch (last edited 2011-08-01 12:27:38 by BenGras)