Subject: ELF modload
To: None <port-alpha@netbsd.org>
From: Johan Danielsson <joda@pdc.kth.se>
List: port-alpha
Date: 09/12/1998 05:51:36
Since I was in some need of beeing able to load kernel modules on my
Alpha, I hacked modload to handle ELF files. The result can be found
at: ftp://ftp.pdc.kth.se/home/joda/elf-modload.tar.gz

It is a bit ugly, but works for me. I have tried on all my accessible
ELF NetBSD machines (a grand total of one). It should work with a.out,
ELF32 and ELF64 (not all at once, but that's really a linker problem).

The following buglets was found while doing this:

* Some machine/whatever.h should define ELFSIZE.

* sys/exec_elf.h should perhaps define ELF_HDR_SIZE.

* The LKM interface is simple, but very a.out centric -- if you have
  an ELF file where each section is loaded at funny addresses, you
  might have to reserve a huge kernel buffer to be able to load it.
  The code tries to handle the fact that the .data section is normally
  offset MAXPAGESIZE from the .rodata section.


The tar-file also contains a patched modstat, that works with 8 byte
pointers.

Share and enjoy.

/Johan