From 827c5f1b826b916a533c082e558fc7c6fc38de6d Mon Sep 17 00:00:00 2001 From: Carmelo Amoroso Date: Tue, 18 Nov 2008 12:48:13 +0000 Subject: Move _dl_iterate_phdr into libc.so.0 and libc.a (as glibc does). Currently we have an implementation in ld.so and libdl.a. Signed-off-by: Carmelo Amoroso --- ldso/ldso/dl-elf.c | 26 -------------------------- ldso/ldso/dl-hash.c | 8 -------- ldso/ldso/dl-symbols.c | 21 +++++++++++++++++++++ ldso/ldso/ldso.c | 1 + 4 files changed, 22 insertions(+), 34 deletions(-) create mode 100644 ldso/ldso/dl-symbols.c (limited to 'ldso') diff --git a/ldso/ldso/dl-elf.c b/ldso/ldso/dl-elf.c index d22eccc8d..61bf6eb9d 100644 --- a/ldso/ldso/dl-elf.c +++ b/ldso/ldso/dl-elf.c @@ -928,29 +928,3 @@ void _dl_parse_dynamic_info(ElfW(Dyn) *dpnt, unsigned long dynamic_info[], { __dl_parse_dynamic_info(dpnt, dynamic_info, debug_addr, load_off); } - -/* we want this in ldso.so and libdl.a but nowhere else */ -#ifdef __USE_GNU -#if defined IS_IN_rtld || (defined IS_IN_libdl && ! defined SHARED) -extern __typeof(dl_iterate_phdr) __dl_iterate_phdr; -int -__dl_iterate_phdr (int (*callback) (struct dl_phdr_info *info, size_t size, void *data), void *data) -{ - struct elf_resolve *l; - struct dl_phdr_info info; - int ret = 0; - - for (l = _dl_loaded_modules; l != NULL; l = l->next) { - info.dlpi_addr = l->loadaddr; - info.dlpi_name = l->libname; - info.dlpi_phdr = l->ppnt; - info.dlpi_phnum = l->n_phent; - ret = callback (&info, sizeof (struct dl_phdr_info), data); - if (ret) - break; - } - return ret; -} -strong_alias(__dl_iterate_phdr, dl_iterate_phdr) -#endif -#endif diff --git a/ldso/ldso/dl-hash.c b/ldso/ldso/dl-hash.c index 2a393353b..b44bd3a4b 100644 --- a/ldso/ldso/dl-hash.c +++ b/ldso/ldso/dl-hash.c @@ -32,14 +32,6 @@ /* Various symbol table handling functions, including symbol lookup */ - -/* - * This is the start of the linked list that describes all of the files present - * in the system with pointers to all of the symbol, string, and hash tables, - * as well as all of the other good stuff in the binary. - */ -struct elf_resolve *_dl_loaded_modules = NULL; - /* * This is the list of modules that are loaded when the image is first * started. As we add more via dlopen, they get added into other diff --git a/ldso/ldso/dl-symbols.c b/ldso/ldso/dl-symbols.c new file mode 100644 index 000000000..e5c00211a --- /dev/null +++ b/ldso/ldso/dl-symbols.c @@ -0,0 +1,21 @@ +/* + * This contains all symbols shared between + * dynamic linker ld.so and into static libc + * + * Copyright (c) 2008 STMicroelectronics Ltd + * Author: Carmelo Amoroso + * + * + * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. + * + */ + +/* + * This is the start of the linked list that describes all of the files present + * in the system with pointers to all of the symbol, string, and hash tables, + * as well as all of the other good stuff in the binary. + */ +#include + +struct elf_resolve *_dl_loaded_modules = NULL; + diff --git a/ldso/ldso/ldso.c b/ldso/ldso/ldso.c index 46cc91c63..28f434147 100644 --- a/ldso/ldso/ldso.c +++ b/ldso/ldso/ldso.c @@ -67,6 +67,7 @@ int _dl_debug_file = 2; unsigned long attribute_hidden _dl_skip_args = 0; const char *_dl_progname = UCLIBC_LDSO; /* The name of the executable being run */ #include "dl-startup.c" +#include "dl-symbols.c" #include "dl-array.c" /* Forward function declarations */ static int _dl_suid_ok(void); -- cgit v1.2.3