aboutsummaryrefslogtreecommitdiff
path: root/sysdeps/sparc/sparc64/dl-machine.h
diff options
context:
space:
mode:
authorAdhemerval Zanella <adhemerval.zanella@linaro.org>2022-01-13 17:58:00 -0300
committerAdhemerval Zanella <adhemerval.zanella@linaro.org>2022-02-10 09:16:12 -0300
commit6628c742b2c16e785d3c884d9deeda5adb30ca12 (patch)
tree493580e40aef171896584e1d3d32bbe14c15140b /sysdeps/sparc/sparc64/dl-machine.h
parent8c8510ab2790039e58995ef3a22309582413d3ff (diff)
downloadglibc-6628c742b2c16e785d3c884d9deeda5adb30ca12.tar
glibc-6628c742b2c16e785d3c884d9deeda5adb30ca12.tar.gz
glibc-6628c742b2c16e785d3c884d9deeda5adb30ca12.tar.bz2
glibc-6628c742b2c16e785d3c884d9deeda5adb30ca12.zip
elf: Remove prelink support
Prelinked binaries and libraries still work, the dynamic tags DT_GNU_PRELINKED, DT_GNU_LIBLIST, DT_GNU_CONFLICT just ignored (meaning the process is reallocated as default). The loader environment variable TRACE_PRELINKING is also removed, since it used solely on prelink. Checked on x86_64-linux-gnu, i686-linux-gnu, and aarch64-linux-gnu. Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
Diffstat (limited to 'sysdeps/sparc/sparc64/dl-machine.h')
-rw-r--r--sysdeps/sparc/sparc64/dl-machine.h72
1 files changed, 3 insertions, 69 deletions
diff --git a/sysdeps/sparc/sparc64/dl-machine.h b/sysdeps/sparc/sparc64/dl-machine.h
index b6b36db240..dc24dbc305 100644
--- a/sysdeps/sparc/sparc64/dl-machine.h
+++ b/sysdeps/sparc/sparc64/dl-machine.h
@@ -196,50 +196,6 @@ elf_machine_runtime_setup (struct link_map *l, struct r_scope_elem *scope[],
/* Now put the magic cookie at the beginning of .PLT2
Entry .PLT3 is unused by this implementation. */
*((struct link_map **)(&plt[16])) = l;
-
- if (__builtin_expect (l->l_info[VALIDX(DT_GNU_PRELINKED)] != NULL, 0)
- || __builtin_expect (l->l_info [VALIDX (DT_GNU_LIBLISTSZ)] != NULL, 0))
- {
- /* Need to reinitialize .plt to undo prelinking. */
- Elf64_Rela *rela = (Elf64_Rela *) D_PTR (l, l_info[DT_JMPREL]);
- Elf64_Rela *relaend
- = (Elf64_Rela *) ((char *) rela
- + l->l_info[DT_PLTRELSZ]->d_un.d_val);
-
- /* prelink must ensure there are no R_SPARC_NONE relocs left
- in .rela.plt. */
- while (rela < relaend)
- {
- if (__builtin_expect (rela->r_addend, 0) != 0)
- {
- Elf64_Addr slot = ((rela->r_offset + l->l_addr + 0x400
- - (Elf64_Addr) plt)
- / 0x1400) * 0x1400
- + (Elf64_Addr) plt - 0x400;
- /* ldx [%o7 + X], %g1 */
- unsigned int first_ldx = *(unsigned int *)(slot + 12);
- Elf64_Addr ptr = slot + (first_ldx & 0xfff) + 4;
-
- *(Elf64_Addr *) (rela->r_offset + l->l_addr)
- = (Elf64_Addr) plt
- - (slot + ((rela->r_offset + l->l_addr - ptr) / 8) * 24
- + 4);
- ++rela;
- continue;
- }
-
- *(unsigned int *) (rela->r_offset + l->l_addr)
- = 0x03000000 | (rela->r_offset + l->l_addr - (Elf64_Addr) plt);
- *(unsigned int *) (rela->r_offset + l->l_addr + 4)
- = 0x30680000 | ((((Elf64_Addr) plt + 32 - rela->r_offset
- - l->l_addr - 4) >> 2) & 0x7ffff);
- __asm __volatile ("flush %0" : : "r" (rela->r_offset
- + l->l_addr));
- __asm __volatile ("flush %0+4" : : "r" (rela->r_offset
- + l->l_addr));
- ++rela;
- }
- }
}
return lazy;
@@ -361,14 +317,12 @@ elf_machine_rela (struct link_map *map, struct r_scope_elem *scope[],
void *const reloc_addr_arg, int skip_ifunc)
{
Elf64_Addr *const reloc_addr = reloc_addr_arg;
-#if !defined RTLD_BOOTSTRAP && !defined RESOLVE_CONFLICT_FIND_MAP
+#if !defined RTLD_BOOTSTRAP
const Elf64_Sym *const refsym = sym;
#endif
Elf64_Addr value;
const unsigned long int r_type = ELF64_R_TYPE_ID (reloc->r_info);
-#if !defined RESOLVE_CONFLICT_FIND_MAP
struct link_map *sym_map = NULL;
-#endif
#if !defined RTLD_BOOTSTRAP && !defined HAVE_Z_COMBRELOC
/* This is defined in rtld.c, but nowhere in the static libc.a; make the
@@ -399,7 +353,6 @@ elf_machine_rela (struct link_map *map, struct r_scope_elem *scope[],
}
#endif
-#ifndef RESOLVE_CONFLICT_FIND_MAP
if (__builtin_expect (ELF64_ST_BIND (sym->st_info) == STB_LOCAL, 0)
&& sym->st_shndx != SHN_UNDEF)
{
@@ -411,9 +364,6 @@ elf_machine_rela (struct link_map *map, struct r_scope_elem *scope[],
sym_map = RESOLVE_MAP (map, scope, &sym, version, r_type);
value = SYMBOL_ADDRESS (sym_map, sym, true);
}
-#else
- value = 0;
-#endif
value += reloc->r_addend; /* Assume copy relocs have zero addend. */
@@ -425,7 +375,7 @@ elf_machine_rela (struct link_map *map, struct r_scope_elem *scope[],
switch (r_type)
{
-#if !defined RTLD_BOOTSTRAP && !defined RESOLVE_CONFLICT_FIND_MAP
+#if !defined RTLD_BOOTSTRAP
case R_SPARC_COPY:
if (sym == NULL)
/* This can happen in trace mode if an object could not be
@@ -459,26 +409,11 @@ elf_machine_rela (struct link_map *map, struct r_scope_elem *scope[],
value = ((Elf64_Addr (*) (int)) value) (GLRO(dl_hwcap));
/* 'high' is always zero, for large PLT entries the linker
emits an R_SPARC_IRELATIVE. */
-#ifdef RESOLVE_CONFLICT_FIND_MAP
- sparc64_fixup_plt (NULL, reloc, reloc_addr, value, 0, 0);
-#else
sparc64_fixup_plt (map, reloc, reloc_addr, value, 0, 0);
-#endif
break;
case R_SPARC_JMP_SLOT:
-#ifdef RESOLVE_CONFLICT_FIND_MAP
- /* R_SPARC_JMP_SLOT conflicts against .plt[32768+]
- relocs should be turned into R_SPARC_64 relocs
- in .gnu.conflict section.
- r_addend non-zero does not mean it is a .plt[32768+]
- reloc, instead it is the actual address of the function
- to call. */
- sparc64_fixup_plt (NULL, reloc, reloc_addr, value, 0, 0);
-#else
sparc64_fixup_plt (map, reloc, reloc_addr, value, reloc->r_addend, 0);
-#endif
break;
-#ifndef RESOLVE_CONFLICT_FIND_MAP
case R_SPARC_TLS_DTPMOD64:
/* Get the information from the link map returned by the
resolv function. */
@@ -502,7 +437,7 @@ elf_machine_rela (struct link_map *map, struct r_scope_elem *scope[],
+ reloc->r_addend;
}
break;
-# ifndef RTLD_BOOTSTRAP
+#ifndef RTLD_BOOTSTRAP
case R_SPARC_TLS_LE_HIX22:
case R_SPARC_TLS_LE_LOX10:
if (sym != NULL)
@@ -520,7 +455,6 @@ elf_machine_rela (struct link_map *map, struct r_scope_elem *scope[],
| 0x1c00);
}
break;
-# endif
#endif
#ifndef RTLD_BOOTSTRAP
case R_SPARC_8: