summaryrefslogtreecommitdiff
path: root/ldso/ldso/ldso.c
diff options
context:
space:
mode:
authorDavid Schleef <ds@schleef.org>2001-11-12 03:06:38 +0000
committerDavid Schleef <ds@schleef.org>2001-11-12 03:06:38 +0000
commit46db40b0da939fb891d2f599e43d68b6ee4a3f8d (patch)
tree253b23838cb6142a83af0b57d1ac75d79e46c686 /ldso/ldso/ldso.c
parentd94663ec0e6009bc9b541e064c5bae1d5b788a98 (diff)
powerpc/elfinterp.c: Powerpc works now. Major rework; most relocs
should work now. R_PPC_JMP_SLOT correctly being lazily relocated. hash.h: Added a field in elf_resolve to store a ppc-specific address. boot1.c: Added debugging code. Disabled check that fails on powerpc because the string literal requires a reloc that isn't performed. Added check to ignore d_tag if it is out of bounds, as has been observed with powerpc binaries.
Diffstat (limited to 'ldso/ldso/ldso.c')
-rw-r--r--ldso/ldso/ldso.c35
1 files changed, 30 insertions, 5 deletions
diff --git a/ldso/ldso/ldso.c b/ldso/ldso/ldso.c
index 43c89adbc..e61276cce 100644
--- a/ldso/ldso/ldso.c
+++ b/ldso/ldso/ldso.c
@@ -149,6 +149,25 @@ char *_dl_get_last_path_component(char *path);
auxv_t[0...N] Auxiliary Vector Table elements (mixed types)
*/
+#ifdef DL_DEBUG
+/* Debugging is especially tricky on PowerPC, since string literals
+ * require relocations. Thus, you can't use _dl_dprintf() for
+ * anything until the bootstrap relocations are finished. */
+static inline void hexprint(unsigned long x)
+{
+ int i;
+ char c;
+ for(i=0;i<8;i++){
+ c=((x>>28)+'0');
+ if(c>'9')c+='a'-'9'-1;
+ _dl_write(1,&c,1);
+ x<<=4;
+ }
+ c='\n';
+ _dl_write(1,&c,1);
+}
+#endif
+
DL_BOOT(unsigned long args)
{
unsigned int argc;
@@ -220,8 +239,11 @@ DL_BOOT(unsigned long args)
/* Check the ELF header to make sure everything looks ok. */
if (! header || header->e_ident[EI_CLASS] != ELFCLASS32 ||
- header->e_ident[EI_VERSION] != EV_CURRENT ||
- _dl_strncmp((void *)header, ELFMAGIC, SELFMAG) != 0)
+ header->e_ident[EI_VERSION] != EV_CURRENT
+#ifndef __powerpc__
+ || _dl_strncmp((void *)header, ELFMAGIC, SELFMAG) != 0
+#endif
+ )
{
SEND_STDERR("Invalid ELF header\n");
_dl_exit(0);
@@ -328,9 +350,12 @@ found_got:
We are only doing ourself right now - we will have to do the rest later */
while (dpnt->d_tag) {
- tpnt->dynamic_info[dpnt->d_tag] = dpnt->d_un.d_val;
- if (dpnt->d_tag == DT_TEXTREL || SVR4_BUGCOMPAT)
- tpnt->dynamic_info[DT_TEXTREL] = 1;
+ if(dpnt->d_tag<24) {
+ tpnt->dynamic_info[dpnt->d_tag] = dpnt->d_un.d_val;
+ if (dpnt->d_tag == DT_TEXTREL || SVR4_BUGCOMPAT) {
+ tpnt->dynamic_info[DT_TEXTREL] = 1;
+ }
+ }
dpnt++;
}