Fix x86 __memset_chk.

The stack offsets assumed we'd pushed %ebx. Unlike x86-64 we can't fall
through, but we can avoid repeating work we've already done.

Change-Id: I7e5f9be50983ed6178dd0c0534042da7ea30ad0c
This commit is contained in:
Elliott Hughes 2016-03-24 22:34:47 -07:00
parent e725dc1640
commit 204990cc83
2 changed files with 12 additions and 8 deletions

View File

@ -113,11 +113,12 @@ __x86.get_pc_thunk.bx:
#endif
ENTRY(__memset_chk)
movl LEN(%esp), %ecx
cmpl %ecx, CHK_DST_LEN(%esp)
jbe memset
ENTRANCE
jmp __memset_chk_fail
movl LEN(%esp), %ecx
cmpl CHK_DST_LEN(%esp), %ecx
ja __memset_chk_fail
jmp L(memset_length_loaded)
END(__memset_chk)
.section .text.sse2,"ax",@progbits
@ -126,6 +127,7 @@ ENTRY (memset)
ENTRANCE
movl LEN(%esp), %ecx
L(memset_length_loaded):
movzbl CHR(%esp), %eax
movb %al, %ah
/* Fill the whole EAX with pattern. */

View File

@ -113,11 +113,12 @@ __x86.get_pc_thunk.bx:
#endif
ENTRY(__memset_chk)
movl LEN(%esp), %ecx
cmpl %ecx, CHK_DST_LEN(%esp)
jbe memset
ENTRANCE
jmp __memset_chk_fail
movl LEN(%esp), %ecx
cmpl CHK_DST_LEN(%esp), %ecx
ja __memset_chk_fail
jmp L(memset_length_loaded)
END(__memset_chk)
.section .text.sse2,"ax",@progbits
@ -126,6 +127,7 @@ ENTRY(memset)
ENTRANCE
movl LEN(%esp), %ecx
L(memset_length_loaded):
cmp $0, %ecx
ja L(1byteormore)
SETRTNVAL