We've been lax about matching END() macros in asm code for some time. This

is used to set the ELF size attribute for functions.  It isn't normally
critical but some things can make use of it (gdb for stack traces).
Valgrind needs it so I'm adding it in.  The problem is present on all
branches and on both i386 and amd64.
This commit is contained in:
Peter Wemm 2008-11-02 01:10:54 +00:00
parent 2db63c5e38
commit 5d053f461c
27 changed files with 46 additions and 4 deletions

View File

@ -43,13 +43,15 @@
.weak CNAME(__CONCAT(_,x)); \ .weak CNAME(__CONCAT(_,x)); \
.set CNAME(__CONCAT(_,x)),CNAME(__CONCAT(__sys_,x)); \ .set CNAME(__CONCAT(_,x)),CNAME(__CONCAT(__sys_,x)); \
mov __CONCAT($SYS_,x),%rax; KERNCALL; jb 2f; ret; \ mov __CONCAT($SYS_,x),%rax; KERNCALL; jb 2f; ret; \
2: movq PIC_GOT(HIDENAME(cerror)),%rcx; jmp *%rcx 2: movq PIC_GOT(HIDENAME(cerror)),%rcx; jmp *%rcx; \
END(__CONCAT(__sys_,x))
#define PSEUDO(x) ENTRY(__CONCAT(__sys_,x)); \ #define PSEUDO(x) ENTRY(__CONCAT(__sys_,x)); \
.weak CNAME(__CONCAT(_,x)); \ .weak CNAME(__CONCAT(_,x)); \
.set CNAME(__CONCAT(_,x)),CNAME(__CONCAT(__sys_,x)); \ .set CNAME(__CONCAT(_,x)),CNAME(__CONCAT(__sys_,x)); \
mov __CONCAT($SYS_,x),%rax; KERNCALL; jb 2f; ret ; \ mov __CONCAT($SYS_,x),%rax; KERNCALL; jb 2f; ret ; \
2: movq PIC_GOT(HIDENAME(cerror)),%rcx; jmp *%rcx 2: movq PIC_GOT(HIDENAME(cerror)),%rcx; jmp *%rcx; \
END(__CONCAT(__sys_,x))
#else #else
#define RSYSCALL(x) ENTRY(__CONCAT(__sys_,x)); \ #define RSYSCALL(x) ENTRY(__CONCAT(__sys_,x)); \
.weak CNAME(x); \ .weak CNAME(x); \
@ -57,13 +59,15 @@
.weak CNAME(__CONCAT(_,x)); \ .weak CNAME(__CONCAT(_,x)); \
.set CNAME(__CONCAT(_,x)),CNAME(__CONCAT(__sys_,x)); \ .set CNAME(__CONCAT(_,x)),CNAME(__CONCAT(__sys_,x)); \
mov __CONCAT($SYS_,x),%rax; KERNCALL; jb 2f; ret; \ mov __CONCAT($SYS_,x),%rax; KERNCALL; jb 2f; ret; \
2: jmp HIDENAME(cerror) 2: jmp HIDENAME(cerror); \
END(__CONCAT(__sys_,x))
#define PSEUDO(x) ENTRY(__CONCAT(__sys_,x)); \ #define PSEUDO(x) ENTRY(__CONCAT(__sys_,x)); \
.weak CNAME(__CONCAT(_,x)); \ .weak CNAME(__CONCAT(_,x)); \
.set CNAME(__CONCAT(_,x)),CNAME(__CONCAT(__sys_,x)); \ .set CNAME(__CONCAT(_,x)),CNAME(__CONCAT(__sys_,x)); \
mov __CONCAT($SYS_,x),%rax; KERNCALL; jb 2f; ret; \ mov __CONCAT($SYS_,x),%rax; KERNCALL; jb 2f; ret; \
2: jmp HIDENAME(cerror) 2: jmp HIDENAME(cerror); \
END(__CONCAT(__sys_,x))
#endif #endif
#define KERNCALL movq %rcx, %r10; syscall #define KERNCALL movq %rcx, %r10; syscall

View File

@ -61,6 +61,7 @@ ENTRY(_setjmp)
stmxcsr 68(%rax) /* and mxcsr */ stmxcsr 68(%rax) /* and mxcsr */
xorq %rax,%rax xorq %rax,%rax
ret ret
END(_setjmp)
.weak CNAME(_longjmp) .weak CNAME(_longjmp)
.set CNAME(_longjmp),CNAME(___longjmp) .set CNAME(_longjmp),CNAME(___longjmp)
@ -90,3 +91,4 @@ ENTRY(___longjmp)
incq %rax incq %rax
1: movq %rcx,0(%rsp) 1: movq %rcx,0(%rsp)
ret ret
END(___longjmp)

View File

@ -37,6 +37,7 @@ ENTRY(fabs)
movsd signbit(%rip), %xmm0 movsd signbit(%rip), %xmm0
andnpd %xmm1, %xmm0 andnpd %xmm1, %xmm0
ret ret
END(fabs)
.data .data
signbit: signbit:

View File

@ -86,3 +86,4 @@ ENTRY(modf)
movsd -8(%rsp),%xmm0 movsd -8(%rsp),%xmm0
ret ret
END(modf)

View File

@ -99,3 +99,4 @@ ENTRY(rfork_thread)
#else #else
jmp HIDENAME(cerror) jmp HIDENAME(cerror)
#endif #endif
END(rfork_thread)

View File

