AC_PROG_LD
AC_PROG_LD_GNU
-AC_CHECK_HEADERS(sys/filio.h sys/sockio.h netdb.h utime.h sys/utime.h semaphore.h sys/un.h linux/rtc.h sys/syscall.h sys/mkdev.h sys/uio.h sys/param.h sys/sysctl.h libproc.h sys/prctl.h copyfile.h)
+AC_CHECK_HEADERS(sys/filio.h sys/sockio.h netdb.h utime.h sys/utime.h semaphore.h sys/un.h linux/rtc.h sys/syscall.h sys/mkdev.h sys/uio.h sys/param.h sys/sysctl.h libproc.h sys/prctl.h copyfile.h gnu/lib-names.h)
AC_CHECK_HEADERS(sys/param.h sys/socket.h sys/ipc.h sys/utsname.h alloca.h ucontext.h pwd.h sys/select.h netinet/tcp.h netinet/in.h unistd.h sys/types.h link.h asm/sigcontext.h sys/inotify.h arpa/inet.h complex.h unwind.h)
# zlib/configure checks for unistd.h existance and defines HAVE_UNISTD_H on the compiler
#include <string.h>
#include <glib.h>
+// Contains LIBC_SO definition
+#ifdef HAVE_GNU_LIBNAMES_H
+#include <gnu/lib-names.h>
+#endif
+
struct MonoDlFallbackHandler {
MonoDlFallbackLoad load_func;
MonoDlFallbackSymbol symbol_func;
return line;
}
+#ifdef ENABLE_NETCORE
+static const char *
+fix_libc_name (const char *name)
+{
+ if (strncmp (name, "libc", 4) == 0) {
+ // Taken from CoreCLR: https://github.com/dotnet/coreclr/blob/6b0dab793260d36e35d66c82678c63046828d01b/src/pal/src/loader/module.cpp#L568-L576
+#if defined (HOST_DARWIN)
+ return "/usr/lib/libc.dylib";
+#elif defined (__FreeBSD__)
+ return "libc.so.7";
+#elif defined (LIBC_SO)
+ return LIBC_SO;
+#else
+ return "libc.so";
+#endif
+ }
+ return name;
+}
+#endif
+
/**
* mono_dl_open:
* \param name name of file containing shared module
}
module->main_module = name == NULL? TRUE: FALSE;
+#ifdef ENABLE_NETCORE
+ name = fix_libc_name (name);
+#endif
+
// No GC safe transition because this is called early in main.c
lib = mono_dl_open_file (name, lflags);