A few of our platforms don't provide a WEAK_ALIAS macro in <machine/asm.h> That's annoying for those of us who aren't ASM polyglots, so here's a diff to add WEAK_ALIAS to hppa, hppa64, mips64, and powerpc, based on how their libc SYS.h files handled them. The diff also converts said SYS.h files to use WEAK_ALIAS to guarantee that the new macro is exercised.
I don't actually have any of these platforms, so this is completely untested. (This is prep for moving renaming rfork_thread() to _rfork_thread() with a weak alias and moving it to libc.) Philip Guenther Index: sys/arch/hppa/include/asm.h =================================================================== RCS file: /cvs/src/sys/arch/hppa/include/asm.h,v retrieving revision 1.15 diff -u -p -r1.15 asm.h --- sys/arch/hppa/include/asm.h 23 Jan 2005 16:28:29 -0000 1.15 +++ sys/arch/hppa/include/asm.h 5 Sep 2010 22:13:53 -0000 @@ -251,4 +251,6 @@ tf4 .reg %fr8 #define BSS(n,s) ! .data ! .label n ! .comm s +#define WEAK_ALIAS(alias,sym) ! .weak alias ! .set alias, sym + #endif /* _MACHINE_ASM_H_ */ Index: sys/arch/hppa64/include/asm.h =================================================================== RCS file: /cvs/src/sys/arch/hppa64/include/asm.h,v retrieving revision 1.1 diff -u -p -r1.1 asm.h --- sys/arch/hppa64/include/asm.h 1 Apr 2005 10:40:48 -0000 1.1 +++ sys/arch/hppa64/include/asm.h 5 Sep 2010 22:13:53 -0000 @@ -67,4 +67,6 @@ ap .reg %r29 #define BSS(n,s) ! .data ! .label n ! .comm s +#define WEAK_ALIAS(alias,sym) ! .weak alias ! .set alias, sym + #endif /* _MACHINE_ASM_H_ */ Index: sys/arch/mips64/include/asm.h =================================================================== RCS file: /cvs/src/sys/arch/mips64/include/asm.h,v retrieving revision 1.11 diff -u -p -r1.11 asm.h --- sys/arch/mips64/include/asm.h 28 Apr 2010 16:20:28 -0000 1.11 +++ sys/arch/mips64/include/asm.h 5 Sep 2010 22:13:53 -0000 @@ -270,6 +270,13 @@ x: ; \ .end x /* + * WEAK ALIAS: create a weak alias + */ +#define WEAK_ALIAS(alias,sym) \ + .weak alias; alias = sym + + +/* * Macros to panic and printf from assembly language. */ #define PANIC(msg) \ Index: sys/arch/powerpc/include/asm.h =================================================================== RCS file: /cvs/src/sys/arch/powerpc/include/asm.h,v retrieving revision 1.7 diff -u -p -r1.7 asm.h --- sys/arch/powerpc/include/asm.h 15 Sep 2002 09:01:59 -0000 1.7 +++ sys/arch/powerpc/include/asm.h 5 Sep 2010 22:13:53 -0000 @@ -103,4 +103,7 @@ _TMP_LABEL(y):; \ #define RCSID(x) .text; .asciz x +#define WEAK_ALIAS(alias,sym) \ + .weak alias; .set alias,sym + #endif /* !_POWERPC_ASM_H_ */ Index: lib/libc/arch/hppa/SYS.h =================================================================== RCS file: /cvs/src/lib/libc/arch/hppa/SYS.h,v retrieving revision 1.15 diff -u -p -r1.15 SYS.h --- lib/libc/arch/hppa/SYS.h 5 Jan 2006 22:13:55 -0000 1.15 +++ lib/libc/arch/hppa/SYS.h 5 Sep 2010 22:13:53 -0000 @@ -35,7 +35,7 @@ #define SYSENTRY(x) !\ LEAF_ENTRY(__CONCAT(_thread_sys_,x)) !\ - .weak x ! .set x, __CONCAT(_thread_sys_,x) + WEAK_ALIAS(x,__CONCAT(_thread_sys_,x)) #define SYSEXIT(x) !\ EXIT(__CONCAT(_thread_sys_,x)) Index: lib/libc/arch/hppa64/SYS.h =================================================================== RCS file: /cvs/src/lib/libc/arch/hppa64/SYS.h,v retrieving revision 1.2 diff -u -p -r1.2 SYS.h --- lib/libc/arch/hppa64/SYS.h 5 Jan 2006 22:19:49 -0000 1.2 +++ lib/libc/arch/hppa64/SYS.h 5 Sep 2010 22:13:53 -0000 @@ -35,7 +35,7 @@ #define SYSENTRY(x) !\ LEAF_ENTRY(__CONCAT(_thread_sys_,x)) !\ - .weak x ! .set x, __CONCAT(_thread_sys_,x) + WEAK_ALIAS(x,__CONCAT(_thread_sys_,x)) #define SYSEXIT(x) !\ EXIT(__CONCAT(_thread_sys_,x)) Index: lib/libc/arch/mips64/SYS.h =================================================================== RCS file: /cvs/src/lib/libc/arch/mips64/SYS.h,v retrieving revision 1.3 diff -u -p -r1.3 SYS.h --- lib/libc/arch/mips64/SYS.h 9 Sep 2004 16:14:02 -0000 1.3 +++ lib/libc/arch/mips64/SYS.h 5 Sep 2010 22:13:53 -0000 @@ -43,7 +43,7 @@ syscall # define __LEAF2(p,x,sz) LEAF(p ## x, sz) \ - .weak x; x = p ## x; + WEAK_ALIAS(x, p ## x); # define __END2(p,x) END(p ## x) @@ -56,7 +56,7 @@ syscall # define __LEAF2(p,x,sz) LEAF(p/**/x, sz) \ - .weak x; x = p/**/x; + WEAK_ALIAS(x, p/**/x); # define __END2(p,x) END(p/**/x) Index: lib/libc/arch/powerpc/SYS.h =================================================================== RCS file: /cvs/src/lib/libc/arch/powerpc/SYS.h,v retrieving revision 1.13 diff -u -p -r1.13 SYS.h --- lib/libc/arch/powerpc/SYS.h 7 Oct 2002 04:16:33 -0000 1.13 +++ lib/libc/arch/powerpc/SYS.h 5 Sep 2010 22:13:53 -0000 @@ -65,7 +65,7 @@ #define SUFFIX PSEUDO_SUFFIX -#define ALIAS(x,y) .weak y; .set y,_CONCAT(x,y); +#define ALIAS(x,y) WEAK_ALIAS(y,_CONCAT(x,y)); #define PREFIX(x) ALIAS(_thread_sys_,x) \ PSEUDO_PREFIX(_thread_sys_,x,x) Index: lib/libc/arch/sh/SYS.h =================================================================== RCS file: /cvs/src/lib/libc/arch/sh/SYS.h,v retrieving revision 1.1.1.1 diff -u -p -r1.1.1.1 SYS.h --- lib/libc/arch/sh/SYS.h 10 Oct 2006 22:07:10 -0000 1.1.1.1 +++ lib/libc/arch/sh/SYS.h 5 Sep 2010 22:13:53 -0000 @@ -39,13 +39,11 @@ #ifdef __STDC__ #define SYSENTRY(x) \ - .weak _C_LABEL(x); \ - _C_LABEL(x) = _C_LABEL(_thread_sys_ ## x); \ + WEAK_ALIAS(x,_thread_sys_ ## x); \ ENTRY(_thread_sys_ ## x) #else #define SYSENTRY(x) \ - .weak _C_LABEL(x); \ - _C_LABEL(x) = _C_LABEL(_thread_sys_/**/x); \ + WEAK_ALIAS(x,_thread_sys_/**/x); \ ENTRY(_thread_sys_/**/x) #endif