diff --git a/ldso/dynlink.c b/ldso/dynlink.c index f78a02e62fcaf96b32ab8631e46895879ec67b63..7200c8178ec114a8efd2217f885f699cfbc3acc5 100644 --- a/ldso/dynlink.c +++ b/ldso/dynlink.c @@ -299,8 +299,6 @@ static struct symdef find_sym(struct dso *dso, const char *s, int need_def) return def; } -hidden ptrdiff_t __tlsdesc_static(), __tlsdesc_dynamic(); - static void do_relocs(struct dso *dso, size_t *rel, size_t rel_size, size_t stride) { unsigned char *base = dso->base; @@ -2048,8 +2046,6 @@ int dl_iterate_phdr(int(*callback)(struct dl_phdr_info *info, size_t size, void return ret; } -hidden void __dl_vseterr(const char *, va_list); - static void error(const char *fmt, ...) { va_list ap; diff --git a/src/internal/dynlink.h b/src/internal/dynlink.h index 5717627a53575f214f1246b29b7c148e41437532..90b6e481d5158612029f7e1e71c80006ee28faf7 100644 --- a/src/internal/dynlink.h +++ b/src/internal/dynlink.h @@ -4,6 +4,8 @@ #include #include #include +#include +#include "libc.h" #if UINTPTR_MAX == 0xffffffff typedef Elf32_Ehdr Ehdr; @@ -95,4 +97,12 @@ struct fdpic_dummy_loadmap { typedef void (*stage2_func)(unsigned char *, size_t *); typedef _Noreturn void (*stage3_func)(size_t *); +hidden void *__dlsym(void *restrict, const char *restrict, void *restrict); + +hidden void __dl_seterr(const char *, ...); +hidden int __dl_invalid_handle(void *); +hidden void __dl_vseterr(const char *, va_list); + +hidden ptrdiff_t __tlsdesc_static(), __tlsdesc_dynamic(); + #endif diff --git a/src/ldso/__dlsym.c b/src/ldso/__dlsym.c index bf99dff8adc9d1db18abef84b694cb5d15cf24a1..012994a77d5728d3f5d36ac72a2c0e87460f46a5 100644 --- a/src/ldso/__dlsym.c +++ b/src/ldso/__dlsym.c @@ -1,8 +1,7 @@ #include +#include "dynlink.h" #include "libc.h" -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); diff --git a/src/ldso/dlclose.c b/src/ldso/dlclose.c index a774209d9cfa96563760a86ff97578dccba85f14..b839fe2f11298e46d36bb355d4f1295007a89dab 100644 --- a/src/ldso/dlclose.c +++ b/src/ldso/dlclose.c @@ -1,8 +1,7 @@ #include +#include "dynlink.h" #include "libc.h" -hidden int __dl_invalid_handle(void *); - int dlclose(void *p) { return __dl_invalid_handle(p); diff --git a/src/ldso/dlerror.c b/src/ldso/dlerror.c index c8c718ab3ccf5ec306f98c54ebb61ac295e4f24c..7e5ec23d7e1ac2426c04242c2a851068f04083cd 100644 --- a/src/ldso/dlerror.c +++ b/src/ldso/dlerror.c @@ -2,6 +2,7 @@ #include #include #include "pthread_impl.h" +#include "dynlink.h" #include "libc.h" char *dlerror() @@ -50,8 +51,6 @@ hidden void __dl_seterr(const char *fmt, ...) va_end(ap); } -hidden int __dl_invalid_handle(void *); - static int stub_invalid_handle(void *h) { __dl_seterr("Invalid library handle %p", (void *)h); diff --git a/src/ldso/dlinfo.c b/src/ldso/dlinfo.c index 1e2c550082f645c1c057844b2d58c5abf5cace49..a8a5ad567234922d72d389d064cee41a8ff4ca2f 100644 --- a/src/ldso/dlinfo.c +++ b/src/ldso/dlinfo.c @@ -1,11 +1,8 @@ #define _GNU_SOURCE #include +#include "dynlink.h" #include "libc.h" -hidden int __dl_invalid_handle(void *); - -hidden void __dl_seterr(const char *, ...); - int dlinfo(void *dso, int req, void *res) { if (__dl_invalid_handle(dso)) return -1; diff --git a/src/ldso/dlopen.c b/src/ldso/dlopen.c index 6b1d792a3abb5519957733dc4bab188eb31ecfef..9544741bf353e449c592f76e48a56624bd4eca9c 100644 --- a/src/ldso/dlopen.c +++ b/src/ldso/dlopen.c @@ -1,8 +1,7 @@ #include +#include "dynlink.h" #include "libc.h" -hidden void __dl_seterr(const char *, ...); - static void *stub_dlopen(const char *file, int mode) { __dl_seterr("Dynamic loading not supported"); diff --git a/src/ldso/dlsym.c b/src/ldso/dlsym.c index c0f50e923b857d5e359fce641f0c6e0e77d81245..65eb27659f7b6abecb33d93db6c3fa12d82e08ee 100644 --- a/src/ldso/dlsym.c +++ b/src/ldso/dlsym.c @@ -1,6 +1,5 @@ #include - -void *__dlsym(void *restrict, const char *restrict, void *restrict); +#include "dynlink.h" void *dlsym(void *restrict p, const char *restrict s) { diff --git a/src/ldso/tlsdesc.c b/src/ldso/tlsdesc.c index df7eb9c950e373feb9ebee3be19fe52b1024c317..caf8dc081cda7d671957af666ab4a49e4d104c05 100644 --- a/src/ldso/tlsdesc.c +++ b/src/ldso/tlsdesc.c @@ -1,8 +1,7 @@ #include +#include #include "libc.h" -hidden ptrdiff_t __tlsdesc_static(), __tlsdesc_dynamic(); - ptrdiff_t __tlsdesc_static() { return 0;