Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 10 Jul 2010 14:39:09 +0000 (UTC)
From:      Nathan Whitehorn <nwhitehorn@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r209876 - in head: lib/libc/gen sys/sys
Message-ID:  <201007101439.o6AEd9Qg082505@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
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);	\



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