Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 14 Dec 2018 10:25:22 +0000 (UTC)
From:      Michal Meloun <mmel@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org
Subject:   svn commit: r342075 - stable/11/libexec/rtld-elf/aarch64
Message-ID:  <201812141025.wBEAPMwW062489@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: mmel
Date: Fri Dec 14 10:25:22 2018
New Revision: 342075
URL: https://svnweb.freebsd.org/changeset/base/342075

Log:
  MFC r341511,r341512,r341513:
  
    r341511:
      Fix style(9). Not a functional change.
    r341512:
      Implement arm64 version of __tls_get_addr().
    r341513:
      Tidy up arm64 reloc_jmpslots() implementation.
      - don't relocate jump slots multiple times (if LD_BIND_NOW is defined).
      - process only R_AARCH64_JUMP_SLOT here, other relocation types are
        handled by reloc_plt().

Modified:
  stable/11/libexec/rtld-elf/aarch64/reloc.c
  stable/11/libexec/rtld-elf/aarch64/rtld_start.S
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/libexec/rtld-elf/aarch64/reloc.c
==============================================================================
--- stable/11/libexec/rtld-elf/aarch64/reloc.c	Fri Dec 14 10:20:26 2018	(r342074)
+++ stable/11/libexec/rtld-elf/aarch64/reloc.c	Fri Dec 14 10:25:22 2018	(r342075)
@@ -109,9 +109,8 @@ do_copy_relocations(Obj_Entry *dstobj)
 			}
 		}
 		if (srcobj == NULL) {
-			_rtld_error(
-"Undefined symbol \"%s\" referenced from COPY relocation in %s",
-			    name, dstobj->path);
+			_rtld_error("Undefined symbol \"%s\" referenced from "
+			    "COPY relocation in %s", name, dstobj->path);
 			return (-1);
 		}
 
@@ -238,8 +237,10 @@ reloc_jmpslots(Obj_Entry *obj, int flags, RtldLockStat
 	const Elf_Rela *relalim;
 	const Elf_Rela *rela;
 	const Elf_Sym *def;
-	struct tls_data *tlsdesc;
 
+	if (obj->jmpslots_done)
+		return (0);
+
 	relalim = (const Elf_Rela *)((char *)obj->pltrela + obj->pltrelasize);
 	for (rela = obj->pltrela; rela < relalim; rela++) {
 		Elf_Addr *where;
@@ -256,20 +257,9 @@ reloc_jmpslots(Obj_Entry *obj, int flags, RtldLockStat
 
 			*where = (Elf_Addr)(defobj->relocbase + def->st_value);
 			break;
-		case R_AARCH64_TLSDESC:
-			if (ELF_R_SYM(rela->r_info) != 0) {
-				tlsdesc = (struct tls_data *)where[1];
-				if (tlsdesc->index == -1)
-					rtld_tlsdesc_handle_locked(tlsdesc,
-					    SYMLOOK_IN_PLT | flags, lockstate);
-			}
-			break;
-		default:
-			_rtld_error("Unknown relocation type %x in jmpslot",
-			    (unsigned int)ELF_R_TYPE(rela->r_info));
-			return (-1);
 		}
 	}
+	obj->jmpslots_done = true;
 
 	return (0);
 }
@@ -431,4 +421,16 @@ allocate_initial_tls(Obj_Entry *objs)
 	tp = (Elf_Addr **) allocate_tls(objs, NULL, TLS_TCB_SIZE, 16);
 
 	asm volatile("msr	tpidr_el0, %0" : : "r"(tp));
+}
+
+void *
+__tls_get_addr(tls_index* ti)
+{
+      char *p;
+      void *_tp;
+
+      __asm __volatile("mrs	%0, tpidr_el0"  : "=r" (_tp));
+      p = tls_get_addr_common((Elf_Addr **)(_tp), ti->ti_module, ti->ti_offset);
+
+      return (p);
 }

Modified: stable/11/libexec/rtld-elf/aarch64/rtld_start.S
==============================================================================
--- stable/11/libexec/rtld-elf/aarch64/rtld_start.S	Fri Dec 14 10:20:26 2018	(r342074)
+++ stable/11/libexec/rtld-elf/aarch64/rtld_start.S	Fri Dec 14 10:25:22 2018	(r342075)
@@ -57,7 +57,7 @@ END(.rtld_start)
 ENTRY(_rtld_bind_start)
 	.cfi_startproc
 	mov	x17, sp
-	
+
 	/* Save frame pointer and SP */
 	stp	x29, x30, [sp, #-16]!
 	mov	x29, sp



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201812141025.wBEAPMwW062489>