提交 1bbe166e 编写于 作者: R Rich Felker

move tlsdesc and internal dl function declarations to dynlink.h

上级 15230afc
...@@ -299,8 +299,6 @@ static struct symdef find_sym(struct dso *dso, const char *s, int need_def) ...@@ -299,8 +299,6 @@ static struct symdef find_sym(struct dso *dso, const char *s, int need_def)
return 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) static void do_relocs(struct dso *dso, size_t *rel, size_t rel_size, size_t stride)
{ {
unsigned char *base = dso->base; unsigned char *base = dso->base;
...@@ -2048,8 +2046,6 @@ int dl_iterate_phdr(int(*callback)(struct dl_phdr_info *info, size_t size, void ...@@ -2048,8 +2046,6 @@ int dl_iterate_phdr(int(*callback)(struct dl_phdr_info *info, size_t size, void
return ret; return ret;
} }
hidden void __dl_vseterr(const char *, va_list);
static void error(const char *fmt, ...) static void error(const char *fmt, ...)
{ {
va_list ap; va_list ap;
......
...@@ -4,6 +4,8 @@ ...@@ -4,6 +4,8 @@
#include <features.h> #include <features.h>
#include <elf.h> #include <elf.h>
#include <stdint.h> #include <stdint.h>
#include <stddef.h>
#include "libc.h"
#if UINTPTR_MAX == 0xffffffff #if UINTPTR_MAX == 0xffffffff
typedef Elf32_Ehdr Ehdr; typedef Elf32_Ehdr Ehdr;
...@@ -95,4 +97,12 @@ struct fdpic_dummy_loadmap { ...@@ -95,4 +97,12 @@ struct fdpic_dummy_loadmap {
typedef void (*stage2_func)(unsigned char *, size_t *); typedef void (*stage2_func)(unsigned char *, size_t *);
typedef _Noreturn void (*stage3_func)(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 #endif
#include <dlfcn.h> #include <dlfcn.h>
#include "dynlink.h"
#include "libc.h" #include "libc.h"
hidden void __dl_seterr(const char *, ...);
static void *stub_dlsym(void *restrict p, const char *restrict s, void *restrict ra) static void *stub_dlsym(void *restrict p, const char *restrict s, void *restrict ra)
{ {
__dl_seterr("Symbol not found: %s", s); __dl_seterr("Symbol not found: %s", s);
......
#include <dlfcn.h> #include <dlfcn.h>
#include "dynlink.h"
#include "libc.h" #include "libc.h"
hidden int __dl_invalid_handle(void *);
int dlclose(void *p) int dlclose(void *p)
{ {
return __dl_invalid_handle(p); return __dl_invalid_handle(p);
......
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
#include <stdlib.h> #include <stdlib.h>
#include <stdarg.h> #include <stdarg.h>
#include "pthread_impl.h" #include "pthread_impl.h"
#include "dynlink.h"
#include "libc.h" #include "libc.h"
char *dlerror() char *dlerror()
...@@ -50,8 +51,6 @@ hidden void __dl_seterr(const char *fmt, ...) ...@@ -50,8 +51,6 @@ hidden void __dl_seterr(const char *fmt, ...)
va_end(ap); va_end(ap);
} }
hidden int __dl_invalid_handle(void *);
static int stub_invalid_handle(void *h) static int stub_invalid_handle(void *h)
{ {
__dl_seterr("Invalid library handle %p", (void *)h); __dl_seterr("Invalid library handle %p", (void *)h);
......
#define _GNU_SOURCE #define _GNU_SOURCE
#include <dlfcn.h> #include <dlfcn.h>
#include "dynlink.h"
#include "libc.h" #include "libc.h"
hidden int __dl_invalid_handle(void *);
hidden void __dl_seterr(const char *, ...);
int dlinfo(void *dso, int req, void *res) int dlinfo(void *dso, int req, void *res)
{ {
if (__dl_invalid_handle(dso)) return -1; if (__dl_invalid_handle(dso)) return -1;
......
#include <dlfcn.h> #include <dlfcn.h>
#include "dynlink.h"
#include "libc.h" #include "libc.h"
hidden void __dl_seterr(const char *, ...);
static void *stub_dlopen(const char *file, int mode) static void *stub_dlopen(const char *file, int mode)
{ {
__dl_seterr("Dynamic loading not supported"); __dl_seterr("Dynamic loading not supported");
......
#include <dlfcn.h> #include <dlfcn.h>
#include "dynlink.h"
void *__dlsym(void *restrict, const char *restrict, void *restrict);
void *dlsym(void *restrict p, const char *restrict s) void *dlsym(void *restrict p, const char *restrict s)
{ {
......
#include <stddef.h> #include <stddef.h>
#include <dynlink.h>
#include "libc.h" #include "libc.h"
hidden ptrdiff_t __tlsdesc_static(), __tlsdesc_dynamic();
ptrdiff_t __tlsdesc_static() ptrdiff_t __tlsdesc_static()
{ {
return 0; return 0;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册