[v3,6/9] aarch64: Use tpidr_el0 rather than __errno_location in librt
Commit Message
From: Richard Henderson <rth@redhat.com>
---
sysdeps/unix/sysv/linux/aarch64/nptl/localplt.data | 1 -
sysdeps/unix/sysv/linux/aarch64/sysdep.h | 19 +++++--------------
2 files changed, 5 insertions(+), 15 deletions(-)
Comments
On 25 May 2014 20:41, Richard Henderson <rth@twiddle.net> wrote:
> From: Richard Henderson <rth@redhat.com>
>
> ---
> sysdeps/unix/sysv/linux/aarch64/nptl/localplt.data | 1 -
> sysdeps/unix/sysv/linux/aarch64/sysdep.h | 19 +++++--------------
> 2 files changed, 5 insertions(+), 15 deletions(-)
>
This looks ok. /Marcus
On 2014/5/26 3:41, Richard Henderson wrote:
> From: Richard Henderson <rth@redhat.com>
>
> ---
> sysdeps/unix/sysv/linux/aarch64/nptl/localplt.data | 1 -
> sysdeps/unix/sysv/linux/aarch64/sysdep.h | 19 +++++--------------
> 2 files changed, 5 insertions(+), 15 deletions(-)
>
> diff --git a/sysdeps/unix/sysv/linux/aarch64/nptl/localplt.data b/sysdeps/unix/sysv/linux/aarch64/nptl/localplt.data
> index 84af95d..dfca9a7 100644
> --- a/sysdeps/unix/sysv/linux/aarch64/nptl/localplt.data
> +++ b/sysdeps/unix/sysv/linux/aarch64/nptl/localplt.data
> @@ -12,4 +12,3 @@ libm.so: matherr
> libm.so: __signbit
> libm.so: __signbitf
> libm.so: __signbitl
> -libpthread.so: __errno_location
> diff --git a/sysdeps/unix/sysv/linux/aarch64/sysdep.h b/sysdeps/unix/sysv/linux/aarch64/sysdep.h
> index 0e91f83..8cce986 100644
> --- a/sysdeps/unix/sysv/linux/aarch64/sysdep.h
> +++ b/sysdeps/unix/sysv/linux/aarch64/sysdep.h
> @@ -123,21 +123,12 @@
>
> # define SYSCALL_ERROR_HANDLER \
> .Lsyscall_error: \
> - stp x29, x30, [sp, -32]!; \
> - cfi_adjust_cfa_offset (32); \
> - cfi_rel_offset (x29, 0); \
> - cfi_rel_offset (x30, 8); \
> - add x29, sp, 0; \
> - str x19, [sp,16]; \
> - neg x19, x0; \
> - bl C_SYMBOL_NAME(__errno_location); \
> - str w19, [x0]; \
> + adrp x1, :gottprel:errno; \
> + neg w2, w0; \
> + ldr x1, [x1, :gottprel_lo12:errno]; \
> + mrs x3, tpidr_el0; \
> mov x0, -1; \
> - ldr x19, [sp,16]; \
> - ldp x29, x30, [sp], 32; \
> - cfi_adjust_cfa_offset (-32); \
> - cfi_restore (x29); \
> - cfi_restore (x30); \
> + str w2, [x1, x3]; \
> RET;
> # endif
> # else
>
Hi,
I met a Segmentation fault when I ran an ilp32 application on big-endian arm64 with this patch.
----------------cut here--------------------
mq_timedreceive[1041]: unhandled input address range fault (11) at 0xa00000f752f850, esr 0x92000044
pgd = ffffffc03ee92000
[a00000f752f850] *pgd=000000003ef17003, *pmd=0000000000000000
CPU: 2 PID: 1041 Comm: mq_timedreceive Not tainted 3.16.0+ #10
task: ffffffc03ec19ec0 ti: ffffffc03ef7c000 task.ti: ffffffc03ef7c000
PC is at 0xf6fdc668
LR is at 0x401fcc
pc : [<00000000f6fdc668>] lr : [<0000000000401fcc>] pstate: 20000000
sp : 00000000ffb3d130
x29: 00000000ffb3d130 x28: 0000000000000000
x27: 0000000000405000 x26: 0000000000000003
x25: 00000000004057a0 x24: 00000000ffb3f1d0
x23: 000000000041c000 x22: 000000000041c000
x21: 0000000000417798 x20: 00000000f703f860
x19: 00000000ffb3d1d0 x18: 000000000ebf6480
x17: 00000000f6fdc680 x16: 0000000000000000
x15: 000c7fb76c000000 x14: 0000000000000000
x13: 00000003e8000000 x12: 0000000000000018
x11: 0000000000033320 x10: 00000000544d96a3
x9 : 0000000000003d2e x8 : 00000000000000b7
x7 : 0000000000000000 x6 : 00000000f7042000
x5 : 00000000ffb3d1b8 x4 : 00000000ffb3d1c0
x3 : 00000000f703f850 x2 : 000000000000005a
x1 : 0fa00000004f0000 x0 : ffffffffffffffff
Segmentation fault
---------------------------------------------
The register x1 got a bad value.
Do we have any patch to fix this ?
Regards,
Yang
ldr x1, [x1, :gottprel_lo12:errno];
Needs to change to be:
ldr PTR_REG(1), [x1, :gottprel_lo12:errno];
Thanks,
Andrew Pinski
On 2014/11/12 11:45, Pinski, Andrew wrote:
> ldr x1, [x1, :gottprel_lo12:errno];
> Needs to change to be:
> ldr PTR_REG(1), [x1, :gottprel_lo12:errno];
>
> Thanks,
> Andrew Pinski
> ________________________________________
It works.
Thanks!
@@ -12,4 +12,3 @@ libm.so: matherr
libm.so: __signbit
libm.so: __signbitf
libm.so: __signbitl
-libpthread.so: __errno_location
@@ -123,21 +123,12 @@
# define SYSCALL_ERROR_HANDLER \
.Lsyscall_error: \
- stp x29, x30, [sp, -32]!; \
- cfi_adjust_cfa_offset (32); \
- cfi_rel_offset (x29, 0); \
- cfi_rel_offset (x30, 8); \
- add x29, sp, 0; \
- str x19, [sp,16]; \
- neg x19, x0; \
- bl C_SYMBOL_NAME(__errno_location); \
- str w19, [x0]; \
+ adrp x1, :gottprel:errno; \
+ neg w2, w0; \
+ ldr x1, [x1, :gottprel_lo12:errno]; \
+ mrs x3, tpidr_el0; \
mov x0, -1; \
- ldr x19, [sp,16]; \
- ldp x29, x30, [sp], 32; \
- cfi_adjust_cfa_offset (-32); \
- cfi_restore (x29); \
- cfi_restore (x30); \
+ str w2, [x1, x3]; \
RET;
# endif
# else