Details

GHC has code to handle unsuffixed .so files that are linker scripts pointing to the real shared library. The detection is done by parsing the result of dlerror() after calling dlopen() and looking for certain error strings. On musl libc, the error message is "Exec format error", which happens to be strerror(ENOEXEC):

Wow, I wasn't aware of this awful little bit of code. Well, given that it exists it does seem reasonable to extend it for musl. However, I can't help but wonder whether there isn't a better way to accomplish this.