From owner-p4-projects@FreeBSD.ORG Sat Mar 17 12:33:12 2007 Return-Path: X-Original-To: p4-projects@freebsd.org Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 736E516A402; Sat, 17 Mar 2007 12:33:12 +0000 (UTC) X-Original-To: perforce@FreeBSD.org Delivered-To: perforce@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 4D83616A400 for ; Sat, 17 Mar 2007 12:33:12 +0000 (UTC) (envelope-from gonzo@FreeBSD.org) Received: from repoman.freebsd.org (repoman.freebsd.org [69.147.83.41]) by mx1.freebsd.org (Postfix) with ESMTP id 2585D13C48A for ; Sat, 17 Mar 2007 12:33:12 +0000 (UTC) (envelope-from gonzo@FreeBSD.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.13.8/8.13.8) with ESMTP id l2HCXCwS025020 for ; Sat, 17 Mar 2007 12:33:12 GMT (envelope-from gonzo@FreeBSD.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.13.8/8.13.8/Submit) id l2HCXBKM025015 for perforce@freebsd.org; Sat, 17 Mar 2007 12:33:11 GMT (envelope-from gonzo@FreeBSD.org) Date: Sat, 17 Mar 2007 12:33:11 GMT Message-Id: <200703171233.l2HCXBKM025015@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to gonzo@FreeBSD.org using -f From: Oleksandr Tymoshenko To: Perforce Change Reviews Cc: Subject: PERFORCE change 116022 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 17 Mar 2007 12:33:12 -0000 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