File:  [DVB] / dietlibc / x86_64 / strcmp.S
Revision 1.3: download - view: text, annotated - select for diffs
Mon Jan 25 19:04:49 2016 UTC (8 years, 4 months ago) by leitner
Branches: MAIN
CVS tags: HEAD
  plumbing to get preliminary PIE support for x86_64

.text
.global strcmp
.type	strcmp,@function
.weak	strcoll
.type	strcoll,@function
#ifdef __PIE__
.hidden strcmp
.hidden strcoll
#endif

strcoll:
strcmp:
.Lloop:
	mov (%rdi),%al
	cmp (%rsi),%al
	jnz .Lmismatch
	inc %rsi
	inc %rdi
	or %al,%al
	jnz .Lloop
	/* end of string reached, return NULL */
	xor %eax,%eax
	ret
.Lmismatch:
/* In the C version we return (unsigned char)*b-(unsigned char)*a
   but in assembler it is less trouble to return 1 or -1
   depending on whether the carry flag is set.
   The standard only wants positive, zero, or negative, so both are OK */
	sbb %eax,%eax
	or $1,%eax
	ret
.Lhere:
.size strcmp,.Lhere-strcmp
	.section	.note.GNU-stack,"",@progbits

LinuxTV legacy CVS <linuxtv.org/cvs>