[PATCH] x86-64: Use direct TLS initial-exec access to update errno

Florian Weimer fweimer@redhat.com
Tue Dec 5 13:47:00 GMT 2017


On 12/05/2017 12:13 AM, H.J. Lu wrote:
> -	/* Align stack to 16 bytes.  */
> -	subq	$8, %rsp
> -	cfi_adjust_cfa_offset (8)
> -	/* Here if x is Inf. Set errno to EDOM.  */
> -	call	JUMPTARGET(__errno_location)
> -	addq	$8, %rsp
> -	cfi_adjust_cfa_offset (-8)
> -
> -	movl	$EDOM, (%rax)
> +	movq	errno@gottpoff(%rip), %rax
> +	movl	$EDOM, %fs:(%rax)

If you replace subq/addq with push/pop of a dummy register, then, the 
__errno_location approach results in more compact code, I think.

Thanks,
Florian



More information about the Libc-alpha mailing list