svn commit: r258447 - in head: lib/libc/amd64 lib/libc/amd64/gen lib/libc/amd64/sys sys/amd64/include
Andreas Tobler
andreast at FreeBSD.org
Thu Nov 21 21:26:01 UTC 2013
Author: andreast
Date: Thu Nov 21 21:25:58 2013
New Revision: 258447
URL: http://svnweb.freebsd.org/changeset/base/258447
Log:
Introduce a WEAK_REFERENCE() alias and use it. Get rid of the CNAME and the
CONCAT macros in SYS.h.
Reviewed by: bde, kib
Modified:
head/lib/libc/amd64/SYS.h
head/lib/libc/amd64/gen/_setjmp.S
head/lib/libc/amd64/gen/setjmp.S
head/lib/libc/amd64/gen/sigsetjmp.S
head/lib/libc/amd64/sys/getcontext.S
head/lib/libc/amd64/sys/pipe.S
head/lib/libc/amd64/sys/reboot.S
head/lib/libc/amd64/sys/setlogin.S
head/lib/libc/amd64/sys/vfork.S
head/sys/amd64/include/asm.h
Modified: head/lib/libc/amd64/SYS.h
==============================================================================
--- head/lib/libc/amd64/SYS.h Thu Nov 21 21:19:01 2013 (r258446)
+++ head/lib/libc/amd64/SYS.h Thu Nov 21 21:25:58 2013 (r258447)
@@ -36,20 +36,17 @@
#include <sys/syscall.h>
#include <machine/asm.h>
-#define RSYSCALL(x) ENTRY(__CONCAT(__sys_,x)); \
- .weak CNAME(x); \
- .set CNAME(x),CNAME(__CONCAT(__sys_,x)); \
- .weak CNAME(__CONCAT(_,x)); \
- .set CNAME(__CONCAT(_,x)),CNAME(__CONCAT(__sys_,x)); \
- mov __CONCAT($SYS_,x),%eax; KERNCALL; \
+#define RSYSCALL(name) ENTRY(__sys_##name); \
+ WEAK_REFERENCE(__sys_##name, name); \
+ WEAK_REFERENCE(__sys_##name, _##name); \
+ mov $SYS_##name,%eax; KERNCALL; \
jb HIDENAME(cerror); ret; \
- END(__CONCAT(__sys_,x))
+ END(__sys_##name)
-#define PSEUDO(x) ENTRY(__CONCAT(__sys_,x)); \
- .weak CNAME(__CONCAT(_,x)); \
- .set CNAME(__CONCAT(_,x)),CNAME(__CONCAT(__sys_,x)); \
- mov __CONCAT($SYS_,x),%eax; KERNCALL; \
+#define PSEUDO(name) ENTRY(__sys_##name); \
+ WEAK_REFERENCE(__sys_##name, _##name); \
+ mov $SYS_##name,%eax; KERNCALL; \
jb HIDENAME(cerror); ret; \
- END(__CONCAT(__sys_,x))
+ END(__sys_##name)
-#define KERNCALL movq %rcx, %r10; syscall
+#define KERNCALL movq %rcx, %r10; syscall
Modified: head/lib/libc/amd64/gen/_setjmp.S
==============================================================================
--- head/lib/libc/amd64/gen/_setjmp.S Thu Nov 21 21:19:01 2013 (r258446)
+++ head/lib/libc/amd64/gen/_setjmp.S Thu Nov 21 21:25:58 2013 (r258447)
@@ -63,8 +63,7 @@ ENTRY(_setjmp)
ret
END(_setjmp)
- .weak CNAME(_longjmp)
- .set CNAME(_longjmp),CNAME(___longjmp)
+ WEAK_REFERENCE(___longjmp, _longjmp)
ENTRY(___longjmp)
movq %rdi,%rdx
/* Restore the mxcsr, but leave exception flags intact. */
Modified: head/lib/libc/amd64/gen/setjmp.S
==============================================================================
--- head/lib/libc/amd64/gen/setjmp.S Thu Nov 21 21:19:01 2013 (r258446)
+++ head/lib/libc/amd64/gen/setjmp.S Thu Nov 21 21:25:58 2013 (r258447)
@@ -73,8 +73,7 @@ ENTRY(setjmp)
ret
END(setjmp)
- .weak CNAME(longjmp)
- .set CNAME(longjmp),CNAME(__longjmp)
+ WEAK_REFERENCE(__longjmp, longjmp)
ENTRY(__longjmp)
pushq %rdi
pushq %rsi
Modified: head/lib/libc/amd64/gen/sigsetjmp.S
==============================================================================
--- head/lib/libc/amd64/gen/sigsetjmp.S Thu Nov 21 21:19:01 2013 (r258446)
+++ head/lib/libc/amd64/gen/sigsetjmp.S Thu Nov 21 21:25:58 2013 (r258447)
@@ -80,8 +80,7 @@ ENTRY(sigsetjmp)
ret
END(sigsetjmp)
- .weak CNAME(siglongjmp)
- .set CNAME(siglongjmp),CNAME(__siglongjmp)
+ WEAK_REFERENCE(__siglongjmp, siglongjmp)
ENTRY(__siglongjmp)
cmpl $0,88(%rdi)
jz 2f
Modified: head/lib/libc/amd64/sys/getcontext.S
==============================================================================
--- head/lib/libc/amd64/sys/getcontext.S Thu Nov 21 21:19:01 2013 (r258446)
+++ head/lib/libc/amd64/sys/getcontext.S Thu Nov 21 21:25:58 2013 (r258447)
@@ -34,10 +34,8 @@ __FBSDID("$FreeBSD$");
* Otherwise, the setcontext() syscall will return here and we'll
* pop off the return address and go to the *setcontext* call.
*/
- .weak _getcontext
- .set _getcontext,__sys_getcontext
- .weak getcontext
- .set getcontext,__sys_getcontext
+ WEAK_REFERENCE(__sys_getcontext, _getcontext)
+ WEAK_REFERENCE(__sys_getcontext, getcontext)
ENTRY(__sys_getcontext)
movq (%rsp),%rsi /* save getcontext return address */
mov $SYS_getcontext,%rax
Modified: head/lib/libc/amd64/sys/pipe.S
==============================================================================
--- head/lib/libc/amd64/sys/pipe.S Thu Nov 21 21:19:01 2013 (r258446)
+++ head/lib/libc/amd64/sys/pipe.S Thu Nov 21 21:25:58 2013 (r258447)
@@ -38,10 +38,8 @@ __FBSDID("$FreeBSD$");
#include "SYS.h"
- .weak _pipe
- .set _pipe,__sys_pipe
- .weak pipe
- .set pipe,__sys_pipe
+ WEAK_REFERENCE(__sys_pipe, _pipe)
+ WEAK_REFERENCE(__sys_pipe, pipe)
ENTRY(__sys_pipe)
mov $SYS_pipe,%rax
KERNCALL
Modified: head/lib/libc/amd64/sys/reboot.S
==============================================================================
--- head/lib/libc/amd64/sys/reboot.S Thu Nov 21 21:19:01 2013 (r258446)
+++ head/lib/libc/amd64/sys/reboot.S Thu Nov 21 21:25:58 2013 (r258447)
@@ -38,10 +38,8 @@ __FBSDID("$FreeBSD$");
#include "SYS.h"
- .weak _reboot
- .set _reboot,__sys_reboot
- .weak reboot
- .set reboot,__sys_reboot
+ WEAK_REFERENCE(__sys_reboot, _reboot)
+ WEAK_REFERENCE(__sys_reboot, reboot)
ENTRY(__sys_reboot)
mov $SYS_reboot,%rax
KERNCALL
Modified: head/lib/libc/amd64/sys/setlogin.S
==============================================================================
--- head/lib/libc/amd64/sys/setlogin.S Thu Nov 21 21:19:01 2013 (r258446)
+++ head/lib/libc/amd64/sys/setlogin.S Thu Nov 21 21:25:58 2013 (r258447)
@@ -40,10 +40,8 @@ __FBSDID("$FreeBSD$");
.globl CNAME(_logname_valid) /* in _getlogin() */
- .weak _setlogin
- .set _setlogin,__sys_setlogin
- .weak setlogin
- .set setlogin,__sys_setlogin
+ WEAK_REFERENCE(__sys_setlogin, _setlogin)
+ WEAK_REFERENCE(__sys_setlogin, setlogin)
ENTRY(__sys_setlogin)
mov $SYS_setlogin,%rax
KERNCALL
Modified: head/lib/libc/amd64/sys/vfork.S
==============================================================================
--- head/lib/libc/amd64/sys/vfork.S Thu Nov 21 21:19:01 2013 (r258446)
+++ head/lib/libc/amd64/sys/vfork.S Thu Nov 21 21:25:58 2013 (r258447)
@@ -38,10 +38,8 @@ __FBSDID("$FreeBSD$");
#include "SYS.h"
- .weak _vfork
- .set _vfork,__sys_vfork
- .weak vfork
- .set vfork,__sys_vfork
+ WEAK_REFERENCE(__sys_vfork, _vfork)
+ WEAK_REFERENCE(__sys_vfork, vfork)
ENTRY(__sys_vfork)
popq %rsi /* fetch return address (%rsi preserved) */
mov $SYS_vfork,%rax
Modified: head/sys/amd64/include/asm.h
==============================================================================
--- head/sys/amd64/include/asm.h Thu Nov 21 21:19:01 2013 (r258446)
+++ head/sys/amd64/include/asm.h Thu Nov 21 21:25:58 2013 (r258447)
@@ -77,6 +77,15 @@
#endif
#define END(x) .size x, . - x
+/*
+ * WEAK_REFERENCE(): create a weak reference alias from sym.
+ * The macro is not a general asm macro that takes arbitrary names,
+ * but one that takes only C names. It does the non-null name
+ * translation inside the macro.
+ */
+#define WEAK_REFERENCE(sym, alias) \
+ .weak CNAME(alias); \
+ .equ CNAME(alias),CNAME(sym)
#define RCSID(x) .text; .asciz x
More information about the svn-src-all
mailing list