summaryrefslogtreecommitdiff
path: root/ldso
diff options
context:
space:
mode:
authorJoakim Tjernlund <joakim.tjernlund@transmode.se>2005-03-29 13:47:21 +0000
committerJoakim Tjernlund <joakim.tjernlund@transmode.se>2005-03-29 13:47:21 +0000
commite6816a15ab7d7dbf3ffe75a9a22b4a37909aaf57 (patch)
treeffd16f946ea203cf14cc44c7aaae730cc1032d01 /ldso
parent223b81b2e707ff3cb99fdf49b7cb6bd1da7f6d21 (diff)
Moved the addition of load address from the fast path
where possible. This will also make ldso smaller. However the patch touches all archs and I have only tested PPC and x86.
Diffstat (limited to 'ldso')
-rw-r--r--ldso/include/dl-elf.h20
-rw-r--r--ldso/include/dl-hash.h1
-rw-r--r--ldso/ldso/arm/dl-sysdep.h2
-rw-r--r--ldso/ldso/arm/elfinterp.c12
-rw-r--r--ldso/ldso/cris/dl-sysdep.h2
-rw-r--r--ldso/ldso/cris/elfinterp.c12
-rw-r--r--ldso/ldso/dl-elf.c11
-rw-r--r--ldso/ldso/dl-hash.c10
-rw-r--r--ldso/ldso/dl-startup.c8
-rw-r--r--ldso/ldso/i386/dl-sysdep.h2
-rw-r--r--ldso/ldso/i386/elfinterp.c12
-rw-r--r--ldso/ldso/ldso.c8
-rw-r--r--ldso/ldso/m68k/dl-sysdep.h2
-rw-r--r--ldso/ldso/m68k/elfinterp.c20
-rw-r--r--ldso/ldso/mips/dl-startup.h4
-rw-r--r--ldso/ldso/mips/elfinterp.c22
-rw-r--r--ldso/ldso/powerpc/dl-sysdep.h2
-rw-r--r--ldso/ldso/powerpc/elfinterp.c30
-rw-r--r--ldso/ldso/sh/dl-startup.h4
-rw-r--r--ldso/ldso/sh/dl-sysdep.h2
-rw-r--r--ldso/ldso/sh/elfinterp.c12
-rw-r--r--ldso/ldso/sh64/dl-sysdep.h2
-rw-r--r--ldso/ldso/sh64/elfinterp.c14
-rw-r--r--ldso/ldso/sparc/dl-sysdep.h2
-rw-r--r--ldso/ldso/sparc/elfinterp.c19
-rw-r--r--ldso/libdl/libdl.c6
26 files changed, 120 insertions, 121 deletions
diff --git a/ldso/include/dl-elf.h b/ldso/include/dl-elf.h
index a1237b09f..d8f3b382c 100644
--- a/ldso/include/dl-elf.h
+++ b/ldso/include/dl-elf.h
@@ -65,10 +65,10 @@ extern void _dl_protect_relro (struct elf_resolve *l);
#define DYNAMIC_SIZE (DT_NUM+OS_NUM+ARCH_NUM)
-extern void _dl_parse_dynamic_info(Elf32_Dyn *dpnt, unsigned long dynamic_info[], void *debug_addr);
+extern void _dl_parse_dynamic_info(Elf32_Dyn *dpnt, unsigned long dynamic_info[], void *debug_addr, Elf32_Addr load_off);
static inline __attribute__((always_inline))
-void __dl_parse_dynamic_info(Elf32_Dyn *dpnt, unsigned long dynamic_info[], void *debug_addr)
+void __dl_parse_dynamic_info(Elf32_Dyn *dpnt, unsigned long dynamic_info[], void *debug_addr, Elf32_Addr load_off)
{
for (; dpnt->d_tag; dpnt++) {
if (dpnt->d_tag < DT_NUM) {
@@ -97,7 +97,21 @@ void __dl_parse_dynamic_info(Elf32_Dyn *dpnt, unsigned long dynamic_info[], void
}
#endif
}
-}
+# define ADJUST_DYN_INFO(tag, load_off) \
+ do { \
+ if (dynamic_info[tag]) \
+ dynamic_info[tag] += load_off; \
+ } while(0)
+
+ ADJUST_DYN_INFO (DT_HASH, load_off);
+ ADJUST_DYN_INFO (DT_PLTGOT, load_off);
+ ADJUST_DYN_INFO (DT_STRTAB, load_off);
+ ADJUST_DYN_INFO (DT_SYMTAB, load_off);
+ ADJUST_DYN_INFO (DT_RELOC_TABLE_ADDR, load_off);
+ ADJUST_DYN_INFO (DT_JMPREL, load_off);
+# undef ADJUST_DYN_INFO
+
+ }
/* Reloc type classes as returned by elf_machine_type_class().
ELF_RTYPE_CLASS_PLT means this reloc should not be satisfied by
diff --git a/ldso/include/dl-hash.h b/ldso/include/dl-hash.h
index cc0d389f6..53e17302a 100644
--- a/ldso/include/dl-hash.h
+++ b/ldso/include/dl-hash.h
@@ -77,7 +77,6 @@ extern int _dl_linux_dynamic_link(void);
extern char * _dl_library_path;
extern char * _dl_not_lazy;
-extern unsigned long _dl_elf_hash(const unsigned char *name);
static inline int _dl_symbol(char * name)
{
diff --git a/ldso/ldso/arm/dl-sysdep.h b/ldso/ldso/arm/dl-sysdep.h
index 30e77a471..794c86a0c 100644
--- a/ldso/ldso/arm/dl-sysdep.h
+++ b/ldso/ldso/arm/dl-sysdep.h
@@ -93,7 +93,7 @@ static inline void
elf_machine_relative (Elf32_Addr load_off, const Elf32_Addr rel_addr,
Elf32_Word relative_count)
{
- Elf32_Rel * rpnt = (void *) (rel_addr + load_off);
+ Elf32_Rel * rpnt = (void *) rel_addr;
--rpnt;
do {
Elf32_Addr *const reloc_addr = (void *) (load_off + (++rpnt)->r_offset);
diff --git a/ldso/ldso/arm/elfinterp.c b/ldso/ldso/arm/elfinterp.c
index eef82679c..228a1cee2 100644
--- a/ldso/ldso/arm/elfinterp.c
+++ b/ldso/ldso/arm/elfinterp.c
@@ -126,14 +126,14 @@ unsigned long _dl_linux_resolver(struct elf_resolve *tpnt, int reloc_entry)
char **got_addr;
unsigned long instr_addr;
- rel_addr = (ELF_RELOC *) (tpnt->dynamic_info[DT_JMPREL] + tpnt->loadaddr);
+ rel_addr = (ELF_RELOC *) tpnt->dynamic_info[DT_JMPREL];
this_reloc = rel_addr + (reloc_entry >> 3);
reloc_type = ELF32_R_TYPE(this_reloc->r_info);
symtab_index = ELF32_R_SYM(this_reloc->r_info);
- symtab = (Elf32_Sym *) (tpnt->dynamic_info[DT_SYMTAB] + tpnt->loadaddr);
- strtab = (char *) (tpnt->dynamic_info[DT_STRTAB] + tpnt->loadaddr);
+ symtab = (Elf32_Sym *) tpnt->dynamic_info[DT_SYMTAB];
+ strtab = (char *) tpnt->dynamic_info[DT_STRTAB];
symname = strtab + symtab[symtab_index].st_name;
@@ -190,11 +190,11 @@ _dl_parse(struct elf_resolve *tpnt, struct dyn_elf *scope,
int symtab_index;
/* Now parse the relocation information */
- rpnt = (ELF_RELOC *) (rel_addr + tpnt->loadaddr);
+ rpnt = (ELF_RELOC *) rel_addr;
rel_size = rel_size / sizeof(ELF_RELOC);
- symtab = (Elf32_Sym *) (tpnt->dynamic_info[DT_SYMTAB] + tpnt->loadaddr);
- strtab = (char *) (tpnt->dynamic_info[DT_STRTAB] + tpnt->loadaddr);
+ symtab = (Elf32_Sym *) tpnt->dynamic_info[DT_SYMTAB];
+ strtab = (char *) tpnt->dynamic_info[DT_STRTAB];
for (i = 0; i < rel_size; i++, rpnt++) {
int res;
diff --git a/ldso/ldso/cris/dl-sysdep.h b/ldso/ldso/cris/dl-sysdep.h
index 4d1ad9656..364e8b516 100644
--- a/ldso/ldso/cris/dl-sysdep.h
+++ b/ldso/ldso/cris/dl-sysdep.h
@@ -114,7 +114,7 @@ static inline void
elf_machine_relative(Elf32_Addr load_off, const Elf32_Addr rel_addr,
Elf32_Word relative_count)
{
- Elf32_Rela *rpnt = (void *)(rel_addr + load_off);
+ Elf32_Rela *rpnt = (void *)rel_addr;
--rpnt;
do {
diff --git a/ldso/ldso/cris/elfinterp.c b/ldso/ldso/cris/elfinterp.c
index 675fb0117..5932fd0f1 100644
--- a/ldso/ldso/cris/elfinterp.c
+++ b/ldso/ldso/cris/elfinterp.c
@@ -122,14 +122,14 @@ _dl_linux_resolver(struct elf_resolve *tpnt, int reloc_entry)
ELF_RELOC *this_reloc;
unsigned long instr_addr;
- rel_addr = (char *)(tpnt->dynamic_info[DT_JMPREL] + tpnt->loadaddr);
+ rel_addr = (char *)tpnt->dynamic_info[DT_JMPREL];
this_reloc = (ELF_RELOC *)(intptr_t)(rel_addr + reloc_entry);
reloc_type = ELF32_R_TYPE(this_reloc->r_info);
symtab_index = ELF32_R_SYM(this_reloc->r_info);
- symtab = (Elf32_Sym *)(intptr_t)(tpnt->dynamic_info[DT_SYMTAB] + tpnt->loadaddr);
- strtab = (char *)(tpnt->dynamic_info[DT_STRTAB] + tpnt->loadaddr);
+ symtab = (Elf32_Sym *)(intptr_t)tpnt->dynamic_info[DT_SYMTAB];
+ strtab = (char *)tpnt->dynamic_info[DT_STRTAB];
symname = strtab + symtab[symtab_index].st_name;
if (unlikely(reloc_type != R_CRIS_JUMP_SLOT)) {
@@ -181,11 +181,11 @@ _dl_parse(struct elf_resolve *tpnt, struct dyn_elf *scope,
ELF_RELOC *rpnt;
/* Parse the relocation information. */
- rpnt = (ELF_RELOC *)(intptr_t)(rel_addr + tpnt->loadaddr);
+ rpnt = (ELF_RELOC *)(intptr_t)rel_addr;
rel_size /= sizeof(ELF_RELOC);
- symtab = (Elf32_Sym *)(intptr_t)(tpnt->dynamic_info[DT_SYMTAB] + tpnt->loadaddr);
- strtab = (char *)(tpnt->dynamic_info[DT_STRTAB] + tpnt->loadaddr);
+ symtab = (Elf32_Sym *)(intptr_t)tpnt->dynamic_info[DT_SYMTAB];
+ strtab = (char *)tpnt->dynamic_info[DT_STRTAB];
for (i = 0; i < rel_size; i++, rpnt++) {
int res;
diff --git a/ldso/ldso/dl-elf.c b/ldso/ldso/dl-elf.c
index bcf83346e..089fca986 100644
--- a/ldso/ldso/dl-elf.c
+++ b/ldso/ldso/dl-elf.c
@@ -307,7 +307,7 @@ struct elf_resolve *_dl_load_shared_library(int secure, struct dyn_elf **rpnt,
if (tpnt->libtype == elf_executable) {
pnt = (char *) tpnt->dynamic_info[DT_RPATH];
if (pnt) {
- pnt += (unsigned long) tpnt->loadaddr + tpnt->dynamic_info[DT_STRTAB];
+ pnt += (unsigned long) tpnt->dynamic_info[DT_STRTAB];
#if defined (__SUPPORT_LD_DEBUG__)
if(_dl_debug) _dl_dprintf(_dl_debug_file, "\tsearching RPATH='%s'\n", pnt);
#endif
@@ -651,7 +651,7 @@ struct elf_resolve *_dl_load_elf_shared_library(int secure,
dpnt = (Elf32_Dyn *) dynamic_addr;
_dl_memset(dynamic_info, 0, sizeof(dynamic_info));
- _dl_parse_dynamic_info(dpnt, dynamic_info, NULL);
+ _dl_parse_dynamic_info(dpnt, dynamic_info, NULL, libaddr);
/* If the TEXTREL is set, this means that we need to make the pages
writable before we perform relocations. Do this now. They get set
back again later. */
@@ -702,8 +702,7 @@ struct elf_resolve *_dl_load_elf_shared_library(int secure,
lpnt = (unsigned long *) dynamic_info[DT_PLTGOT];
if (lpnt) {
- lpnt = (unsigned long *) (dynamic_info[DT_PLTGOT] +
- ((int) libaddr));
+ lpnt = (unsigned long *) (dynamic_info[DT_PLTGOT]);
INIT_GOT(lpnt, tpnt);
};
@@ -881,9 +880,9 @@ char *_dl_strdup(const char *string)
return retval;
}
-void _dl_parse_dynamic_info(Elf32_Dyn *dpnt, unsigned long dynamic_info[], void *debug_addr)
+void _dl_parse_dynamic_info(Elf32_Dyn *dpnt, unsigned long dynamic_info[], void *debug_addr, Elf32_Addr load_off)
{
- __dl_parse_dynamic_info(dpnt, dynamic_info, debug_addr);
+ __dl_parse_dynamic_info(dpnt, dynamic_info, debug_addr, load_off);
}
#ifdef __USE_GNU
#if ! defined LIBDL || (! defined PIC && ! defined __PIC__)
diff --git a/ldso/ldso/dl-hash.c b/ldso/ldso/dl-hash.c
index c10a5e837..863f8fb6e 100644
--- a/ldso/ldso/dl-hash.c
+++ b/ldso/ldso/dl-hash.c
@@ -57,7 +57,7 @@ struct dyn_elf *_dl_handles = NULL;
/* This is the hash function that is used by the ELF linker to generate the
* hash table that each executable and library is required to have. We need
* it to decode the hash table. */
-unsigned long _dl_elf_hash(const unsigned char *name)
+static inline unsigned long _dl_elf_hash(const unsigned char *name)
{
unsigned long hash = 0;
unsigned long tmp;
@@ -79,7 +79,7 @@ struct elf_resolve *_dl_check_hashed_files(const char *libname)
for (tpnt = _dl_loaded_modules; tpnt; tpnt = tpnt->next) {
if (_dl_strncmp(tpnt->libname, libname, len) == 0 &&
- (tpnt->libname[len] == '\0' || tpnt->libname[len] == '.'))
+ (tpnt->libname[len] == '\0' || tpnt->libname[len] == '.'))
return tpnt;
}
@@ -119,7 +119,7 @@ struct elf_resolve *_dl_add_elf_hash_table(const char *libname,
tpnt->libtype = loaded_file;
if (dynamic_info[DT_HASH] != 0) {
- hash_addr = (unsigned long *) (intptr_t)(dynamic_info[DT_HASH] + loadaddr);
+ hash_addr = (unsigned long *) (intptr_t)(dynamic_info[DT_HASH]);
tpnt->nbucket = *hash_addr++;
tpnt->nchain = *hash_addr++;
tpnt->elf_buckets = hash_addr;
@@ -172,8 +172,8 @@ char *_dl_find_hash(const char *name, struct dyn_elf *rpnt, struct elf_resolve *
/* Avoid calling .urem here. */
do_rem(hn, elf_hash_number, tpnt->nbucket);
- symtab = (Elf32_Sym *) (intptr_t) (tpnt->dynamic_info[DT_SYMTAB] + tpnt->loadaddr);
- strtab = (char *) (tpnt->dynamic_info[DT_STRTAB] + tpnt->loadaddr);
+ symtab = (Elf32_Sym *) (intptr_t) (tpnt->dynamic_info[DT_SYMTAB]);
+ strtab = (char *) (tpnt->dynamic_info[DT_STRTAB]);
for (si = tpnt->elf_buckets[hn]; si != STN_UNDEF; si = tpnt->chains[si]) {
sym = &symtab[si];
diff --git a/ldso/ldso/dl-startup.c b/ldso/ldso/dl-startup.c
index 98ad8cb8b..77c726e71 100644
--- a/ldso/ldso/dl-startup.c
+++ b/ldso/ldso/dl-startup.c
@@ -205,9 +205,9 @@ static void * __attribute_used__ _dl_start(unsigned long args)
tpnt->dynamic_addr = dpnt;
#if defined(__mips__) || defined(__cris__)
/* Some architectures cannot call functions here, must inline */
- __dl_parse_dynamic_info(dpnt, tpnt->dynamic_info, NULL);
+ __dl_parse_dynamic_info(dpnt, tpnt->dynamic_info, NULL, load_addr);
#else
- _dl_parse_dynamic_info(dpnt, tpnt->dynamic_info, NULL);
+ _dl_parse_dynamic_info(dpnt, tpnt->dynamic_info, NULL, load_addr);
#endif
#ifdef __SUPPORT_LD_DEBUG_EARLY__
@@ -299,8 +299,8 @@ static void * __attribute_used__ _dl_start(unsigned long args)
char *strtab;
Elf32_Sym *symtab;
- symtab = (Elf32_Sym *) (tpnt->dynamic_info[DT_SYMTAB] + load_addr);
- strtab = (char *) (tpnt->dynamic_info[DT_STRTAB] + load_addr);
+ symtab = (Elf32_Sym *) tpnt->dynamic_info[DT_SYMTAB];
+ strtab = (char *) tpnt->dynamic_info[DT_STRTAB];
sym = &symtab[symtab_index];
symbol_addr = load_addr + sym->st_value;
diff --git a/ldso/ldso/i386/dl-sysdep.h b/ldso/ldso/i386/dl-sysdep.h
index a916bb776..a8b1ab33a 100644
--- a/ldso/ldso/i386/dl-sysdep.h
+++ b/ldso/ldso/i386/dl-sysdep.h
@@ -71,7 +71,7 @@ static inline void
elf_machine_relative (Elf32_Addr load_off, const Elf32_Addr rel_addr,
Elf32_Word relative_count)
{
- Elf32_Rel * rpnt = (void *) (rel_addr + load_off);
+ Elf32_Rel * rpnt = (void *) rel_addr;
--rpnt;
do {
Elf32_Addr *const reloc_addr = (void *) (load_off + (++rpnt)->r_offset);
diff --git a/ldso/ldso/i386/elfinterp.c b/ldso/ldso/i386/elfinterp.c
index cb5a24a9e..334b72e20 100644
--- a/ldso/ldso/i386/elfinterp.c
+++ b/ldso/ldso/i386/elfinterp.c
@@ -125,14 +125,14 @@ _dl_linux_resolver(struct elf_resolve *tpnt, int reloc_entry)
unsigned long instr_addr;
char *symname;
- rel_addr = (char *)(tpnt->dynamic_info[DT_JMPREL] + tpnt->loadaddr);
+ rel_addr = (char *)tpnt->dynamic_info[DT_JMPREL];
this_reloc = (ELF_RELOC *)(intptr_t)(rel_addr + reloc_entry);
reloc_type = ELF32_R_TYPE(this_reloc->r_info);
symtab_index = ELF32_R_SYM(this_reloc->r_info);
- symtab = (Elf32_Sym *)(intptr_t)(tpnt->dynamic_info[DT_SYMTAB] + tpnt->loadaddr);
- strtab = (char *)(tpnt->dynamic_info[DT_STRTAB] + tpnt->loadaddr);
+ symtab = (Elf32_Sym *)(intptr_t)tpnt->dynamic_info[DT_SYMTAB];
+ strtab = (char *)tpnt->dynamic_info[DT_STRTAB];
symname = strtab + symtab[symtab_index].st_name;
if (unlikely(reloc_type != R_386_JMP_SLOT)) {
@@ -186,11 +186,11 @@ _dl_parse(struct elf_resolve *tpnt, struct dyn_elf *scope,
int symtab_index;
/* Parse the relocation information. */
- rpnt = (ELF_RELOC *)(intptr_t)(rel_addr + tpnt->loadaddr);
+ rpnt = (ELF_RELOC *)(intptr_t)rel_addr;
rel_size /= sizeof(ELF_RELOC);
- symtab = (Elf32_Sym *)(intptr_t)(tpnt->dynamic_info[DT_SYMTAB] + tpnt->loadaddr);
- strtab = (char *)(tpnt->dynamic_info[DT_STRTAB] + tpnt->loadaddr);
+ symtab = (Elf32_Sym *)(intptr_t)tpnt->dynamic_info[DT_SYMTAB];
+ strtab = (char *)tpnt->dynamic_info[DT_STRTAB];
for (i = 0; i < rel_size; i++, rpnt++) {
int res;
diff --git a/ldso/ldso/ldso.c b/ldso/ldso/ldso.c
index b87d4b693..d1073b334 100644
--- a/ldso/ldso/ldso.c
+++ b/ldso/ldso/ldso.c
@@ -235,7 +235,7 @@ void _dl_get_ready_to_run(struct elf_resolve *tpnt, unsigned long load_addr,
}
if (ppnt->p_type == PT_DYNAMIC) {
dpnt = (Elf32_Dyn *) (ppnt->p_vaddr + app_tpnt->loadaddr);
- _dl_parse_dynamic_info(dpnt, app_tpnt->dynamic_info, debug_addr);
+ _dl_parse_dynamic_info(dpnt, app_tpnt->dynamic_info, debug_addr, app_tpnt->loadaddr);
#ifndef __FORCE_SHAREABLE_TEXT_SEGMENTS__
/* Ugly, ugly. We need to call mprotect to change the
* protection of the text pages so that we can do the
@@ -275,7 +275,7 @@ void _dl_get_ready_to_run(struct elf_resolve *tpnt, unsigned long load_addr,
app_tpnt->rtld_flags = unlazy | RTLD_GLOBAL;
app_tpnt->usage_count++;
app_tpnt->symbol_scope = _dl_symbol_tables;
- lpnt = (unsigned long *) (app_tpnt->dynamic_info[DT_PLTGOT] + app_tpnt->loadaddr);
+ lpnt = (unsigned long *) (app_tpnt->dynamic_info[DT_PLTGOT]);
#ifdef ALLOW_ZERO_PLTGOT
if (lpnt)
#endif
@@ -572,7 +572,7 @@ next_lib2:
char *name;
struct init_fini_list *tmp;
- lpntstr = (char*) (tcurr->loadaddr + tcurr->dynamic_info[DT_STRTAB] + dpnt->d_un.d_val);
+ lpntstr = (char*) (tcurr->dynamic_info[DT_STRTAB] + dpnt->d_un.d_val);
name = _dl_get_last_path_component(lpntstr);
if ((tpnt1 = _dl_check_if_named_library_is_loaded(name, trace_loaded_objects))) {
@@ -717,7 +717,7 @@ next_lib2:
#ifdef RERELOCATE_LDSO
/* Only rerelocate functions for now. */
tpnt->init_flag = RELOCS_DONE;
- lpnt = (unsigned long *) (tpnt->dynamic_info[DT_PLTGOT] + load_addr);
+ lpnt = (unsigned long *) (tpnt->dynamic_info[DT_PLTGOT]);
# ifdef ALLOW_ZERO_PLTGOT
if (tpnt->dynamic_info[DT_PLTGOT])
# endif
diff --git a/ldso/ldso/m68k/dl-sysdep.h b/ldso/ldso/m68k/dl-sysdep.h
index 88722ee21..c11d2fbfe 100644
--- a/ldso/ldso/m68k/dl-sysdep.h
+++ b/ldso/ldso/m68k/dl-sysdep.h
@@ -68,7 +68,7 @@ static inline void
elf_machine_relative (Elf32_Addr load_off, const Elf32_Addr rel_addr,
Elf32_Word relative_count)
{
- Elf32_Rela * rpnt = (void *) (rel_addr + load_off);
+ Elf32_Rela * rpnt = (void *)rel_addr;
--rpnt;
do {
Elf32_Addr *const reloc_addr = (void *) (load_off + (++rpnt)->r_offset);
diff --git a/ldso/ldso/m68k/elfinterp.c b/ldso/ldso/m68k/elfinterp.c
index fcc21c497..b7d0f362a 100644
--- a/ldso/ldso/m68k/elfinterp.c
+++ b/ldso/ldso/m68k/elfinterp.c
@@ -69,13 +69,13 @@ _dl_linux_resolver (struct elf_resolve *tpnt, int reloc_entry)
char **got_addr;
unsigned int instr_addr;
- rel_addr = (ELF_RELOC *)(tpnt->dynamic_info[DT_JMPREL] + tpnt->loadaddr);
+ rel_addr = (ELF_RELOC *)tpnt->dynamic_info[DT_JMPREL];
this_reloc = (Elf32_Rela *) (rel_addr + reloc_entry);
reloc_type = ELF32_R_TYPE (this_reloc->r_info);
symtab_index = ELF32_R_SYM (this_reloc->r_info);
- symtab = (Elf32_Sym *) (tpnt->dynamic_info[DT_SYMTAB] + tpnt->loadaddr);
- strtab = (char *) (tpnt->dynamic_info[DT_STRTAB] + tpnt->loadaddr);
+ symtab = (Elf32_Sym *)tpnt->dynamic_info[DT_SYMTAB];
+ strtab = (char *)tpnt->dynamic_info[DT_STRTAB];
if (unlikely(reloc_type != R_68K_JMP_SLOT)) {
_dl_dprintf (2, "%s: incorrect relocation type in jump relocations\n",
@@ -136,12 +136,11 @@ _dl_parse_lazy_relocation_information(struct dyn_elf *arg_rpnt,
struct elf_resolve *tpnt = arg_rpnt->dyn;
/* Now parse the relocation information. */
- rpnt = (Elf32_Rela *) (rel_addr + tpnt->loadaddr);
+ rpnt = (Elf32_Rela *)rel_addr;
rel_size = rel_size / sizeof (Elf32_Rela);
- symtab = (Elf32_Sym *) (tpnt->dynamic_info[DT_SYMTAB]
- + tpnt->loadaddr);
- strtab = (char *) (tpnt->dynamic_info[DT_STRTAB] + tpnt->loadaddr);
+ symtab = (Elf32_Sym *)tpnt->dynamic_info[DT_SYMTAB];
+ strtab = (char *)tpnt->dynamic_info[DT_STRTAB];
for (i = 0; i < rel_size; i++, rpnt++) {
reloc_addr = (int *) (tpnt->loadaddr + (int) rpnt->r_offset);
@@ -184,12 +183,11 @@ _dl_parse_relocation_information(struct dyn_elf *arg_rpnt,
struct elf_resolve *tpnt = arg_rpnt->dyn;
/* Now parse the relocation information */
- rpnt = (Elf32_Rela *) (rel_addr + tpnt->loadaddr);
+ rpnt = (Elf32_Rela *)rel_addr;
rel_size = rel_size / sizeof (Elf32_Rela);
- symtab = (Elf32_Sym *) (tpnt->dynamic_info[DT_SYMTAB]
- + tpnt->loadaddr);
- strtab = (char *) (tpnt->dynamic_info[DT_STRTAB] + tpnt->loadaddr);
+ symtab = (Elf32_Sym *)tpnt->dynamic_info[DT_SYMTAB];
+ strtab = (char *)tpnt->dynamic_info[DT_STRTAB];
for (i = 0; i < rel_size; i++, rpnt++) {
reloc_addr = (int *) (tpnt->loadaddr + (int) rpnt->r_offset);
diff --git a/ldso/ldso/mips/dl-startup.h b/ldso/ldso/mips/dl-startup.h
index 0e9cb1856..f369f77f1 100644
--- a/ldso/ldso/mips/dl-startup.h
+++ b/ldso/ldso/mips/dl-startup.h
@@ -64,8 +64,8 @@ do { \
\
/* Handle global GOT entries */ \
mipsgot += tpnt->dynamic_info[DT_MIPS_LOCAL_GOTNO_IDX]; \
- sym = (Elf32_Sym *) (tpnt->dynamic_info[DT_SYMTAB] + \
- tpnt->loadaddr) + tpnt->dynamic_info[DT_MIPS_GOTSYM_IDX]; \
+ sym = (Elf32_Sym *) tpnt->dynamic_info[DT_SYMTAB] + \
+ tpnt->dynamic_info[DT_MIPS_GOTSYM_IDX]; \
i = tpnt->dynamic_info[DT_MIPS_SYMTABNO_IDX] - tpnt->dynamic_info[DT_MIPS_GOTSYM_IDX];\
\
while (i--) { \
diff --git a/ldso/ldso/mips/elfinterp.c b/ldso/ldso/mips/elfinterp.c
index 39a147df0..c551d6ca4 100644
--- a/ldso/ldso/mips/elfinterp.c
+++ b/ldso/ldso/mips/elfinterp.c
@@ -124,8 +124,8 @@ unsigned long _dl_linux_resolver(unsigned long sym_index,
gotsym = tpnt->dynamic_info[DT_MIPS_GOTSYM_IDX];
local_gotno = tpnt->dynamic_info[DT_MIPS_LOCAL_GOTNO_IDX];
- sym = ((Elf32_Sym *) (tpnt->dynamic_info[DT_SYMTAB] + tpnt->loadaddr)) + sym_index;
- strtab = (char *) (tpnt->dynamic_info[DT_STRTAB] + tpnt->loadaddr);
+ sym = ((Elf32_Sym *) tpnt->dynamic_info[DT_SYMTAB]) + sym_index;
+ strtab = (char *) tpnt->dynamic_info[DT_STRTAB];
symname = strtab + sym->st_name;
new_addr = (unsigned long) _dl_find_hash(symname,
@@ -182,11 +182,11 @@ int _dl_parse_relocation_information(struct dyn_elf *xpnt,
/* Now parse the relocation information */
rel_size = rel_size / sizeof(Elf32_Rel);
- rpnt = (Elf32_Rel *) (rel_addr + tpnt->loadaddr);
+ rpnt = (Elf32_Rel *) rel_addr;
- symtab = (Elf32_Sym *) (tpnt->dynamic_info[DT_SYMTAB] + tpnt->loadaddr);
- strtab = (char *) (tpnt->dynamic_info[DT_STRTAB] + tpnt->loadaddr);
- got = (unsigned long *) (tpnt->dynamic_info[DT_PLTGOT] + tpnt->loadaddr);
+ symtab = (Elf32_Sym *) tpnt->dynamic_info[DT_SYMTAB];
+ strtab = (char *) tpnt->dynamic_info[DT_STRTAB];
+ got = (unsigned long *) tpnt->dynamic_info[DT_PLTGOT];
for (i = 0; i < rel_size; i++, rpnt++) {
reloc_addr = (unsigned long *) (tpnt->loadaddr +
@@ -261,12 +261,10 @@ void _dl_perform_mips_global_got_relocations(struct elf_resolve *tpnt, int lazy)
continue;
/* Setup the loop variables */
- got_entry = (unsigned long *) (tpnt->loadaddr +
- tpnt->dynamic_info[DT_PLTGOT]) + tpnt->dynamic_info[DT_MIPS_LOCAL_GOTNO_IDX];
- sym = (Elf32_Sym *) (tpnt->dynamic_info[DT_SYMTAB] +
- (unsigned long) tpnt->loadaddr) + tpnt->dynamic_info[DT_MIPS_GOTSYM_IDX];
- strtab = (char *) (tpnt->dynamic_info[DT_STRTAB] +
- (unsigned long) tpnt->loadaddr);
+ got_entry = (unsigned long *) (tpnt->dynamic_info[DT_PLTGOT])
+ + tpnt->dynamic_info[DT_MIPS_LOCAL_GOTNO_IDX];
+ sym = (Elf32_Sym *) tpnt->dynamic_info[DT_SYMTAB] + tpnt->dynamic_info[DT_MIPS_GOTSYM_IDX];
+ strtab = (char *) tpnt->dynamic_info[DT_STRTAB];
i = tpnt->dynamic_info[DT_MIPS_SYMTABNO_IDX] - tpnt->dynamic_info[DT_MIPS_GOTSYM_IDX];
#if defined (__SUPPORT_LD_DEBUG__)
diff --git a/ldso/ldso/powerpc/dl-sysdep.h b/ldso/ldso/powerpc/dl-sysdep.h
index b09ada5c3..6f7bde147 100644
--- a/ldso/ldso/powerpc/dl-sysdep.h
+++ b/ldso/ldso/powerpc/dl-sysdep.h
@@ -158,7 +158,7 @@ static inline void
elf_machine_relative (Elf32_Addr load_off, const Elf32_Addr rel_addr,
Elf32_Word relative_count)
{
- Elf32_Rela * rpnt = (void *) (rel_addr + load_off);
+ Elf32_Rela * rpnt = (void *)rel_addr;
--rpnt;
do { /* PowerPC handles pre increment/decrement better */
Elf32_Addr *const reloc_addr = (void *) (load_off + (++rpnt)->r_offset);
diff --git a/ldso/ldso/powerpc/elfinterp.c b/ldso/ldso/powerpc/elfinterp.c
index e156aa355..dd2aa5aac 100644
--- a/ldso/ldso/powerpc/elfinterp.c
+++ b/ldso/ldso/powerpc/elfinterp.c
@@ -181,14 +181,14 @@ unsigned long _dl_linux_resolver(struct elf_resolve *tpnt, int reloc_entry)
Elf32_Addr finaladdr;
Elf32_Sword delta;
- rel_addr = (ELF_RELOC *) (tpnt->dynamic_info[DT_JMPREL] + tpnt->loadaddr);
+ rel_addr = (ELF_RELOC *)tpnt->dynamic_info[DT_JMPREL];
this_reloc = (void *)rel_addr + reloc_entry;
symtab_index = ELF32_R_SYM(this_reloc->r_info);
- symtab = (Elf32_Sym *) (tpnt->dynamic_info[DT_SYMTAB] + tpnt->loadaddr);
- strtab = (char *) (tpnt->dynamic_info[DT_STRTAB] + tpnt->loadaddr);
- symname = strtab + symtab[symtab_index].st_name;
+ symtab = (Elf32_Sym *)tpnt->dynamic_info[DT_SYMTAB];
+ strtab = (char *)tpnt->dynamic_info[DT_STRTAB];
+ symname = strtab + symtab[symtab_index].st_name;
#if defined (__SUPPORT_LD_DEBUG__)
debug_sym(symtab,strtab,symtab_index);
@@ -229,7 +229,7 @@ unsigned long _dl_linux_resolver(struct elf_resolve *tpnt, int reloc_entry)
/* Warning: we don't handle double-sized PLT entries */
Elf32_Word *plt, *data_words, index, offset;
- plt = (Elf32_Word *)(tpnt->dynamic_info[DT_PLTGOT] + tpnt->loadaddr);
+ plt = (Elf32_Word *)tpnt->dynamic_info[DT_PLTGOT];
offset = reloc_addr - plt;
index = (offset - PLT_INITIAL_ENTRY_WORDS)/2;
data_words = (Elf32_Word *)tpnt->data_words;
@@ -265,7 +265,7 @@ _dl_do_reloc (struct elf_resolve *tpnt,struct dyn_elf *scope,
#endif
reloc_addr = (Elf32_Addr *)(intptr_t) (tpnt->loadaddr + (unsigned long) rpnt->r_offset);
reloc_type = ELF32_R_TYPE(rpnt->r_info);
- symbol_addr = tpnt->loadaddr; /* For R_PPC_RELATIVE */
+ symbol_addr = tpnt->loadaddr; /* For R_PPC_RELATIVE */
symtab_index = ELF32_R_SYM(rpnt->r_info);
symname = strtab + symtab[symtab_index].st_name;
if (symtab_index) {
@@ -275,10 +275,8 @@ _dl_do_reloc (struct elf_resolve *tpnt,struct dyn_elf *scope,
* have been intentional. We should not be linking local symbols
* here, so all bases should be covered.
*/
- if (unlikely(!symbol_addr && ELF32_ST_BIND(symtab[symtab_index].st_info) != STB_WEAK)) {
- _dl_dprintf(2, "%s: can't resolve symbol '%s'\n", _dl_progname, symname);
- _dl_exit(1);
- };
+ if (unlikely(!symbol_addr && ELF32_ST_BIND(symtab[symtab_index].st_info) != STB_WEAK))
+ return -1;
}
#if defined (__SUPPORT_LD_DEBUG__)
old_val = *reloc_addr;
@@ -302,7 +300,7 @@ _dl_do_reloc (struct elf_resolve *tpnt,struct dyn_elf *scope,
/* Warning: we don't handle double-sized PLT entries */
Elf32_Word *plt, *data_words, index, offset;
- plt = (Elf32_Word *)(tpnt->dynamic_info[DT_PLTGOT] + tpnt->loadaddr);
+ plt = (Elf32_Word *)tpnt->dynamic_info[DT_PLTGOT];
offset = reloc_addr - plt;
index = (offset - PLT_INITIAL_ENTRY_WORDS)/2;
data_words = (Elf32_Word *)tpnt->data_words;
@@ -349,7 +347,7 @@ _dl_do_reloc (struct elf_resolve *tpnt,struct dyn_elf *scope,
}
#else
_dl_dprintf(2,"R_PPC_REL24: Compile shared libraries with -fPIC!\n");
- _dl_exit(1);
+ return -1;
#endif
case R_PPC_NONE:
goto out_nocode; /* No code code modified */
@@ -385,7 +383,7 @@ void _dl_parse_lazy_relocation_information(struct dyn_elf *rpnt,
num_plt_entries = rel_size / sizeof(ELF_RELOC);
rel_offset_words = PLT_DATA_START_WORDS(num_plt_entries);
- plt = (Elf32_Word *)(tpnt->dynamic_info[DT_PLTGOT] + tpnt->loadaddr);
+ plt = (Elf32_Word *)tpnt->dynamic_info[DT_PLTGOT];
/* Set up the lazy PLT entries. */
offset = PLT_INITIAL_ENTRY_WORDS;
@@ -428,11 +426,11 @@ _dl_parse(struct elf_resolve *tpnt, struct dyn_elf *scope,
int symtab_index;
/* Now parse the relocation information */
- rpnt = (ELF_RELOC *)(intptr_t) (rel_addr + tpnt->loadaddr);
+ rpnt = (ELF_RELOC *)(intptr_t)rel_addr;
rel_size = rel_size / sizeof(ELF_RELOC);
- symtab = (Elf32_Sym *)(intptr_t) (tpnt->dynamic_info[DT_SYMTAB] + tpnt->loadaddr);
- strtab = (char *) (tpnt->dynamic_info[DT_STRTAB] + tpnt->loadaddr);
+ symtab = (Elf32_Sym *)(intptr_t)tpnt->dynamic_info[DT_SYMTAB];
+ strtab = (char *)tpnt->dynamic_info[DT_STRTAB];
for (i = 0; i < rel_size; i++, rpnt++) {
int res;
diff --git a/ldso/ldso/sh/dl-startup.h b/ldso/ldso/sh/dl-startup.h
index d669b4d2a..848ca0a60 100644
--- a/ldso/ldso/sh/dl-startup.h
+++ b/ldso/ldso/sh/dl-startup.h
@@ -68,7 +68,3 @@ asm(
* call the _dl_elf_main function.
*/
#define START() return _dl_elf_main;
-
-
-
-
diff --git a/ldso/ldso/sh/dl-sysdep.h b/ldso/ldso/sh/dl-sysdep.h
index 0234fb7bf..1ecb34898 100644
--- a/ldso/ldso/sh/dl-sysdep.h
+++ b/ldso/ldso/sh/dl-sysdep.h
@@ -156,7 +156,7 @@ elf_machine_relative (Elf32_Addr load_off, const Elf32_Addr rel_addr,
Elf32_Word relative_count)
{
Elf32_Addr value;
- Elf32_Rela * rpnt = (void *) (rel_addr + load_off);
+ Elf32_Rela * rpnt = (void *)rel_addr;
do {
Elf32_Addr *const reloc_addr = (void *) (load_off + rpnt->r_offset);
diff --git a/ldso/ldso/sh/elfinterp.c b/ldso/ldso/sh/elfinterp.c
index 18551841c..794910c6d 100644
--- a/ldso/ldso/sh/elfinterp.c
+++ b/ldso/ldso/sh/elfinterp.c
@@ -126,14 +126,14 @@ unsigned long _dl_linux_resolver(struct elf_resolve *tpnt, int reloc_entry)
unsigned long instr_addr;
char *symname;
- rel_addr = (char *) (tpnt->dynamic_info[DT_JMPREL] + tpnt->loadaddr);
+ rel_addr = (char *)tpnt->dynamic_info[DT_JMPREL];
this_reloc = (ELF_RELOC *)(intptr_t)(rel_addr + reloc_entry);
reloc_type = ELF32_R_TYPE(this_reloc->r_info);
symtab_index = ELF32_R_SYM(this_reloc->r_info);
- symtab = (Elf32_Sym *)(intptr_t) (tpnt->dynamic_info[DT_SYMTAB] + tpnt->loadaddr);
- strtab = (char *) (tpnt->dynamic_info[DT_STRTAB] + tpnt->loadaddr);
+ symtab = (Elf32_Sym *)(intptr_t) tpnt->dynamic_info[DT_SYMTAB];
+ strtab = (char *) tpnt->dynamic_info[DT_STRTAB];
symname = strtab + symtab[symtab_index].st_name;
if (unlikely(reloc_type != R_SH_JMP_SLOT)) {
@@ -189,11 +189,11 @@ _dl_parse(struct elf_resolve *tpnt, struct dyn_elf *scope,
int symtab_index;
/* Now parse the relocation information */
- rpnt = (ELF_RELOC *)(intptr_t) (rel_addr + tpnt->loadaddr);
+ rpnt = (ELF_RELOC *)(intptr_t) rel_addr;
rel_size = rel_size / sizeof(ELF_RELOC);
- symtab = (Elf32_Sym *)(intptr_t) (tpnt->dynamic_info[DT_SYMTAB] + tpnt->loadaddr);
- strtab = (char *) (tpnt->dynamic_info[DT_STRTAB] + tpnt->loadaddr);
+ symtab = (Elf32_Sym *)(intptr_t)tpnt->dynamic_info[DT_SYMTAB];
+ strtab = (char *)tpnt->dynamic_info[DT_STRTAB];
for (i = 0; i < rel_size; i++, rpnt++) {
int res;
diff --git a/ldso/ldso/sh64/dl-sysdep.h b/ldso/ldso/sh64/dl-sysdep.h
index 9e35e6029..852cb0d41 100644
--- a/ldso/ldso/sh64/dl-sysdep.h
+++ b/ldso/ldso/sh64/dl-sysdep.h
@@ -100,7 +100,7 @@ elf_machine_relative (Elf32_Addr load_off, const Elf32_Addr rel_addr,
Elf32_Word relative_count)
{
Elf32_Addr value;
- Elf32_Rela * rpnt = (void *) (rel_addr + load_off);
+ Elf32_Rela * rpnt = (void *)rel_addr;
do {
Elf32_Addr *const reloc_addr = (void *) (load_off + rpnt->r_offset);
diff --git a/ldso/ldso/sh64/elfinterp.c b/ldso/ldso/sh64/elfinterp.c
index 82d66552a..7b5aaee7d 100644
--- a/ldso/ldso/sh64/elfinterp.c
+++ b/ldso/ldso/sh64/elfinterp.c
@@ -166,15 +166,14 @@ unsigned long _dl_linux_resolver(struct elf_resolve *tpnt, int reloc_entry)
unsigned long instr_addr;
char *symname;
- rel_addr = (char *)(tpnt->dynamic_info[DT_JMPREL] + tpnt->loadaddr);
+ rel_addr = (char *)tpnt->dynamic_info[DT_JMPREL];
this_reloc = (ELF_RELOC *)(intptr_t)(rel_addr + reloc_entry);
reloc_type = ELF32_R_TYPE(this_reloc->r_info);
symtab_index = ELF32_R_SYM(this_reloc->r_info);
- symtab = (Elf32_Sym *)(intptr_t)
- (tpnt->dynamic_info[DT_SYMTAB] + tpnt->loadaddr);
- strtab = (char *)(tpnt->dynamic_info[DT_STRTAB] + tpnt->loadaddr);
+ symtab = (Elf32_Sym *)(intptr_t)tpnt->dynamic_info[DT_SYMTAB];
+ strtab = (char *)tpnt->dynamic_info[DT_STRTAB];
symname = strtab + symtab[symtab_index].st_name;
if (unlikely(reloc_type != R_SH_JMP_SLOT)) {
@@ -233,12 +232,11 @@ static int _dl_parse(struct elf_resolve *tpnt, struct dyn_elf *scope,
int symtab_index;
/* Now parse the relocation information */
- rpnt = (ELF_RELOC *)(intptr_t)(rel_addr + tpnt->loadaddr);
+ rpnt = (ELF_RELOC *)(intptr_t)rel_addr;
rel_size = rel_size / sizeof(ELF_RELOC);
- symtab = (Elf32_Sym *)(intptr_t)
- (tpnt->dynamic_info[DT_SYMTAB] + tpnt->loadaddr);
- strtab = (char *)(tpnt->dynamic_info[DT_STRTAB] + tpnt->loadaddr);
+ symtab = (Elf32_Sym *)(intptr_t)tpnt->dynamic_info[DT_SYMTAB];
+ strtab = (char *)tpnt->dynamic_info[DT_STRTAB];
for (i = 0; i < rel_size; i++, rpnt++) {
int res;
diff --git a/ldso/ldso/sparc/dl-sysdep.h b/ldso/ldso/sparc/dl-sysdep.h
index 7559a80d2..198088b3c 100644
--- a/ldso/ldso/sparc/dl-sysdep.h
+++ b/ldso/ldso/sparc/dl-sysdep.h
@@ -160,7 +160,7 @@ static inline void
elf_machine_relative (Elf32_Addr load_off, const Elf32_Addr rel_addr,
Elf32_Word relative_count)
{
- Elf32_Rela * rpnt = (void *) (rel_addr + load_off);
+ Elf32_Rela * rpnt = (void *)rel_addr;
--rpnt;
do {
Elf32_Addr *const reloc_addr = (void *) (load_off + (++rpnt)->r_offset);
diff --git a/ldso/ldso/sparc/elfinterp.c b/ldso/ldso/sparc/elfinterp.c
index 423ae190a..a84507b91 100644
--- a/ldso/ldso/sparc/elfinterp.c
+++ b/ldso/ldso/sparc/elfinterp.c
@@ -66,8 +66,7 @@ unsigned int _dl_linux_resolver(unsigned int reloc_entry, unsigned int * plt)
unsigned int instr_addr;
tpnt = (struct elf_resolve *) plt[2];
- rel_addr = (Elf32_Rela *) (tpnt->dynamic_info[DT_JMPREL] +
- tpnt->loadaddr);
+ rel_addr = (Elf32_Rela *)tpnt->dynamic_info[DT_JMPREL];
/*
* Generate the correct relocation index into the .rela.plt section.
@@ -79,8 +78,8 @@ unsigned int _dl_linux_resolver(unsigned int reloc_entry, unsigned int * plt)
reloc_type = ELF32_R_TYPE(this_reloc->r_info);
symtab_index = ELF32_R_SYM(this_reloc->r_info);
- symtab = (Elf32_Sym *) (tpnt->dynamic_info[DT_SYMTAB] + tpnt->loadaddr);
- strtab = (char *) (tpnt->dynamic_info[DT_STRTAB] + tpnt->loadaddr);
+ symtab = (Elf32_Sym *)tpnt->dynamic_info[DT_SYMTAB];
+ strtab = (char *)tpnt->dynamic_info[DT_STRTAB];
#ifdef __SUPPORT_LD_DEBUG__
if (_dl_debug_symbols) {
@@ -159,10 +158,10 @@ void _dl_parse_lazy_relocation_information(struct dyn_elf *arg_rpnt,
struct elf_resolve * tpnt = arg_rpnt->dyn;
/* Now parse the relocation information */
- rpnt = (Elf32_Rela *) (rel_addr + tpnt->loadaddr);
+ rpnt = (Elf32_Rela *)rel_addr;
- symtab = (Elf32_Sym *) (tpnt->dynamic_info[DT_SYMTAB] + tpnt->loadaddr);
- strtab = ( char *) (tpnt->dynamic_info[DT_STRTAB] + tpnt->loadaddr);
+ symtab = (Elf32_Sym *)tpnt->dynamic_info[DT_SYMTAB];
+ strtab = ( char *)tpnt->dynamic_info[DT_STRTAB];
for(i=0; i< rel_size; i += sizeof(Elf32_Rela), rpnt++){
reloc_addr = (int *) (tpnt->loadaddr + (int)rpnt->r_offset);
@@ -201,10 +200,10 @@ int _dl_parse_relocation_information(struct dyn_elf *arg_rpnt,
struct elf_resolve * tpnt = arg_rpnt->dyn;
/* Now parse the relocation information */
- rpnt = (Elf32_Rela *) (rel_addr + tpnt->loadaddr);
+ rpnt = (Elf32_Rela *)rel_addr;
- symtab = (Elf32_Sym *) (tpnt->dynamic_info[DT_SYMTAB] + tpnt->loadaddr);
- strtab = ( char *) (tpnt->dynamic_info[DT_STRTAB] + tpnt->loadaddr);
+ symtab = (Elf32_Sym *)tpnt->dynamic_info[DT_SYMTAB];
+ strtab = ( char *)tpnt->dynamic_info[DT_STRTAB];
for(i=0; i< rel_size; i+= sizeof(Elf32_Rela), rpnt++){
reloc_addr = (int *) (tpnt->loadaddr + (int)rpnt->r_offset);
diff --git a/ldso/libdl/libdl.c b/ldso/libdl/libdl.c
index 012056a35..e538d89de 100644
--- a/ldso/libdl/libdl.c
+++ b/ldso/libdl/libdl.c
@@ -212,7 +212,7 @@ void *dlopen(const char *libname, int flag)
if (dpnt->d_tag == DT_NEEDED) {
char *name;
- lpntstr = (char*) (tcurr->loadaddr + tcurr->dynamic_info[DT_STRTAB] +
+ lpntstr = (char*) (tcurr->dynamic_info[DT_STRTAB] +
dpnt->d_un.d_val);
name = _dl_get_last_path_component(lpntstr);
tpnt1 = _dl_check_if_named_library_is_loaded(name, 0);
@@ -640,8 +640,8 @@ int dladdr(const void *__address, Dl_info * __info)
ElfW(Addr) sa;
sa = 0;
- symtab = (Elf32_Sym *) (pelf->dynamic_info[DT_SYMTAB] + pelf->loadaddr);
- strtab = (char *) (pelf->dynamic_info[DT_STRTAB] + pelf->loadaddr);
+ symtab = (Elf32_Sym *) (pelf->dynamic_info[DT_SYMTAB]);
+ strtab = (char *) (pelf->dynamic_info[DT_STRTAB]);
sf = 0;
for (hn = 0; hn < pelf->nbucket; hn++) {