git: 292cba9b4919 - main - rtld: remove mips-specific cases from generic code

From: Konstantin Belousov <kib_at_FreeBSD.org>
Date: Thu, 06 Jan 2022 06:46:20 UTC
The branch main has been updated by kib:

URL: https://cgit.FreeBSD.org/src/commit/?id=292cba9b4919ee188ca08cc8bf5057e346514383

commit 292cba9b4919ee188ca08cc8bf5057e346514383
Author:     Konstantin Belousov <kib@FreeBSD.org>
AuthorDate: 2022-01-06 00:43:51 +0000
Commit:     Konstantin Belousov <kib@FreeBSD.org>
CommitDate: 2022-01-06 04:00:39 +0000

    rtld: remove mips-specific cases from generic code
    
    Reviewed by:    imp
    Sponsored by:   The FreeBSD Foundation
    Differential revision:  https://reviews.freebsd.org/D33763
---
 libexec/rtld-elf/rtld.c | 47 -----------------------------------------------
 libexec/rtld-elf/rtld.h |  6 ------
 2 files changed, 53 deletions(-)

diff --git a/libexec/rtld-elf/rtld.c b/libexec/rtld-elf/rtld.c
index fa0e61fe0c5c..14c4d44f50e4 100644
--- a/libexec/rtld-elf/rtld.c
+++ b/libexec/rtld-elf/rtld.c
@@ -1002,10 +1002,6 @@ rtld_resolve_ifunc(const Obj_Entry *obj, const Elf_Sym *def)
 	return ((void *)target);
 }
 
-/*
- * NB: MIPS uses a private version of this function (_mips_rtld_bind).
- * Changes to this function should be applied there as well.
- */
 Elf_Addr
 _rtld_bind(Obj_Entry *obj, Elf_Size reloff)
 {
@@ -1465,19 +1461,6 @@ digest_dynamic1(Obj_Entry *obj, int early, const Elf_Dyn **dyn_rpath,
 	    obj->fini_array_num = dynp->d_un.d_val / sizeof(Elf_Addr);
 	    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:
-	    if (!early)
-		dbg("Filling in DT_DEBUG entry");
-	    (__DECONST(Elf_Dyn *, dynp))->d_un.d_ptr = (Elf_Addr)&r_debug;
-	    break;
-#endif
-
 	case DT_FLAGS:
 		if (dynp->d_un.d_val & DF_ORIGIN)
 		    obj->z_origin = true;
@@ -1490,36 +1473,6 @@ digest_dynamic1(Obj_Entry *obj, int early, const Elf_Dyn **dyn_rpath,
 		if (dynp->d_un.d_val & DF_STATIC_TLS)
 		    obj->static_tls = true;
 	    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:
-		*((Elf_Addr *)(dynp->d_un.d_ptr)) = (Elf_Addr) &r_debug;
-		break;
-
-	case DT_MIPS_RLD_MAP_REL:
-		// The MIPS_RLD_MAP_REL tag stores the offset to the .rld_map
-		// section relative to the address of the tag itself.
-		*((Elf_Addr *)(__DECONST(char*, dynp) + dynp->d_un.d_val)) =
-		    (Elf_Addr) &r_debug;
-		break;
-
-	case DT_MIPS_PLTGOT:
-		obj->mips_pltgot = (Elf_Addr *)(obj->relocbase +
-		    dynp->d_un.d_ptr);
-		break;
-		
-#endif
 
 #ifdef __powerpc__
 #ifdef __powerpc64__
diff --git a/libexec/rtld-elf/rtld.h b/libexec/rtld-elf/rtld.h
index 0dab41c9b7d6..cbdbd29f2aa9 100644
--- a/libexec/rtld-elf/rtld.h
+++ b/libexec/rtld-elf/rtld.h
@@ -183,12 +183,6 @@ typedef struct Struct_Obj_Entry {
     const Elf_Sym *symtab;	/* Symbol table */
     const char *strtab;		/* String table */
     unsigned long strsize;	/* Size in bytes of string table */
-#ifdef __mips__
-    Elf_Word local_gotno;	/* Number of local GOT entries */
-    Elf_Word symtabno;		/* Number of dynamic symbols */
-    Elf_Word gotsym;		/* First dynamic symbol in GOT */
-    Elf_Addr *mips_pltgot;	/* Second PLT GOT */
-#endif
 #ifdef __powerpc__
 #ifdef __powerpc64__
     Elf_Addr glink;		/* GLINK PLT call stub section */