Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 6 Jan 2015 03:49:23 +0000 (UTC)
From:      Justin Hibbits <jhibbits@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r276733 - head/libexec/rtld-elf/powerpc
Message-ID:  <201501060349.t063nN5Y034135@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: jhibbits
Date: Tue Jan  6 03:49:22 2015
New Revision: 276733
URL: https://svnweb.freebsd.org/changeset/base/276733

Log:
  Apply r246556 to powerpc:
  
  Avoid use of register variables, which some compilers (e.g. clang)
  don't like. It makes the code a little clearer as well.
  
  This allows a clang 3.5 built powerpc world to run (tested in a jail).
  
  MFC after:	1 week

Modified:
  head/libexec/rtld-elf/powerpc/reloc.c

Modified: head/libexec/rtld-elf/powerpc/reloc.c
==============================================================================
--- head/libexec/rtld-elf/powerpc/reloc.c	Tue Jan  6 02:13:49 2015	(r276732)
+++ head/libexec/rtld-elf/powerpc/reloc.c	Tue Jan  6 03:49:22 2015	(r276733)
@@ -622,8 +622,7 @@ init_pltgot(Obj_Entry *obj)
 void
 allocate_initial_tls(Obj_Entry *list)
 {
-	register Elf_Addr **tp __asm__("r2");
-	Elf_Addr **_tp;
+	Elf_Addr **tp;
 
 	/*
 	* Fix the size of the static TLS block by using the maximum
@@ -633,22 +632,23 @@ allocate_initial_tls(Obj_Entry *list)
 
 	tls_static_space = tls_last_offset + tls_last_size + RTLD_STATIC_TLS_EXTRA;
 
-	_tp = (Elf_Addr **) ((char *) allocate_tls(list, NULL, TLS_TCB_SIZE, 8) 
+	tp = (Elf_Addr **) ((char *) allocate_tls(list, NULL, TLS_TCB_SIZE, 8) 
 	    + TLS_TP_OFFSET + TLS_TCB_SIZE);
 
 	/*
 	 * XXX gcc seems to ignore 'tp = _tp;' 
 	 */
 	 
-	__asm __volatile("mr %0,%1" : "=r"(tp) : "r"(_tp));
+	__asm __volatile("mr 2,%0" :: "r"(tp));
 }
 
 void*
 __tls_get_addr(tls_index* ti)
 {
-	register Elf_Addr **tp __asm__("r2");
+	register Elf_Addr **tp;
 	char *p;
 
+	__asm __volatile("mr %0,2" : "=r"(tp));
 	p = tls_get_addr_common((Elf_Addr**)((Elf_Addr)tp - TLS_TP_OFFSET 
 	    - TLS_TCB_SIZE), ti->ti_module, ti->ti_offset);
 



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