提交 18bf0829 编写于 作者: R Rich Felker

improve machinery for ldso to report libc version

eliminate gratuitous glue function for reporting the version, which
was probably leftover from the old dynamic linker design which lacked
a clear barrier for when/how it could access global data. put the
declaration for the data object that replaces it in libc.h where it
can be type checked.
上级 3b028c28
...@@ -99,8 +99,6 @@ int __init_tp(void *); ...@@ -99,8 +99,6 @@ int __init_tp(void *);
void __init_libc(char **, char *); void __init_libc(char **, char *);
void *__copy_tls(unsigned char *); void *__copy_tls(unsigned char *);
hidden const char *__libc_get_version(void);
static struct builtin_tls { static struct builtin_tls {
char c; char c;
struct pthread pt; struct pthread pt;
...@@ -1562,7 +1560,7 @@ _Noreturn void __dls3(size_t *sp) ...@@ -1562,7 +1560,7 @@ _Noreturn void __dls3(size_t *sp)
"Version %s\n" "Version %s\n"
"Dynamic Program Loader\n" "Dynamic Program Loader\n"
"Usage: %s [options] [--] pathname%s\n", "Usage: %s [options] [--] pathname%s\n",
__libc_get_version(), ldname, __libc_version, ldname,
ldd_mode ? "" : " [args]"); ldd_mode ? "" : " [args]");
_exit(1); _exit(1);
} }
......
...@@ -43,6 +43,8 @@ extern hidden size_t __hwcap; ...@@ -43,6 +43,8 @@ extern hidden size_t __hwcap;
extern hidden size_t __sysinfo; extern hidden size_t __sysinfo;
extern char *__progname, *__progname_full; extern char *__progname, *__progname_full;
extern hidden const char __libc_version[];
/* Designed to avoid any overhead in non-threaded processes */ /* Designed to avoid any overhead in non-threaded processes */
hidden void __lock(volatile int *); hidden void __lock(volatile int *);
hidden void __unlock(volatile int *); hidden void __unlock(volatile int *);
......
#include "version.h" #include "version.h"
#include "libc.h" #include "libc.h"
static const char version[] = VERSION; const char __libc_version[] = VERSION;
hidden const char *__libc_get_version()
{
return version;
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册