the function name is still __-prefixed because it requires an asm
wrapper to pass the caller's address in order for RTLD_NEXT to work.
since this was the last function in dynlink.c still used for static
linking, now the whole file is conditional on SHARED being defined.
--- /dev/null
+#include <dlfcn.h>
+#include "libc.h"
+
+__attribute__((__visibility__("hidden")))
+void __dl_seterr(const char *, ...);
+
+static void *stub_dlsym(void *restrict p, const char *restrict s, void *restrict ra)
+{
+ __dl_seterr("Symbol not found: %s", s);
+ return 0;
+}
+
+weak_alias(stub_dlsym, __dlsym);
+#ifdef SHARED
#define _GNU_SOURCE
#include <stdio.h>
#include <stdlib.h>
static void error(const char *, ...);
-#ifdef SHARED
-
#define MAXP2(a,b) (-(-(a)&-(b)))
#define ALIGN(x,y) ((x)+(y)-1 & -(y))
}
return ret;
}
-#else
-void *__dlsym(void *restrict p, const char *restrict s, void *restrict ra)
-{
- error("Symbol not found: %s", s);
- return 0;
-}
-#endif
__attribute__((__visibility__("hidden")))
void __dl_vseterr(const char *, va_list);
{
va_list ap;
va_start(ap, fmt);
-#ifdef SHARED
if (!runtime) {
vdprintf(2, fmt, ap);
dprintf(2, "\n");
va_end(ap);
return;
}
-#endif
__dl_vseterr(fmt, ap);
va_end(ap);
}
+#endif