@@ -65,7 +65,29 @@ struct lib {
6565typedef struct lib lib_t ;
6666
6767#if defined(__unix__ )
68- #if UINTPTR_MAX == 0xffffffff
68+ #if defined(__linux__ ) && !defined(__GLIBC__ )
69+ /* A non-glibc Linux libc, e.g. musl on Alpine: libc, libm, libpthread, and
70+ libdl all live in one shared object, installed as the dynamic loader
71+ /lib/ld-musl-<arch>.so.1 on musl. */
72+ #if defined(__x86_64__ )
73+ #define MUSL_LIB_ARCH "x86_64"
74+ #elif defined(__aarch64__ )
75+ #define MUSL_LIB_ARCH "aarch64"
76+ #elif defined(__PPC64__ ) && __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
77+ #define MUSL_LIB_ARCH "powerpc64le"
78+ #elif defined(__PPC64__ )
79+ #define MUSL_LIB_ARCH "powerpc64"
80+ #elif defined(__s390x__ )
81+ #define MUSL_LIB_ARCH "s390x"
82+ #elif defined(__riscv )
83+ #define MUSL_LIB_ARCH "riscv64"
84+ #else
85+ #error cannot recognize the non-glibc linux target
86+ #endif
87+ static lib_t std_libs []
88+ = {{"/lib/ld-musl-" MUSL_LIB_ARCH ".so.1" , NULL }, {"/usr/lib/libc.so" , NULL }};
89+ static const char * std_lib_dirs [] = {"/lib" , "/usr/lib" };
90+ #elif UINTPTR_MAX == 0xffffffff
6991static lib_t std_libs []
7092 = {{"/lib/libc.so" , NULL }, {"/lib/libm.so" , NULL }, {"/lib/libc.so.6" , NULL },
7193 {"/lib32/libc.so.6" , NULL }, {"/lib/libm.so.6" , NULL }, {"/lib32/libm.so.6" , NULL },
0 commit comments