public inbox for glibc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Adhemerval Zanella <azanella@sourceware.org>
To: glibc-cvs@sourceware.org
Subject: [glibc] i386: Remove RELA support
Date: Thu,  4 Aug 2022 13:04:26 +0000 (GMT)	[thread overview]
Message-ID: <20220804130426.A19903865486@sourceware.org> (raw)

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=3698f5a9dd4b98b3d88f61fceae8b6bb39c7db2b

commit 3698f5a9dd4b98b3d88f61fceae8b6bb39c7db2b
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date:   Tue Jul 26 08:40:52 2022 -0300

    i386: Remove RELA support
    
    Now that prelink is not support, there is no need to keep supporting
    rela for non bootstrap.

Diff:
---
 sysdeps/i386/dl-machine-rel.h |   7 +-
 sysdeps/i386/dl-machine.h     | 191 ------------------------------------------
 2 files changed, 1 insertion(+), 197 deletions(-)

diff --git a/sysdeps/i386/dl-machine-rel.h b/sysdeps/i386/dl-machine-rel.h
index b98273aead..9dfaf718f2 100644
--- a/sysdeps/i386/dl-machine-rel.h
+++ b/sysdeps/i386/dl-machine-rel.h
@@ -19,13 +19,8 @@
 #ifndef _DL_MACHINE_REL_H
 #define _DL_MACHINE_REL_H
 
-/* The i386 never uses Elf32_Rela relocations for the dynamic linker.
-   Prelinked libraries may use Elf32_Rela though.  */
-#define ELF_MACHINE_NO_RELA defined RTLD_BOOTSTRAP
+#define ELF_MACHINE_NO_RELA 1
 #define ELF_MACHINE_NO_REL 0
-
-/* The i386 never uses Elf32_Rela relocations for the dynamic linker.
-   Prelinked libraries may use Elf32_Rela though.  */
 #define ELF_MACHINE_PLT_REL 1
 
 #define PLTREL ElfW(Rel)
diff --git a/sysdeps/i386/dl-machine.h b/sysdeps/i386/dl-machine.h
index 56a189fda2..64aad6e787 100644
--- a/sysdeps/i386/dl-machine.h
+++ b/sysdeps/i386/dl-machine.h
@@ -437,153 +437,6 @@ and creates an unsatisfiable circular dependency.\n",
     }
 }
 
-# ifndef RTLD_BOOTSTRAP
-static inline void
-__attribute__ ((always_inline))
-elf_machine_rela (struct link_map *map, struct r_scope_elem *scope[],
-		  const Elf32_Rela *reloc, const Elf32_Sym *sym,
-		  const struct r_found_version *version,
-		  void *const reloc_addr_arg, int skip_ifunc)
-{
-  Elf32_Addr *const reloc_addr = reloc_addr_arg;
-  const unsigned int r_type = ELF32_R_TYPE (reloc->r_info);
-
-  if (ELF32_R_TYPE (reloc->r_info) == R_386_RELATIVE)
-    *reloc_addr = map->l_addr + reloc->r_addend;
-  else if (r_type != R_386_NONE)
-    {
-      const Elf32_Sym *const refsym = sym;
-      struct link_map *sym_map = RESOLVE_MAP (map, scope, &sym, version,
-					      r_type);
-      Elf32_Addr value = SYMBOL_ADDRESS (sym_map, sym, true);
-
-      if (sym != NULL
-	  && __glibc_likely (sym->st_shndx != SHN_UNDEF)
-	  && __glibc_unlikely (ELFW(ST_TYPE) (sym->st_info) == STT_GNU_IFUNC)
-	  && __glibc_likely (!skip_ifunc))
-	value = ((Elf32_Addr (*) (void)) value) ();
-
-      switch (ELF32_R_TYPE (reloc->r_info))
-	{
-	case R_386_SIZE32:
-	  /* Set to symbol size plus addend.  */
-	  value = sym->st_size;
-	  /* Fall through.  */
-	case R_386_GLOB_DAT:
-	case R_386_JMP_SLOT:
-	case R_386_32:
-	  *reloc_addr = value + reloc->r_addend;
-	  break;
-	  /* Not needed for dl-conflict.c.  */
-	case R_386_PC32:
-	  *reloc_addr = (value + reloc->r_addend - (Elf32_Addr) reloc_addr);
-	  break;
-
-	case R_386_TLS_DTPMOD32:
-	  /* Get the information from the link map returned by the
-	     resolv function.  */
-	  if (sym_map != NULL)
-	    *reloc_addr = sym_map->l_tls_modid;
-	  break;
-	case R_386_TLS_DTPOFF32:
-	  /* During relocation all TLS symbols are defined and used.
-	     Therefore the offset is already correct.  */
-	  *reloc_addr = (sym == NULL ? 0 : sym->st_value) + reloc->r_addend;
-	  break;
-	case R_386_TLS_DESC:
-	  {
-	    struct tlsdesc volatile *td =
-	      (struct tlsdesc volatile *)reloc_addr;
-
-#  ifndef RTLD_BOOTSTRAP
-	    if (!sym)
-	      {
-		td->arg = (void*)reloc->r_addend;
-		td->entry = _dl_tlsdesc_undefweak;
-	      }
-	    else
-#  endif
-	      {
-#  ifndef RTLD_BOOTSTRAP
-#   ifndef SHARED
-		CHECK_STATIC_TLS (map, sym_map);
-#   else
-		if (!TRY_STATIC_TLS (map, sym_map))
-		  {
-		    td->arg = _dl_make_tlsdesc_dynamic
-		      (sym_map, sym->st_value + reloc->r_addend);
-		    td->entry = _dl_tlsdesc_dynamic;
-		  }
-		else
-#   endif
-#  endif
-		  {
-		    td->arg = (void*)(sym->st_value - sym_map->l_tls_offset
-				      + reloc->r_addend);
-		    td->entry = _dl_tlsdesc_return;
-		  }
-	      }
-	  }
-	  break;
-	case R_386_TLS_TPOFF32:
-	  /* The offset is positive, backward from the thread pointer.  */
-	  /* We know the offset of object the symbol is contained in.
-	     It is a positive value which will be subtracted from the
-	     thread pointer.  To get the variable position in the TLS
-	     block we subtract the offset from that of the TLS block.  */
-	  if (sym != NULL)
-	    {
-	      CHECK_STATIC_TLS (map, sym_map);
-	      *reloc_addr = sym_map->l_tls_offset - sym->st_value
-			    + reloc->r_addend;
-	    }
-	  break;
-	case R_386_TLS_TPOFF:
-	  /* The offset is negative, forward from the thread pointer.  */
-	  /* We know the offset of object the symbol is contained in.
-	     It is a negative value which will be added to the
-	     thread pointer.  */
-	  if (sym != NULL)
-	    {
-	      CHECK_STATIC_TLS (map, sym_map);
-	      *reloc_addr = sym->st_value - sym_map->l_tls_offset
-			    + reloc->r_addend;
-	    }
-	  break;
-	case R_386_COPY:
-	  if (sym == NULL)
-	    /* This can happen in trace mode if an object could not be
-	       found.  */
-	    break;
-	  if (__glibc_unlikely (sym->st_size > refsym->st_size)
-	      || (__glibc_unlikely (sym->st_size < refsym->st_size)
-		  && GLRO(dl_verbose)))
-	    {
-	      const char *strtab;
-
-	      strtab = (const char *) D_PTR (map, l_info[DT_STRTAB]);
-	      _dl_error_printf ("\
-%s: Symbol `%s' has different size in shared object, consider re-linking\n",
-				RTLD_PROGNAME, strtab + refsym->st_name);
-	    }
-	  memcpy (reloc_addr_arg, (void *) value,
-		  MIN (sym->st_size, refsym->st_size));
-	  break;
-	case R_386_IRELATIVE:
-	  value = map->l_addr + reloc->r_addend;
-	  if (__glibc_likely (!skip_ifunc))
-	    value = ((Elf32_Addr (*) (void)) value) ();
-	  *reloc_addr = value;
-	  break;
-	default:
-	  /* We add these checks in the version to relocate ld.so only
-	     if we are still debugging.  */
-	  _dl_reloc_bad_type (map, r_type, 0);
-	  break;
-	}
-    }
-}
-# endif	/* !RTLD_BOOTSTRAP */
 
 static inline void
 __attribute ((always_inline))
