Author: jilles Date: Sat Aug 17 19:24:58 2013 New Revision: 254463 URL: http://svnweb.freebsd.org/changeset/base/254463
Log: libc: Access _logname_valid more efficiently. The variable _logname_valid is not exported via the version script; therefore, change C and i386/amd64 assembler code to remove indirection (which allowed interposition). This makes the code slightly smaller and faster. Also, remove #define PIC_GOT from i386/amd64 in !PIC mode. Without PIC, there is no place containing the address of each variable, so there is no possible definition for PIC_GOT. Modified: head/lib/libc/amd64/sys/setlogin.S head/lib/libc/gen/getlogin.c head/lib/libc/i386/sys/setlogin.S head/sys/amd64/include/asm.h head/sys/i386/include/asm.h Modified: head/lib/libc/amd64/sys/setlogin.S ============================================================================== --- head/lib/libc/amd64/sys/setlogin.S Sat Aug 17 19:23:35 2013 (r254462) +++ head/lib/libc/amd64/sys/setlogin.S Sat Aug 17 19:24:58 2013 (r254463) @@ -48,12 +48,7 @@ ENTRY(__sys_setlogin) mov $SYS_setlogin,%rax KERNCALL jb HIDENAME(cerror) -#ifdef PIC - movq PIC_GOT(CNAME(_logname_valid)),%rdx - movl $0,(%rdx) -#else movl $0,CNAME(_logname_valid)(%rip) -#endif ret /* setlogin(name) */ END(__sys_setlogin) Modified: head/lib/libc/gen/getlogin.c ============================================================================== --- head/lib/libc/gen/getlogin.c Sat Aug 17 19:23:35 2013 (r254462) +++ head/lib/libc/gen/getlogin.c Sat Aug 17 19:24:58 2013 (r254463) @@ -50,7 +50,7 @@ __FBSDID("$FreeBSD$"); extern int _getlogin(char *, int); -int _logname_valid; /* known to setlogin() */ +int _logname_valid __hidden; /* known to setlogin() */ static pthread_mutex_t logname_mutex = PTHREAD_MUTEX_INITIALIZER; static char * Modified: head/lib/libc/i386/sys/setlogin.S ============================================================================== --- head/lib/libc/i386/sys/setlogin.S Sat Aug 17 19:23:35 2013 (r254462) +++ head/lib/libc/i386/sys/setlogin.S Sat Aug 17 19:24:58 2013 (r254463) @@ -41,16 +41,9 @@ __FBSDID("$FreeBSD$"); .globl CNAME(_logname_valid) /* in _getlogin() */ SYSCALL(setlogin) -#ifdef PIC PIC_PROLOGUE - pushl %eax - movl PIC_GOT(CNAME(_logname_valid)),%eax - movl $0,(%eax) - popl %eax + movl $0,PIC_GOTOFF(CNAME(_logname_valid)) PIC_EPILOGUE -#else - movl $0,CNAME(_logname_valid) -#endif ret /* setlogin(name) */ END(__sys_setlogin) Modified: head/sys/amd64/include/asm.h ============================================================================== --- head/sys/amd64/include/asm.h Sat Aug 17 19:23:35 2013 (r254462) +++ head/sys/amd64/include/asm.h Sat Aug 17 19:24:58 2013 (r254463) @@ -43,7 +43,6 @@ #define PIC_GOT(x) x@GOTPCREL(%rip) #else #define PIC_PLT(x) x -#define PIC_GOT(x) x #endif /* Modified: head/sys/i386/include/asm.h ============================================================================== --- head/sys/i386/include/asm.h Sat Aug 17 19:23:35 2013 (r254462) +++ head/sys/i386/include/asm.h Sat Aug 17 19:24:58 2013 (r254463) @@ -49,11 +49,12 @@ popl %ebx #define PIC_PLT(x) x@PLT #define PIC_GOT(x) x@GOT(%ebx) +#define PIC_GOTOFF(x) x@GOTOFF(%ebx) #else #define PIC_PROLOGUE #define PIC_EPILOGUE #define PIC_PLT(x) x -#define PIC_GOT(x) x +#define PIC_GOTOFF(x) x #endif /* _______________________________________________ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"