[git commit ldso-future 1/1] ldso/mips: correct elfinterp.c to build
Peter S. Mazinger
ps.m at gmx.net
Wed Mar 30 11:53:36 UTC 2011
commit: http://git.uclibc.org/uClibc/commit/?id=4684dafbea8e0d09de3fc1294652c2abe3d0bb1a
branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/ldso-future
Move reloc_addr out of the for loop.
Move some prototypes to dl-sysdep.h since they are needed elsewhere too.
Signed-off-by: Peter S. Mazinger <ps.m at gmx.net>
---
ldso/ldso/mips/dl-sysdep.h | 7 +++++--
ldso/ldso/mips/elfinterp.c | 13 ++++++-------
2 files changed, 11 insertions(+), 9 deletions(-)
diff --git a/ldso/ldso/mips/dl-sysdep.h b/ldso/ldso/mips/dl-sysdep.h
index bf08d41..69fc8b9 100644
--- a/ldso/ldso/mips/dl-sysdep.h
+++ b/ldso/ldso/mips/dl-sysdep.h
@@ -7,7 +7,9 @@
/* Define this if the system uses RELOCA. */
#undef ELF_USES_RELOCA
+#include <sgidefs.h>
#include <elf.h>
+#include <link.h>
#ifdef __mips64 /* from glibc sysdeps/mips/elf/ldsodefs.h 1.4 */
/* The 64-bit MIPS ELF ABI uses an unusual reloc format. Each
@@ -91,8 +93,6 @@ typedef struct
#define ELF64_R_INFO(sym, type) ELF64_MIPS_R_INFO ((sym), (type))
#endif /* __mips64 */
-#include <link.h>
-
#define ARCH_NUM 4
#define DT_MIPS_GOTSYM_IDX (DT_NUM + OS_NUM)
#define DT_MIPS_LOCAL_GOTNO_IDX (DT_NUM + OS_NUM +1)
@@ -158,6 +158,9 @@ do { \
unsigned long __dl_runtime_resolve(unsigned long sym_index,
unsigned long old_gpreg);
+extern int _dl_runtime_resolve(void);
+extern int _dl_runtime_pltresolve(void);
+
struct elf_resolve;
void _dl_perform_mips_global_got_relocations(struct elf_resolve *tpnt, int lazy);
diff --git a/ldso/ldso/mips/elfinterp.c b/ldso/ldso/mips/elfinterp.c
index 1e2bf4b..eb2bc3e 100644
--- a/ldso/ldso/mips/elfinterp.c
+++ b/ldso/ldso/mips/elfinterp.c
@@ -29,8 +29,6 @@
#include <ldso.h>
-extern int _dl_runtime_pltresolve(void);
-
#define OFFSET_GP_GOT 0x7ff0
unsigned long __dl_runtime_resolve(unsigned long sym_index,
@@ -95,9 +93,10 @@ int _dl_parse_relocation_information(struct dyn_elf *xpnt,
ElfW(Addr) rel_addr,
ElfW(Word) rel_size)
{
+ ElfW(Addr) *reloc_addr = NULL;
struct elf_resolve *tpnt = xpnt->dyn;
#if defined (__SUPPORT_LD_DEBUG__)
- ElfW(Addr) old_val;
+ ElfW(Addr) old_val = 0;
#endif
const ElfW(Sym) *const symtab = (const void *)tpnt->dynamic_info[DT_SYMTAB];
const char *strtab = (const void *)tpnt->dynamic_info[DT_STRTAB];
@@ -109,7 +108,7 @@ int _dl_parse_relocation_information(struct dyn_elf *xpnt,
const ElfW(Addr) *got = (const ElfW(Addr) *)tpnt->dynamic_info[DT_PLTGOT];
for (unsigned int i = 0; i < rel_size; i++, rpnt++) {
- ElfW(Addr) *reloc_addr = (ElfW(Addr) *)(tpnt->loadaddr + rpnt->r_offset);
+ reloc_addr = (ElfW(Addr) *)(tpnt->loadaddr + rpnt->r_offset);
const unsigned int reloc_type = ELF_R_TYPE(rpnt->r_info);
const int symtab_index = ELF_R_SYM(rpnt->r_info);
ElfW(Addr) symbol_addr = 0;
@@ -138,6 +137,7 @@ int _dl_parse_relocation_information(struct dyn_elf *xpnt,
/* Let the caller handle the error: it may be non fatal if called from dlopen */
return 1;
+ }
}
if (!symtab_index) {
@@ -203,10 +203,9 @@ int _dl_parse_relocation_information(struct dyn_elf *xpnt,
#endif
break;
}
-
break;
}
-#endif /* __UCLIBC_HAS_TLS */
+#endif /* __UCLIBC_HAS_TLS__ */
#if _MIPS_SIM == _MIPS_SIM_ABI64
case (R_MIPS_64 << 8) | R_MIPS_REL32:
#else /* O32 || N32 */
@@ -252,8 +251,8 @@ int _dl_parse_relocation_information(struct dyn_elf *xpnt,
_dl_exit(1);
}
}
-
}
+
#if defined (__SUPPORT_LD_DEBUG__)
if (_dl_debug_reloc && _dl_debug_detail && reloc_addr)
_dl_dprintf(_dl_debug_file, "\n\tpatched: %x ==> %x @ %p\n",
--
1.7.3.4
More information about the uClibc-cvs
mailing list