summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ldso/ldso/boot1.c1
-rw-r--r--ldso/ldso/hash.h41
-rw-r--r--ldso/ldso/ld-uClibc.c1
-rw-r--r--ldso/ldso/ld_hash.h41
-rw-r--r--ldso/ldso/ldso.c1
-rw-r--r--ldso/ldso/link.h37
-rw-r--r--ldso/libdl/Makefile1
-rw-r--r--ldso/libdl/dlib.c88
-rw-r--r--ldso/libdl/libdl.c88
9 files changed, 143 insertions, 156 deletions
diff --git a/ldso/ldso/boot1.c b/ldso/ldso/boot1.c
index 2824fa4e2..cbf6b1aae 100644
--- a/ldso/ldso/boot1.c
+++ b/ldso/ldso/boot1.c
@@ -95,7 +95,6 @@
#include "sysdep.h" /* before elf.h to get ELF_USES_RELOCA right */
#include <elf.h>
#include "linuxelf.h"
-#include "link.h"
#include "hash.h"
#include "syscall.h"
#include "string.h"
diff --git a/ldso/ldso/hash.h b/ldso/ldso/hash.h
index 9cd2894f8..043b64aca 100644
--- a/ldso/ldso/hash.h
+++ b/ldso/ldso/hash.h
@@ -1,4 +1,38 @@
-#include "link.h"
+#ifndef _HASH_H_
+#define _HASH_H_
+
+#include "elf.h"
+
+/* Header file that describes the internal data structures used by the
+ * ELF dynamic linker. */
+
+struct link_map
+{
+ /* These entries must be in this order to be compatible with the
+ * interface used by gdb to obtain the list of symbols. */
+ unsigned long l_addr; /* address at which object is mapped */
+ char *l_name; /* full name of loaded object */
+ Elf32_Dyn *l_ld; /* dynamic structure of object */
+ struct link_map *l_next;
+ struct link_map *l_prev;
+};
+
+/* The DT_DEBUG entry in the .dynamic section is given the address of
+ * this structure. gdb can pick this up to obtain the correct list of
+ * loaded modules. */
+struct r_debug
+{
+ int r_version; /* debugging info version no */
+ struct link_map *r_map; /* address of link_map */
+ unsigned long r_brk; /* address of update routine */
+ enum
+ {
+ RT_CONSISTENT,
+ RT_ADD,
+ RT_DELETE
+ } r_state;
+ unsigned long r_ldbase; /* base addr of ld.so */
+};
#ifndef RTLD_NEXT
#define RTLD_NEXT ((void*)-1)
@@ -94,3 +128,8 @@ static inline int _dl_symbol(char * name)
#define DL_BAD_HANDLE 9
#define DL_NO_SYMBOL 10
+
+
+#endif /* _HASH_H_ */
+
+
diff --git a/ldso/ldso/ld-uClibc.c b/ldso/ldso/ld-uClibc.c
index 2824fa4e2..cbf6b1aae 100644
--- a/ldso/ldso/ld-uClibc.c
+++ b/ldso/ldso/ld-uClibc.c
@@ -95,7 +95,6 @@
#include "sysdep.h" /* before elf.h to get ELF_USES_RELOCA right */
#include <elf.h>
#include "linuxelf.h"
-#include "link.h"
#include "hash.h"
#include "syscall.h"
#include "string.h"
diff --git a/ldso/ldso/ld_hash.h b/ldso/ldso/ld_hash.h
index 9cd2894f8..043b64aca 100644
--- a/ldso/ldso/ld_hash.h
+++ b/ldso/ldso/ld_hash.h
@@ -1,4 +1,38 @@
-#include "link.h"
+#ifndef _HASH_H_
+#define _HASH_H_
+
+#include "elf.h"
+
+/* Header file that describes the internal data structures used by the
+ * ELF dynamic linker. */
+
+struct link_map
+{
+ /* These entries must be in this order to be compatible with the
+ * interface used by gdb to obtain the list of symbols. */
+ unsigned long l_addr; /* address at which object is mapped */
+ char *l_name; /* full name of loaded object */
+ Elf32_Dyn *l_ld; /* dynamic structure of object */
+ struct link_map *l_next;
+ struct link_map *l_prev;
+};
+
+/* The DT_DEBUG entry in the .dynamic section is given the address of
+ * this structure. gdb can pick this up to obtain the correct list of
+ * loaded modules. */
+struct r_debug
+{
+ int r_version; /* debugging info version no */
+ struct link_map *r_map; /* address of link_map */
+ unsigned long r_brk; /* address of update routine */
+ enum
+ {
+ RT_CONSISTENT,
+ RT_ADD,
+ RT_DELETE
+ } r_state;
+ unsigned long r_ldbase; /* base addr of ld.so */
+};
#ifndef RTLD_NEXT
#define RTLD_NEXT ((void*)-1)
@@ -94,3 +128,8 @@ static inline int _dl_symbol(char * name)
#define DL_BAD_HANDLE 9
#define DL_NO_SYMBOL 10
+
+
+#endif /* _HASH_H_ */
+
+
diff --git a/ldso/ldso/ldso.c b/ldso/ldso/ldso.c
index 2824fa4e2..cbf6b1aae 100644
--- a/ldso/ldso/ldso.c
+++ b/ldso/ldso/ldso.c
@@ -95,7 +95,6 @@
#include "sysdep.h" /* before elf.h to get ELF_USES_RELOCA right */
#include <elf.h>
#include "linuxelf.h"
-#include "link.h"
#include "hash.h"
#include "syscall.h"
#include "string.h"
diff --git a/ldso/ldso/link.h b/ldso/ldso/link.h
deleted file mode 100644
index adaa20e4a..000000000
--- a/ldso/ldso/link.h
+++ /dev/null
@@ -1,37 +0,0 @@
-#ifndef _LINK_H
-#define _LINK_H
-
-#include "elf.h"
-
-/* Header file that describes the internal data structures used by the
- * ELF dynamic linker. */
-
-struct link_map
-{
- /* These entries must be in this order to be compatible with the
- * interface used by gdb to obtain the list of symbols. */
- unsigned long l_addr; /* address at which object is mapped */
- char *l_name; /* full name of loaded object */
- Elf32_Dyn *l_ld; /* dynamic structure of object */
- struct link_map *l_next;
- struct link_map *l_prev;
-};
-
-/* The DT_DEBUG entry in the .dynamic section is given the address of
- * this structure. gdb can pick this up to obtain the correct list of
- * loaded modules. */
-struct r_debug
-{
- int r_version; /* debugging info version no */
- struct link_map *r_map; /* address of link_map */
- unsigned long r_brk; /* address of update routine */
- enum
- {
- RT_CONSISTENT,
- RT_ADD,
- RT_DELETE
- } r_state;
- unsigned long r_ldbase; /* base addr of ld.so */
-};
-
-#endif /* _LINK_H */
diff --git a/ldso/libdl/Makefile b/ldso/libdl/Makefile
index 015e6b786..67047d7c6 100644
--- a/ldso/libdl/Makefile
+++ b/ldso/libdl/Makefile
@@ -43,6 +43,7 @@ ar-target: $(OBJS)
#rm -f $(TOPDIR)lib/$(LIBDL)
#install -m 644 $(LIBDL) $(TOPDIR)lib
+
$(OBJS): %.o : %.c
$(TARGET_CC) -I../d-link -I../d-link/$(TARGET_ARCH) $(TARGET_CFLAGS) -c $< -o $@
$(STRIPTOOL) -x -R .note -R .comment $*.o
diff --git a/ldso/libdl/dlib.c b/ldso/libdl/dlib.c
index 508299451..50b9ff601 100644
--- a/ldso/libdl/dlib.c
+++ b/ldso/libdl/dlib.c
@@ -5,6 +5,7 @@
*/
#include <stdlib.h>
+#include <features.h>
#include "dlfcn.h"
#include "sysdep.h"
#include "syscall.h"
@@ -453,19 +454,11 @@ const char *_dlerror()
}
/* Generate the correct symbols that we need. */
-#if 1
-#pragma weak dlopen = _dlopen
-#pragma weak dlerror = _dlerror
-#pragma weak dlclose = _dlclose
-#pragma weak dlsym = _dlsym
-#pragma weak dladdr = _dladdr
-#else
-__asm__(".weak dlopen;dlopen=_dlopen");
-__asm__(".weak dlerror;dlerror=_dlerror");
-__asm__(".weak dlclose;dlclose=_dlclose");
-__asm__(".weak dlsym;dlsym=_dlsym");
-__asm__(".weak dladdr;dladdr=_dladdr");
-#endif
+weak_alias(dlopen, _dlopen);
+weak_alias(dlerror, _dlerror);
+weak_alias(dlclose, _dlclose);
+weak_alias(dlsym, _dlsym);
+weak_alias(dladdr, _dladdr);
/* This is a real hack. We need access to the dynamic linker, but we
also need to make it possible to link against this library without any
@@ -474,47 +467,28 @@ possible, but at run time the normal symbols are accessed. */
static void foobar()
{
- _dl_fdprintf(2, "libdl library not correctly linked\n");
+ _dl_fprintf(2, "libdl library not correctly linked\n");
_dl_exit(1);
}
static int __attribute__ ((unused)) foobar1 = (int) foobar; /* Use as pointer */
-#if 1
-#pragma weak _dl_find_hash = foobar
-#pragma weak _dl_symbol_tables = foobar1
-#pragma weak _dl_handles = foobar1
-#pragma weak _dl_loaded_modules = foobar1
-#pragma weak _dl_debug_addr = foobar1
-#pragma weak _dl_error_number = foobar1
-#pragma weak _dl_load_shared_library = foobar
-#ifdef USE_CACHE
-#pragma weak _dl_map_cache = foobar
-#pragma weak _dl_unmap_cache = foobar
-#endif
-#pragma weak _dl_malloc_function = foobar1
-#pragma weak _dl_parse_relocation_information = foobar
-#pragma weak _dl_parse_lazy_relocation_information = foobar
-#pragma weak _dl_fdprintf = foobar
-#else
-__asm__(".weak _dl_find_hash; _dl_find_hash = foobar");
-__asm__(".weak _dl_symbol_tables; _dl_symbol_tables = foobar1");
-__asm__(".weak _dl_handles; _dl_handles = foobar1");
-__asm__(".weak _dl_loaded_modules; _dl_loaded_modules = foobar1");
-__asm__(".weak _dl_debug_addr; _dl_debug_addr = foobar1");
-__asm__(".weak _dl_error_number; _dl_error_number = foobar1");
-__asm__(".weak _dl_load_shared_library; _dl_load_shared_library = foobar");
+weak_alias(_dl_find_hash, foobar);
+weak_alias(_dl_symbol_tables, foobar1);
+weak_alias(_dl_handles, foobar1);
+weak_alias(_dl_loaded_modules, foobar1);
+weak_alias(_dl_debug_addr, foobar1);
+weak_alias(_dl_error_number, foobar1);
+weak_alias(_dl_load_shared_library, foobar);
#ifdef USE_CACHE
-__asm__(".weak _dl_map_cache; _dl_map_cache = foobar");
-__asm__(".weak _dl_unmap_cache; _dl_unmap_cache = foobar");
-#endif
-__asm__(".weak _dl_malloc_function; _dl_malloc_function = foobar1");
-__asm__
- (".weak _dl_parse_relocation_information; _dl_parse_relocation_information = foobar");
-__asm__
- (".weak _dl_parse_lazy_relocation_information; _dl_parse_lazy_relocation_information = foobar");
-__asm__(".weak _dl_fdprintf; _dl_fdprintf = foobar");
-#endif
+weak_alias(_dl_map_cache, foobar);
+weak_alias(_dl_unmap_cache, foobar);
+#endif
+weak_alias(_dl_malloc_function, foobar1);
+weak_alias(_dl_parse_relocation_information, foobar);
+weak_alias(_dl_parse_lazy_relocation_information, foobar);
+weak_alias(_dl_fprintf, foobar);
+
/*
* Dump information to stderrr about the current loaded modules
@@ -526,10 +500,10 @@ void _dlinfo()
struct elf_resolve *tpnt;
struct dyn_elf *rpnt, *hpnt;
- _dl_fdprintf(2, "List of loaded modules\n");
+ _dl_fprintf(2, "List of loaded modules\n");
/* First start with a complete list of all of the loaded files. */
for (tpnt = _dl_loaded_modules; tpnt; tpnt = tpnt->next) {
- _dl_fdprintf(2, "\t%8.8x %8.8x %8.8x %s %d %s\n",
+ _dl_fprintf(2, "\t%x %x %x %s %d %s\n",
(unsigned) tpnt->loadaddr, (unsigned) tpnt,
(unsigned) tpnt->symbol_scope,
type[tpnt->libtype],
@@ -537,15 +511,15 @@ void _dlinfo()
}
/* Next dump the module list for the application itself */
- _dl_fdprintf(2, "\nModules for application (%x):\n",
+ _dl_fprintf(2, "\nModules for application (%x):\n",
(unsigned) _dl_symbol_tables);
for (rpnt = _dl_symbol_tables; rpnt; rpnt = rpnt->next)
- _dl_fdprintf(2, "\t%8.8x %s\n", (unsigned) rpnt->dyn, rpnt->dyn->libname);
+ _dl_fprintf(2, "\t%x %s\n", (unsigned) rpnt->dyn, rpnt->dyn->libname);
for (hpnt = _dl_handles; hpnt; hpnt = hpnt->next_handle) {
- _dl_fdprintf(2, "Modules for handle %x\n", (unsigned) hpnt);
+ _dl_fprintf(2, "Modules for handle %x\n", (unsigned) hpnt);
for (rpnt = hpnt; rpnt; rpnt = rpnt->next)
- _dl_fdprintf(2, "\t%8.8x %s\n", (unsigned) rpnt->dyn,
+ _dl_fprintf(2, "\t%x %s\n", (unsigned) rpnt->dyn,
rpnt->dyn->libname);
}
}
@@ -565,7 +539,7 @@ int _dladdr(void *__address, Dl_info * __dlip)
pelf = NULL;
#if 0
- _dl_fdprintf(2, "dladdr( 0x%p, 0x%p )\n", __address, __dlip);
+ _dl_fprintf(2, "dladdr( 0x%p, 0x%p )\n", __address, __dlip);
#endif
for (rpnt = _dl_loaded_modules; rpnt; rpnt = rpnt->next) {
@@ -573,7 +547,7 @@ int _dladdr(void *__address, Dl_info * __dlip)
tpnt = rpnt;
#if 0
- _dl_fdprintf(2, "Module \"%s\" at 0x%p\n",
+ _dl_fprintf(2, "Module \"%s\" at 0x%p\n",
tpnt->libname, tpnt->loadaddr);
#endif
if (tpnt->loadaddr < (char *) __address
@@ -613,7 +587,7 @@ int _dladdr(void *__address, Dl_info * __dlip)
sf = 1;
}
#if 0
- _dl_fdprintf(2, "Symbol \"%s\" at 0x%p\n",
+ _dl_fprintf(2, "Symbol \"%s\" at 0x%p\n",
strtab + symtab[si].st_name, symbol_addr);
#endif
}
diff --git a/ldso/libdl/libdl.c b/ldso/libdl/libdl.c
index 508299451..50b9ff601 100644
--- a/ldso/libdl/libdl.c
+++ b/ldso/libdl/libdl.c
@@ -5,6 +5,7 @@
*/
#include <stdlib.h>
+#include <features.h>
#include "dlfcn.h"
#include "sysdep.h"
#include "syscall.h"
@@ -453,19 +454,11 @@ const char *_dlerror()
}
/* Generate the correct symbols that we need. */
-#if 1
-#pragma weak dlopen = _dlopen
-#pragma weak dlerror = _dlerror
-#pragma weak dlclose = _dlclose
-#pragma weak dlsym = _dlsym
-#pragma weak dladdr = _dladdr
-#else
-__asm__(".weak dlopen;dlopen=_dlopen");
-__asm__(".weak dlerror;dlerror=_dlerror");
-__asm__(".weak dlclose;dlclose=_dlclose");
-__asm__(".weak dlsym;dlsym=_dlsym");
-__asm__(".weak dladdr;dladdr=_dladdr");
-#endif
+weak_alias(dlopen, _dlopen);
+weak_alias(dlerror, _dlerror);
+weak_alias(dlclose, _dlclose);
+weak_alias(dlsym, _dlsym);
+weak_alias(dladdr, _dladdr);
/* This is a real hack. We need access to the dynamic linker, but we
also need to make it possible to link against this library without any
@@ -474,47 +467,28 @@ possible, but at run time the normal symbols are accessed. */
static void foobar()
{
- _dl_fdprintf(2, "libdl library not correctly linked\n");
+ _dl_fprintf(2, "libdl library not correctly linked\n");
_dl_exit(1);
}
static int __attribute__ ((unused)) foobar1 = (int) foobar; /* Use as pointer */
-#if 1
-#pragma weak _dl_find_hash = foobar
-#pragma weak _dl_symbol_tables = foobar1
-#pragma weak _dl_handles = foobar1
-#pragma weak _dl_loaded_modules = foobar1
-#pragma weak _dl_debug_addr = foobar1
-#pragma weak _dl_error_number = foobar1
-#pragma weak _dl_load_shared_library = foobar
-#ifdef USE_CACHE
-#pragma weak _dl_map_cache = foobar
-#pragma weak _dl_unmap_cache = foobar
-#endif
-#pragma weak _dl_malloc_function = foobar1
-#pragma weak _dl_parse_relocation_information = foobar
-#pragma weak _dl_parse_lazy_relocation_information = foobar
-#pragma weak _dl_fdprintf = foobar
-#else
-__asm__(".weak _dl_find_hash; _dl_find_hash = foobar");
-__asm__(".weak _dl_symbol_tables; _dl_symbol_tables = foobar1");
-__asm__(".weak _dl_handles; _dl_handles = foobar1");
-__asm__(".weak _dl_loaded_modules; _dl_loaded_modules = foobar1");
-__asm__(".weak _dl_debug_addr; _dl_debug_addr = foobar1");
-__asm__(".weak _dl_error_number; _dl_error_number = foobar1");
-__asm__(".weak _dl_load_shared_library; _dl_load_shared_library = foobar");
+weak_alias(_dl_find_hash, foobar);
+weak_alias(_dl_symbol_tables, foobar1);
+weak_alias(_dl_handles, foobar1);
+weak_alias(_dl_loaded_modules, foobar1);
+weak_alias(_dl_debug_addr, foobar1);
+weak_alias(_dl_error_number, foobar1);
+weak_alias(_dl_load_shared_library, foobar);
#ifdef USE_CACHE
-__asm__(".weak _dl_map_cache; _dl_map_cache = foobar");
-__asm__(".weak _dl_unmap_cache; _dl_unmap_cache = foobar");
-#endif
-__asm__(".weak _dl_malloc_function; _dl_malloc_function = foobar1");
-__asm__
- (".weak _dl_parse_relocation_information; _dl_parse_relocation_information = foobar");
-__asm__
- (".weak _dl_parse_lazy_relocation_information; _dl_parse_lazy_relocation_information = foobar");
-__asm__(".weak _dl_fdprintf; _dl_fdprintf = foobar");
-#endif
+weak_alias(_dl_map_cache, foobar);
+weak_alias(_dl_unmap_cache, foobar);
+#endif
+weak_alias(_dl_malloc_function, foobar1);
+weak_alias(_dl_parse_relocation_information, foobar);
+weak_alias(_dl_parse_lazy_relocation_information, foobar);
+weak_alias(_dl_fprintf, foobar);
+
/*
* Dump information to stderrr about the current loaded modules
@@ -526,10 +500,10 @@ void _dlinfo()
struct elf_resolve *tpnt;
struct dyn_elf *rpnt, *hpnt;
- _dl_fdprintf(2, "List of loaded modules\n");
+ _dl_fprintf(2, "List of loaded modules\n");
/* First start with a complete list of all of the loaded files. */
for (tpnt = _dl_loaded_modules; tpnt; tpnt = tpnt->next) {
- _dl_fdprintf(2, "\t%8.8x %8.8x %8.8x %s %d %s\n",
+ _dl_fprintf(2, "\t%x %x %x %s %d %s\n",
(unsigned) tpnt->loadaddr, (unsigned) tpnt,
(unsigned) tpnt->symbol_scope,
type[tpnt->libtype],
@@ -537,15 +511,15 @@ void _dlinfo()
}
/* Next dump the module list for the application itself */
- _dl_fdprintf(2, "\nModules for application (%x):\n",
+ _dl_fprintf(2, "\nModules for application (%x):\n",
(unsigned) _dl_symbol_tables);
for (rpnt = _dl_symbol_tables; rpnt; rpnt = rpnt->next)
- _dl_fdprintf(2, "\t%8.8x %s\n", (unsigned) rpnt->dyn, rpnt->dyn->libname);
+ _dl_fprintf(2, "\t%x %s\n", (unsigned) rpnt->dyn, rpnt->dyn->libname);
for (hpnt = _dl_handles; hpnt; hpnt = hpnt->next_handle) {
- _dl_fdprintf(2, "Modules for handle %x\n", (unsigned) hpnt);
+ _dl_fprintf(2, "Modules for handle %x\n", (unsigned) hpnt);
for (rpnt = hpnt; rpnt; rpnt = rpnt->next)
- _dl_fdprintf(2, "\t%8.8x %s\n", (unsigned) rpnt->dyn,
+ _dl_fprintf(2, "\t%x %s\n", (unsigned) rpnt->dyn,
rpnt->dyn->libname);
}
}
@@ -565,7 +539,7 @@ int _dladdr(void *__address, Dl_info * __dlip)
pelf = NULL;
#if 0
- _dl_fdprintf(2, "dladdr( 0x%p, 0x%p )\n", __address, __dlip);
+ _dl_fprintf(2, "dladdr( 0x%p, 0x%p )\n", __address, __dlip);
#endif
for (rpnt = _dl_loaded_modules; rpnt; rpnt = rpnt->next) {
@@ -573,7 +547,7 @@ int _dladdr(void *__address, Dl_info * __dlip)
tpnt = rpnt;
#if 0
- _dl_fdprintf(2, "Module \"%s\" at 0x%p\n",
+ _dl_fprintf(2, "Module \"%s\" at 0x%p\n",
tpnt->libname, tpnt->loadaddr);
#endif
if (tpnt->loadaddr < (char *) __address
@@ -613,7 +587,7 @@ int _dladdr(void *__address, Dl_info * __dlip)
sf = 1;
}
#if 0
- _dl_fdprintf(2, "Symbol \"%s\" at 0x%p\n",
+ _dl_fprintf(2, "Symbol \"%s\" at 0x%p\n",
strtab + symtab[si].st_name, symbol_addr);
#endif
}