Hi all,

I have just been through the process of shipping a program built on a recent glibc system for use on an old one. This has left me looking for an alternative.

In general, I like the approach of statically linking everything and shipping the single enormous binary. This solves the compatibility problems in exchange for removing dynamic linking.

Unfortunately I also like dlopen and the combination of static linking and dlopen is an unhappy one.

My thoughts on resolving this are:
1/ link the entire musl libc into a static main executable
2/ put all the symbols in a table analogous to a plt in this executable
3/ hack the loader to look in said table
4/ open plugin using dlopen

The idea is to keep main static enough that it doesn't need the system loader to start, yet dynamic enough that libc can be exported.

However, "first hack the loader" suggests there may be a better way. I'm essentially looking for a way of deploying an application that can load plugins without also installing the musl loader to the host. Can someone see a better solution?

Kind regards,

Jon