Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 21 Jan 2012 09:10:04 +0100
From:      Andreas Tobler <andreast@fgznet.ch>
To:        Bruce Evans <brde@optusnet.com.au>
Cc:        svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org, Andreas Tobler <andreast@FreeBSD.org>
Subject:   Re: svn commit: r229693 - in head/lib/libc: powerpc powerpc64
Message-ID:  <4F1A72DC.7020107@fgznet.ch>
In-Reply-To: <20120106225728.G9027@besplex.bde.org>
References:  <201201060921.q069Lfi8081051@svn.freebsd.org> <20120106225728.G9027@besplex.bde.org>

next in thread | previous in thread | raw e-mail | index | archive | help
This is a multi-part message in MIME format.
--------------020307030102060007060008
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

I write this reply from another machine...

Here is what I have tested so far.

Is this the right approach?

Thank you in advance,
Andreas





--------------020307030102060007060008
Content-Type: text/plain;
 name="weak_ref.diff"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
 filename="weak_ref.diff"

Index: lib/libc/powerpc/SYS.h
===================================================================
--- lib/libc/powerpc/SYS.h	(revision 230383)
+++ lib/libc/powerpc/SYS.h	(working copy)
@@ -33,38 +33,38 @@
 #include <sys/syscall.h>
 #include <machine/asm.h>
 
-#define _SYSCALL(x)						\
-	.text;							\
-	.align 2;						\
-	li	0,(__CONCAT(SYS_,x));				\
+#define _SYSCALL(name)							\
+	.text;								\
+	.align 2;							\
+	li	0,(__CONCAT(SYS_, name));				\
 	sc
 
-#define	SYSCALL(x)						\
-	.text;							\
-	.align 2;						\
-2:	b	PIC_PLT(CNAME(HIDENAME(cerror)));		\
-ENTRY(__CONCAT(__sys_,x));					\
-	WEAK_ALIAS(x,__CONCAT(__sys_,x));			\
-	WEAK_ALIAS(__CONCAT(_,x),__CONCAT(__sys_,x));		\
-	_SYSCALL(x);						\
+#define	SYSCALL(name)							\
+	.text;								\
+	.align 2;							\
+2:	b	PIC_PLT(CNAME(HIDENAME(cerror)));			\
+ENTRY(__CONCAT(__sys_, name));						\
+	WEAK_REFERENCE(__CONCAT(__sys_, name), name);			\
+	WEAK_REFERENCE(__CONCAT(__sys_, name), __CONCAT(_, name));	\
+	_SYSCALL(name);							\
 	bso	2b
 
-#define	PSEUDO(x)						\
-	.text;							\
-	.align 2;						\
-ENTRY(__CONCAT(__sys_,x));					\
-	WEAK_ALIAS(__CONCAT(_,x),__CONCAT(__sys_,x));		\
-	_SYSCALL(x);						\
-	bnslr;							\
+#define	PSEUDO(name)							\
+	.text;								\
+	.align 2;							\
+ENTRY(__CONCAT(__sys_, name));						\
+	WEAK_REFERENCE(__CONCAT(__sys_, name), __CONCAT(_, name));	\
+	_SYSCALL(name);							\
+	bnslr;								\
 	b	PIC_PLT(CNAME(HIDENAME(cerror)))
 
-#define	RSYSCALL(x)						\
-	.text;							\
-	.align 2;						\
-2:	b	PIC_PLT(CNAME(HIDENAME(cerror)));		\
-ENTRY(__CONCAT(__sys_,x));					\
-	WEAK_ALIAS(x,__CONCAT(__sys_,x));			\
-	WEAK_ALIAS(__CONCAT(_,x), __CONCAT(__sys_,x));		\
-	_SYSCALL(x);						\
-	bnslr;							\
+#define	RSYSCALL(name)							\
+	.text;								\
+	.align 2;							\
+2:	b	PIC_PLT(CNAME(HIDENAME(cerror)));			\
+ENTRY(__CONCAT(__sys_, name));						\
+	WEAK_REFERENCE(__CONCAT(__sys_, name), name);			\
+	WEAK_REFERENCE(__CONCAT(__sys_, name), __CONCAT(_, name));	\
+	_SYSCALL(name);							\
+	bnslr;								\
 	b	PIC_PLT(CNAME(HIDENAME(cerror)))
Index: lib/libc/powerpc/gen/setjmp.S
===================================================================
--- lib/libc/powerpc/gen/setjmp.S	(revision 230383)
+++ lib/libc/powerpc/gen/setjmp.S	(working copy)
@@ -69,7 +69,7 @@
 	li	%r3,0			/* return (0) */
 	blr
 
-	WEAK_ALIAS(longjmp, __longjmp)
+	WEAK_REFERENCE(CNAME(__longjmp), longjmp)
 ENTRY(__longjmp)
 	lmw	%r9,20(%r3)		/* restore regs */
 	mr	%r6,%r4			/* save val param */
Index: lib/libc/powerpc64/SYS.h
===================================================================
--- lib/libc/powerpc64/SYS.h	(revision 230383)
+++ lib/libc/powerpc64/SYS.h	(working copy)
@@ -33,62 +33,62 @@
 #include <sys/syscall.h>
 #include <machine/asm.h>
 
-#define _SYSCALL(x)						\
-	.text;							\
-	.align 2;						\
-	li	0,(__CONCAT(SYS_,x));				\
+#define _SYSCALL(name)							\
+	.text;								\
+	.align 2;							\
+	li	0,(__CONCAT(SYS_, name));				\
 	sc
 