@@ -664,48 +517,4 @@ elf_machine_lazy_rel (struct link_map *map, struct r_scope_elem *scope[],
     _dl_reloc_bad_type (map, r_type, 1);
 }
 
-# ifndef RTLD_BOOTSTRAP
-
-static inline void
-__attribute__ ((always_inline))
-elf_machine_lazy_rela (struct link_map *map, struct r_scope_elem *scope[],
-		       Elf32_Addr l_addr, const Elf32_Rela *reloc,
-		       int skip_ifunc)
-{
-  Elf32_Addr *const reloc_addr = (void *) (l_addr + reloc->r_offset);
-  const unsigned int r_type = ELF32_R_TYPE (reloc->r_info);
-  if (__glibc_likely (r_type == R_386_JMP_SLOT))
-    ;
-  else if (__glibc_likely (r_type == R_386_TLS_DESC))
-    {
-      const Elf_Symndx symndx = ELFW (R_SYM) (reloc->r_info);
-      const ElfW (Sym) *symtab = (const void *)D_PTR (map, l_info[DT_SYMTAB]);
-      const ElfW (Sym) *sym = &symtab[symndx];
-      const struct r_found_version *version = NULL;
-
-      if (map->l_info[VERSYMIDX (DT_VERSYM)] != NULL)
-	{
-	  const ElfW (Half) *vernum =
-	    (const void *)D_PTR (map, l_info[VERSYMIDX (DT_VERSYM)]);
-	  version = &map->l_versions[vernum[symndx] & 0x7fff];
-	}
-
-      /* Always initialize TLS descriptors completely at load time, in
-	 case static TLS is allocated for it that requires locking.  */
-      elf_machine_rela (map, scope, reloc, sym, version, reloc_addr,
-			skip_ifunc);
-    }
-  else if (__glibc_unlikely (r_type == R_386_IRELATIVE))
-    {
-      Elf32_Addr value = map->l_addr + reloc->r_addend;
-      if (__glibc_likely (!skip_ifunc))
-	value = ((Elf32_Addr (*) (void)) value) ();
-      *reloc_addr = value;
-    }
-  else
-    _dl_reloc_bad_type (map, r_type, 1);
-}
-
-# endif	/* !RTLD_BOOTSTRAP */
-
 #endif /* RESOLVE_MAP */


                 reply	other threads:[~2022-08-04 13:04 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220804130426.A19903865486@sourceware.org \
    --to=azanella@sourceware.org \
    --cc=glibc-cvs@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).