svn commit: r209876 - in head: lib/libc/gen sys/sys

Nathan Whitehorn nwhitehorn at FreeBSD.org
Sat Jul 10 14:39:09 UTC 2010


Author: nwhitehorn
Date: Sat Jul 10 14:39:08 2010
New Revision: 209876
URL: http://svn.freebsd.org/changeset/base/209876

Log:
  The 64-bit PowerPC ABI implemented in binutils 2.15 requires some special
  quirks for weak-symbol handling. Text symbols require also marking weak
  the special dot-symbol associated with the function, and data symbols
  require that you not do that. To fix this, provide a hacked
  __weak_reference for powerpc64, and define a new __weak_reference_data
  for the single weak data symbol in base.
  
  Revert after:	binutils 2.17 import
  Obtained from:	projects/ppc64

Modified:
  head/lib/libc/gen/_thread_init.c
  head/sys/sys/cdefs.h

Modified: head/lib/libc/gen/_thread_init.c
==============================================================================
--- head/lib/libc/gen/_thread_init.c	Sat Jul 10 14:34:37 2010	(r209875)
+++ head/lib/libc/gen/_thread_init.c	Sat Jul 10 14:39:08 2010	(r209876)
@@ -32,7 +32,8 @@ __FBSDID("$FreeBSD$");
 void _thread_init_stub(void);
 
 __weak_reference(_thread_init_stub, _thread_init);
-__weak_reference(_thread_autoinit_dummy_decl_stub, _thread_autoinit_dummy_decl);
+__weak_reference_data(_thread_autoinit_dummy_decl_stub,
+    _thread_autoinit_dummy_decl);
 
 int	_thread_autoinit_dummy_decl_stub = 0;
 

Modified: head/sys/sys/cdefs.h
==============================================================================
--- head/sys/sys/cdefs.h	Sat Jul 10 14:34:37 2010	(r209875)
+++ head/sys/sys/cdefs.h	Sat Jul 10 14:39:08 2010	(r209876)
@@ -356,8 +356,19 @@
 	extern __typeof (sym) aliassym __attribute__ ((__alias__ (#sym)))
 #endif
 #ifdef __STDC__
+#ifdef __powerpc64__
 #define	__weak_reference(sym,alias)	\
 	__asm__(".weak " #alias);	\
+	__asm__(".equ "  #alias ", " #sym); \
+	__asm__(".weak ." #alias);	\
+	__asm__(".equ ."  #alias ", ." #sym)
+#else
+#define	__weak_reference(sym,alias)	\
+	__asm__(".weak " #alias);	\
+	__asm__(".equ "  #alias ", " #sym)
+#endif
+#define	__weak_reference_data(sym,alias)\
+	__asm__(".weak " #alias);	\
 	__asm__(".equ "  #alias ", " #sym)
 #define	__warn_references(sym,msg)	\
 	__asm__(".section .gnu.warning." #sym);	\


More information about the svn-src-head mailing list