[1/6] aarch64: Merge rtld_errno offset with memory reference
diff mbox

Message ID 1400619378-7262-2-git-send-email-rth@twiddle.net
State New
Headers show

Commit Message

Richard Henderson May 20, 2014, 8:56 p.m. UTC
From: Richard Henderson <rth@redhat.com>

	* sysdeps/unix/sysv/linux/aarch64/sysdep.h [RTLD_PRIVATE_ERRNO]
	(SYSCALL_ERROR_HANDLER): Fold add insn into str offset.
---
 sysdeps/unix/sysv/linux/aarch64/sysdep.h | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

Comments

Marcus Shawcroft May 21, 2014, 8:41 a.m. UTC | #1
On 20 May 2014 21:56, Richard Henderson <rth@twiddle.net> wrote:
> From: Richard Henderson <rth@redhat.com>
>
>         * sysdeps/unix/sysv/linux/aarch64/sysdep.h [RTLD_PRIVATE_ERRNO]
>         (SYSCALL_ERROR_HANDLER): Fold add insn into str offset.
> ---
>  sysdeps/unix/sysv/linux/aarch64/sysdep.h | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/sysdeps/unix/sysv/linux/aarch64/sysdep.h b/sysdeps/unix/sysv/linux/aarch64/sysdep.h
> index d90ef25..8397ad3 100644
> --- a/sysdeps/unix/sysv/linux/aarch64/sysdep.h
> +++ b/sysdeps/unix/sysv/linux/aarch64/sysdep.h
> @@ -117,9 +117,8 @@
>  #   define SYSCALL_ERROR_HANDLER                               \
>  __local_syscall_error:                                         \
>         adrp    x1, C_SYMBOL_NAME(rtld_errno);                  \
> -       add     x1, x1, #:lo12:C_SYMBOL_NAME(rtld_errno);       \
>         neg     w0, w0;                                         \
> -       str     w0, [x1];                                       \
> +       str     w0, [x1, :lo12:C_SYMBOL_NAME(rtld_errno)];      \
>         mov     x0, -1;                                         \
>         RET;
>  #  else
> --
> 1.9.0
>

This is fine. Thanks /Marcus
Roland McGrath May 23, 2014, 8:31 p.m. UTC | #2
> -	add	x1, x1, #:lo12:C_SYMBOL_NAME(rtld_errno);	\
>  	neg     w0, w0;						\
> -	str     w0, [x1];					\
> +	str     w0, [x1, :lo12:C_SYMBOL_NAME(rtld_errno)];	\

Can we stay consistent about whether we use the # or not?
Richard Henderson May 23, 2014, 8:34 p.m. UTC | #3
On 05/23/2014 01:31 PM, Roland McGrath wrote:
>> -	add	x1, x1, #:lo12:C_SYMBOL_NAME(rtld_errno);	\
>>  	neg     w0, w0;						\
>> -	str     w0, [x1];					\
>> +	str     w0, [x1, :lo12:C_SYMBOL_NAME(rtld_errno)];	\
> 
> Can we stay consistent about whether we use the # or not?
> 

It's required in the context of the add, and not required (but accepted) in the
context of an address operand.

Personally, I prefer not using # in an address; which form do the AArch64
maintainers prefer?


r~
Marcus Shawcroft May 24, 2014, 7:31 a.m. UTC | #4
On 23 May 2014 21:34, Richard Henderson <rth@twiddle.net> wrote:

> It's required in the context of the add, and not required (but accepted) in the
> context of an address operand.

The relevant documentation here is: PRD03-GENC-010197 section 4.1.
The # is optional on all immediates.  The spec also requires that
disassemblers should always emit the # for readability.

> Personally, I prefer not using # in an address; which form do the AArch64
> maintainers prefer?

I think we should insert the # for all immediates.

I'm curious  about Richards statement above, have you seen a scenario
where the assembler refuses to accept the # on an add?  I doubled
checked this particular case with and without using trunk gas and it
seems to be fine.

Cheers
/Marcus

Patch
diff mbox

diff --git a/sysdeps/unix/sysv/linux/aarch64/sysdep.h b/sysdeps/unix/sysv/linux/aarch64/sysdep.h
index d90ef25..8397ad3 100644
--- a/sysdeps/unix/sysv/linux/aarch64/sysdep.h
+++ b/sysdeps/unix/sysv/linux/aarch64/sysdep.h
@@ -117,9 +117,8 @@ 
 #   define SYSCALL_ERROR_HANDLER				\
 __local_syscall_error:						\
 	adrp	x1, C_SYMBOL_NAME(rtld_errno);			\
-	add	x1, x1, #:lo12:C_SYMBOL_NAME(rtld_errno);	\
 	neg     w0, w0;						\
-	str     w0, [x1];					\
+	str     w0, [x1, :lo12:C_SYMBOL_NAME(rtld_errno)];	\
 	mov	x0, -1;						\
 	RET;
 #  else