Date: Sat, 17 Mar 2007 12:33:11 GMT From: Oleksandr Tymoshenko <gonzo@FreeBSD.org> To: Perforce Change Reviews <perforce@FreeBSD.org> Subject: PERFORCE change 116022 for review Message-ID: <200703171233.l2HCXBKM025015@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=116022 Change 116022 by gonzo@gonzo_jeeves on 2007/03/17 12:32:45 o Add handling for MIPS-specific tags in DYNAMIC section. Obtained from: NetBSD o Handle TLS just like ARM does Affected files ... .. //depot/projects/mips2/src/libexec/rtld-elf/rtld.c#2 edit Differences ... ==== //depot/projects/mips2/src/libexec/rtld-elf/rtld.c#2 (text+ko) ==== @@ -706,12 +706,19 @@ obj->fini = (Elf_Addr) (obj->relocbase + dynp->d_un.d_ptr); break; + /* + * Don't process DT_DEBUG on MIPS as the dynamic section + * is mapped read-only. DT_MIPS_RLD_MAP is used instead. + */ + +#ifndef __mips__ case DT_DEBUG: /* XXX - not implemented yet */ if (!early) dbg("Filling in DT_DEBUG entry"); ((Elf_Dyn*)dynp)->d_un.d_ptr = (Elf_Addr) &r_debug; break; +#endif case DT_FLAGS: if (dynp->d_un.d_val & DF_ORIGIN) { @@ -728,6 +735,25 @@ if (dynp->d_un.d_val & DF_STATIC_TLS) ; break; +#ifdef __mips__ + case DT_MIPS_LOCAL_GOTNO: + obj->local_gotno = dynp->d_un.d_val; + break; + + case DT_MIPS_SYMTABNO: + obj->symtabno = dynp->d_un.d_val; + break; + + case DT_MIPS_GOTSYM: + obj->gotsym = dynp->d_un.d_val; + break; + + case DT_MIPS_RLD_MAP: + if (!early) + dbg("Filling in DT_DEBUG entry"); + ((Elf_Dyn*)dynp)->d_un.d_ptr = (Elf_Addr) &r_debug; + break; +#endif default: if (!early) { @@ -1098,7 +1124,10 @@ objtmp.dynamic = rtld_dynamic(&objtmp); digest_dynamic(&objtmp, 1); assert(objtmp.needed == NULL); +#if !defined(__mips__) + /* MIPS and SH{3,5} have a bogus DT_TEXTREL. */ assert(!objtmp.textrel); +#endif /* * Temporarily put the dynamic linker entry into the object list, so @@ -2406,11 +2435,14 @@ continue; /* fallthrough */ case STT_TLS: - if (symp->st_shndx != SHN_UNDEF || - ((flags & SYMLOOK_IN_PLT) == 0 && - ELF_ST_TYPE(symp->st_info) == STT_FUNC)) + if (symp->st_shndx != SHN_UNDEF) + break; +#ifndef __mips__ + else if (((flags & SYMLOOK_IN_PLT) == 0) && + (ELF_ST_TYPE(symp->st_info) == STT_FUNC)) break; /* fallthrough */ +#endif default: continue; } @@ -2786,7 +2818,7 @@ #endif #if defined(__i386__) || defined(__amd64__) || defined(__sparc64__) || \ - defined(__arm__) + defined(__arm__) || defined(__mips__) /* * Allocate Static TLS using the Variant II method. @@ -2951,7 +2983,7 @@ free_tls_offset(Obj_Entry *obj) { #if defined(__i386__) || defined(__amd64__) || defined(__sparc64__) || \ - defined(__arm__) + defined(__arm__) || defined(__mips__) /* * If we were the last thing to allocate out of the static TLS * block, we give our space back to the 'allocator'. This is a
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200703171233.l2HCXBKM025015>