Hello all, there is a compatiblity hack in ld.elf_so for early ELF binaries that I would like to restructure and restrict to those architectures that actually need it. Short version is that crt0.o would contain dlopen(3) and friends and implement them by calling a pointer stored in the handle passed to _start from the dynamic linker. The handle is not used for any other purpose than checking some magic values and those function pointers.
The change that dropped this code from crt0.o can be found in https://anonhg.netbsd.org/src/rev/897109941a9a Determining which architectures need this hack is a bit tricky. From the subdirectory list of https://anonhg.netbsd.org/src/file/897109941a9a/libexec/ld.elf_so/arch there was some form of ld.elf_so support for alpha, i386, m68k, mips, powerpc, sparc and vax. m68k and vax can be dropped from the list, they only contained some stub startup code. That leaves alpha, i386, mips, powerpc and sparc. The list of platforms where ELF was enabled by default can be found in https://anonhg.netbsd.org/src/file/897109941a9a/share/mk/bsd.own.mk#l96 Note that this also includes sparc64. This makes no sense as the dynamic linker had no support for it at the time. Do we care about binaries build in a system before ELF was fully working? Otherwise I would strictly reduce the compatibility hack to the above mentioned five architectures. The difference is 132-256 Bytes in .data and a couple of relocations. Joerg