mirror of
https://git.musl-libc.org/git/musl
synced 2025-02-09 06:44:22 +03:00
move static-linked stub dlsym out of dynlink.c
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.
This commit is contained in:
parent
14469371cd
commit
4058795d49
13
src/ldso/__dlsym.c
Normal file
13
src/ldso/__dlsym.c
Normal file
@ -0,0 +1,13 @@
|
||||
#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);
|
@ -1,3 +1,4 @@
|
||||
#ifdef SHARED
|
||||
#define _GNU_SOURCE
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
@ -23,8 +24,6 @@
|
||||
|
||||
static void error(const char *, ...);
|
||||
|
||||
#ifdef SHARED
|
||||
|
||||
#define MAXP2(a,b) (-(-(a)&-(b)))
|
||||
#define ALIGN(x,y) ((x)+(y)-1 & -(y))
|
||||
|
||||
@ -1913,13 +1912,6 @@ int dl_iterate_phdr(int(*callback)(struct dl_phdr_info *info, size_t size, void
|
||||
}
|
||||
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);
|
||||
@ -1928,7 +1920,6 @@ static void error(const char *fmt, ...)
|
||||
{
|
||||
va_list ap;
|
||||
va_start(ap, fmt);
|
||||
#ifdef SHARED
|
||||
if (!runtime) {
|
||||
vdprintf(2, fmt, ap);
|
||||
dprintf(2, "\n");
|
||||
@ -1936,7 +1927,7 @@ static void error(const char *fmt, ...)
|
||||
va_end(ap);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
__dl_vseterr(fmt, ap);
|
||||
va_end(ap);
|
||||
}
|
||||
#endif
|
||||
|
Loading…
x
Reference in New Issue
Block a user