Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 13 Feb 2019 18:28:54 +0000 (UTC)
From:      Leandro Lupori <luporl@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r344109 - head/lib/libthr/arch/powerpc/include
Message-ID:  <201902131828.x1DISsMk061054@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: luporl
Date: Wed Feb 13 18:28:53 2019
New Revision: 344109
URL: https://svnweb.freebsd.org/changeset/base/344109

Log:
  silence cast-align warnings from clang on powerpc64
  
  silence the following warning when compiling libthr with clang 8
  for powerpc64 architecture:
  
  usr/src/lib/libthr/arch/powerpc/include/pthread_md.h:82:10: error:
  cast from 'uint8_t *' (aka 'unsigned char *') to 'struct tcb *'
  increases required alignment from 1 to 8 [-Werror,-Wcast-align]
  82:  return ((struct tcb *)(_tp - TP_OFFSET));
  
  Submitted by:	alfredo.junior_eldorado.org.br
  Reviewed by:	git_bdragon.rtk0.net, emaste, kib, jhibbits, luporl
  Differential Revision:	https://reviews.freebsd.org/D18807

Modified:
  head/lib/libthr/arch/powerpc/include/pthread_md.h

Modified: head/lib/libthr/arch/powerpc/include/pthread_md.h
==============================================================================
--- head/lib/libthr/arch/powerpc/include/pthread_md.h	Wed Feb 13 17:50:01 2019	(r344108)
+++ head/lib/libthr/arch/powerpc/include/pthread_md.h	Wed Feb 13 18:28:53 2019	(r344109)
@@ -72,14 +72,15 @@ _tcb_set(struct tcb *tcb)
 static __inline struct tcb *
 _tcb_get(void)
 {
-	register uint8_t *_tp;
+        register struct tcb *tcb;
+
 #ifdef __powerpc64__
-	__asm __volatile("mr %0,13" : "=r"(_tp));
+	__asm __volatile("addi %0,13,%1" : "=r"(tcb) : "i"(-TP_OFFSET));
 #else
-	__asm __volatile("mr %0,2" : "=r"(_tp));
+	__asm __volatile("addi %0,2,%1" : "=r"(tcb) : "i"(-TP_OFFSET));
 #endif
 
-	return ((struct tcb *)(_tp - TP_OFFSET));
+	return (tcb);
 }
 
 static __inline struct pthread *



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