@ -70,6 +70,7 @@ ENTRY(setjmp)
stmxcsr 68(%rcx) /* and mxcsr */ stmxcsr 68(%rcx) /* and mxcsr */
xorq %rax,%rax xorq %rax,%rax
ret ret
END(setjmp)
.weak CNAME(longjmp) .weak CNAME(longjmp)
.set CNAME(longjmp),CNAME(__longjmp) .set CNAME(longjmp),CNAME(__longjmp)
@ -108,3 +109,4 @@ ENTRY(__longjmp)
incq %rax incq %rax
1: movq %rcx,0(%rsp) 1: movq %rcx,0(%rsp)
ret ret
END(__longjmp)

View File

@ -77,6 +77,7 @@ ENTRY(sigsetjmp)
fnstcw 64(%rcx) /* 8; fpu cw */ fnstcw 64(%rcx) /* 8; fpu cw */
xorq %rax,%rax xorq %rax,%rax
ret ret
END(sigsetjmp)
.weak CNAME(siglongjmp) .weak CNAME(siglongjmp)
.set CNAME(siglongjmp),CNAME(__siglongjmp) .set CNAME(siglongjmp),CNAME(__siglongjmp)
@ -109,3 +110,4 @@ ENTRY(__siglongjmp)
incq %rax incq %rax
1: movq %rcx,0(%rsp) 1: movq %rcx,0(%rsp)
ret ret
END(__siglongjmp)

View File

@ -15,3 +15,4 @@ ENTRY(div)
salq $32,%rdx salq $32,%rdx
orq %rdx,%rax orq %rdx,%rax
ret ret
END(div)

View File

@ -13,3 +13,4 @@ ENTRY(ldiv)
cqto cqto
idivq %rsi idivq %rsi
ret ret
END(ldiv)

View File

@ -13,3 +13,4 @@ ENTRY(lldiv)
cqto cqto
idivq %rsi idivq %rsi
ret ret
END(lldiv)

View File

@ -22,3 +22,4 @@ L1:
setne %al setne %al
movsbl %al,%eax movsbl %al,%eax
ret ret
END(bcmp)

View File

@ -86,3 +86,12 @@ ENTRY(bcopy)
movsq movsq
cld cld
ret ret
#ifdef MEMCOPY
END(memcpy)
#else
#ifdef MEMMOVE
END(memmove)
#else
END(bcopy)
#endif
#endif

View File

@ -41,3 +41,4 @@ L1: movq %rsi,%rcx /* zero remainder by bytes */
stosb stosb
ret ret
END(bzero)

View File

@ -39,3 +39,4 @@ L6: xorl %eax,%eax /* Perform unsigned comparison */
movb -1(%rsi),%dl movb -1(%rsi),%dl
subl %edx,%eax subl %edx,%eax
ret ret
END(memcmp)

View File

@ -58,3 +58,4 @@ L1: rep
movq %r11,%rax movq %r11,%rax
ret ret
END(memset)

View File

@ -163,3 +163,4 @@ ENTRY(strcat)
.Ldone: .Ldone:
ret ret
END(strcat)

View File

@ -71,3 +71,4 @@ ENTRY(strcmp)
movzbq %dl,%rdx movzbq %dl,%rdx
subq %rdx,%rax subq %rdx,%rax
ret ret
END(strcmp)

View File

@ -109,3 +109,4 @@ ENTRY(strcpy)
.Ldone: .Ldone:
ret ret
END(strcpy)

View File

@ -43,6 +43,7 @@ __FBSDID("$FreeBSD$");
ENTRY(_brk) ENTRY(_brk)
pushq %rdi pushq %rdi
jmp ok jmp ok
END(_brk)
ENTRY(brk) ENTRY(brk)
pushq %rdi pushq %rdi
@ -81,3 +82,4 @@ err:
#else #else
jmp HIDENAME(cerror) jmp HIDENAME(cerror)
#endif #endif
END(brk)

View File

@ -53,3 +53,4 @@ ENTRY(exect)
#else #else
jmp HIDENAME(cerror) jmp HIDENAME(cerror)
#endif #endif
END(exect)

View File

@ -52,3 +52,4 @@ ENTRY(__sys_getcontext)
#else #else
jmp HIDENAME(cerror) jmp HIDENAME(cerror)
#endif #endif
END(__sys_getcontext)

View File

@ -57,3 +57,4 @@ ENTRY(__sys_pipe)
#else #else
jmp HIDENAME(cerror) jmp HIDENAME(cerror)
#endif #endif
END(__sys_pipe)

View File

@ -57,3 +57,4 @@ err:
#else #else
jmp HIDENAME(cerror) jmp HIDENAME(cerror)
#endif #endif
END(ptrace)

View File

@ -54,3 +54,4 @@ ENTRY(__sys_reboot)
#else #else
jmp HIDENAME(cerror) jmp HIDENAME(cerror)
#endif #endif
END(__sys_reboot)

View File

@ -85,3 +85,4 @@ err:
#else #else
jmp HIDENAME(cerror) jmp HIDENAME(cerror)
#endif #endif
END(sbrk)

View File

@ -62,3 +62,4 @@ ENTRY(__sys_setlogin)
#else #else
jmp HIDENAME(cerror) jmp HIDENAME(cerror)
#endif #endif
END(__sys_setlogin)

View File

@ -56,3 +56,4 @@ ENTRY(__sys_vfork)
#else #else
jmp HIDENAME(cerror) jmp HIDENAME(cerror)
#endif #endif
END(__sys_vfork)