-#define	SYSCALL(x)						\
-	.text;							\
-	.align 2;						\
-2:	mflr	%r0;						\
-	std	%r0,16(%r1);					\
-	stdu	%r1,-48(%r1);					\
-	bl	CNAME(HIDENAME(cerror));			\
-	nop;							\
-	addi	%r1,%r1,48;					\
-	ld	%r0,16(%r1);					\
-	mtlr	%r0;						\
-	blr;							\
-ENTRY(__CONCAT(__sys_,x));					\
-	WEAK_ALIAS(x,__CONCAT(__sys_,x));			\
-	WEAK_ALIAS(__CONCAT(_,x),__CONCAT(__sys_,x));		\
-	_SYSCALL(x);						\
+#define	SYSCALL(name)							\
+	.text;								\
+	.align 2;							\
+2:	mflr	%r0;							\
+	std	%r0,16(%r1);						\
+	stdu	%r1,-48(%r1);						\
+	bl	CNAME(HIDENAME(cerror));				\
+	nop;								\
+	addi	%r1,%r1,48;						\
+	ld	%r0,16(%r1);						\
+	mtlr	%r0;							\
+	blr;								\
+ENTRY(__CONCAT(__sys_, name));						\
+	WEAK_REFERENCE(__CONCAT(__sys_, name), name);			\
+	WEAK_REFERENCE(__CONCAT(__sys_, name), __CONCAT(_, name)); 	\
+	_SYSCALL(name);							\
 	bso	2b
 
-#define	PSEUDO(x)						\
-	.text;							\
-	.align 2;						\
-ENTRY(__CONCAT(__sys_,x));					\
-	WEAK_ALIAS(__CONCAT(_,x),__CONCAT(__sys_,x));		\
-	_SYSCALL(x);						\
-	bnslr;							\
-	mflr	%r0;						\
-	std	%r0,16(%r1);					\
-	stdu	%r1,-48(%r1);					\
-	bl	CNAME(HIDENAME(cerror));			\
-	nop;							\
-	addi	%r1,%r1,48;					\
-	ld	%r0,16(%r1);					\
-	mtlr	%r0;						\
+#define	PSEUDO(name)							\
+	.text;								\
+	.align 2;							\
+ENTRY(__CONCAT(__sys_, name));						\
+	WEAK_REFERENCE(__CONCAT(__sys_, name), __CONCAT(_, name));   	\
+	_SYSCALL(name);							\
+	bnslr;								\
+	mflr	%r0;							\
+	std	%r0,16(%r1);						\
+	stdu	%r1,-48(%r1);						\
+	bl	CNAME(HIDENAME(cerror));				\
+	nop;								\
+	addi	%r1,%r1,48;						\
+	ld	%r0,16(%r1);						\
+	mtlr	%r0;							\
 	blr;
 
-#define	RSYSCALL(x)						\
-	.text;							\
-	.align 2;						\
-ENTRY(__CONCAT(__sys_,x));					\
-	WEAK_ALIAS(x,__CONCAT(__sys_,x));			\
-	WEAK_ALIAS(__CONCAT(_,x), __CONCAT(__sys_,x));		\
-	_SYSCALL(x);						\
-	bnslr;							\
-								\
-	mflr	%r0;						\
-	std	%r0,16(%r1);					\
-	stdu	%r1,-48(%r1);					\
-	bl	CNAME(HIDENAME(cerror));			\
-	nop;							\
-	addi	%r1,%r1,48;					\
-	ld	%r0,16(%r1);					\
-	mtlr	%r0;						\
+#define	RSYSCALL(name)							\
+	.text;								\
+	.align 2;							\
+ENTRY(__CONCAT(__sys_, name));						\
+	WEAK_REFERENCE(__CONCAT(__sys_, name), name);		       	\
+	WEAK_REFERENCE(__CONCAT(__sys_, name), __CONCAT(_, name));	\
+	_SYSCALL(name);							\
+	bnslr;								\
+									\
+	mflr	%r0;							\
+	std	%r0,16(%r1);						\
+	stdu	%r1,-48(%r1);						\
+	bl	CNAME(HIDENAME(cerror));				\
+	nop;								\
+	addi	%r1,%r1,48;						\
+	ld	%r0,16(%r1);						\
+	mtlr	%r0;							\
 	blr;
Index: lib/libc/powerpc64/gen/setjmp.S
===================================================================
--- lib/libc/powerpc64/gen/setjmp.S	(revision 230396)
+++ lib/libc/powerpc64/gen/setjmp.S	(working copy)
@@ -93,7 +93,7 @@
 	li	%r3,0			/* return (0) */
 	blr
 
-	WEAK_ALIAS(longjmp, __longjmp)
+	WEAK_REFERENCE(__longjmp, longjmp)
 ENTRY(__longjmp)
 	ld	%r9,40 + 0*8(%r3)
 	ld	%r10,40 + 1*8(%r3)
Index: sys/powerpc/include/asm.h
===================================================================
--- sys/powerpc/include/asm.h	(revision 230401)
+++ sys/powerpc/include/asm.h	(working copy)
@@ -116,9 +116,9 @@
 #define __FBSDID(s)	/* nothing */
 #endif /* not lint and not STRIP_FBSDID */
 
-#define	WEAK_ALIAS(alias,sym)					\
+#define WEAK_REFERENCE(sym, alias)				\
 	.weak alias;						\
-	alias = sym
+	.equ alias, sym
 
 #ifdef __STDC__
 #define	WARN_REFERENCES(_sym,_msg)				\

--------------020307030102060007060008--



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