mirror of
git://sourceware.org/git/glibc.git
synced 2025-02-11 12:50:58 +08:00
arm: Introduce and use LDST_PCREL
Macro-ising the few instances where we need to distinguish between arm and thumb pc-relative memory operations.
This commit is contained in:
parent
8e39047d31
commit
cd24e113c3
@ -1,3 +1,15 @@
|
|||||||
|
2013-03-06 Richard Henderson <rth@redhat.com>
|
||||||
|
|
||||||
|
* sysdeps/arm/sysdep.h (LDST_PCREL): New macro.
|
||||||
|
* sysdeps/unix/arm/sysdep.S (__syscall_error): Use LDST_PCREL.
|
||||||
|
Fix up gottpoff load of errno for thumb2.
|
||||||
|
* sysdeps/unix/sysv/linux/arm/nptl/sysdep-cancel.h
|
||||||
|
(SINGLE_THREAD_P): Use LDST_PCREL.
|
||||||
|
(PSEUDO_PROLOGUE): Remove.
|
||||||
|
(PSEUDO): Don't use it.
|
||||||
|
* sysdeps/unix/sysv/linux/arm/sysdep.h (SYSCALL_ERROR_HANDLER):
|
||||||
|
Use LDST_PCREL.
|
||||||
|
|
||||||
2013-03-06 Andreas Jaeger <aj@suse.de>
|
2013-03-06 Andreas Jaeger <aj@suse.de>
|
||||||
|
|
||||||
* sysdeps/unix/sysv/linux/arm/bits/mman.h: Remove all defines
|
* sysdeps/unix/sysv/linux/arm/bits/mman.h: Remove all defines
|
||||||
|
@ -117,6 +117,23 @@
|
|||||||
the caller. */
|
the caller. */
|
||||||
.eabi_attribute 24, 1
|
.eabi_attribute 24, 1
|
||||||
|
|
||||||
|
/* Load or store to/from a pc-relative EXPR into/from R, using T. */
|
||||||
|
# ifdef __thumb2__
|
||||||
|
# define LDST_PCREL(OP, R, T, EXPR) \
|
||||||
|
ldr T, 98f; \
|
||||||
|
.subsection 2; \
|
||||||
|
98: .word EXPR - 99f - PC_OFS; \
|
||||||
|
.previous; \
|
||||||
|
99: add T, T, pc; \
|
||||||
|
OP R, [T]
|
||||||
|
# else
|
||||||
|
# define LDST_PCREL(OP, R, T, EXPR) \
|
||||||
|
ldr T, 98f; \
|
||||||
|
.subsection 2; \
|
||||||
|
98: .word EXPR - 99f - PC_OFS; \
|
||||||
|
.previous; \
|
||||||
|
99: OP R, [pc, T]
|
||||||
|
# endif
|
||||||
#endif /* __ASSEMBLER__ */
|
#endif /* __ASSEMBLER__ */
|
||||||
|
|
||||||
/* This number is the offset from the pc at the current location. */
|
/* This number is the offset from the pc at the current location. */
|
||||||
|
@ -45,20 +45,22 @@ __syscall_error:
|
|||||||
mov lr, pc
|
mov lr, pc
|
||||||
sub pc, r0, #31
|
sub pc, r0, #31
|
||||||
|
|
||||||
ldr r2, 1f
|
ldr r2, 1f
|
||||||
2: ldr r2, [pc, r2]
|
#ifdef __thumb__
|
||||||
str r1, [r0, r2]
|
2: add r2, r2, pc
|
||||||
mvn r0, #0
|
ldr r2, [r2]
|
||||||
RETINSTR (, ip)
|
#else
|
||||||
|
2: ldr r2, [pc, r2]
|
||||||
|
#endif
|
||||||
|
str r1, [r0, r2]
|
||||||
|
mvn r0, #0
|
||||||
|
DO_RET(ip)
|
||||||
|
|
||||||
1: .word errno(gottpoff) + (. - 2b - PC_OFS)
|
1: .word errno(gottpoff) + (. - 2b - PC_OFS)
|
||||||
#elif RTLD_PRIVATE_ERRNO
|
#elif RTLD_PRIVATE_ERRNO
|
||||||
ldr r1, 1f
|
LDST_PCREL(str, r0, r1, C_SYMBOL_NAME(rtld_errno))
|
||||||
0: str r0, [pc, r1]
|
mvn r0, #0
|
||||||
mvn r0, $0
|
|
||||||
DO_RET(r14)
|
DO_RET(r14)
|
||||||
|
|
||||||
1: .word C_SYMBOL_NAME(rtld_errno) - 0b - PC_OFS
|
|
||||||
#else
|
#else
|
||||||
#error "Unsupported non-TLS case"
|
#error "Unsupported non-TLS case"
|
||||||
#endif
|
#endif
|
||||||
|
@ -31,7 +31,6 @@
|
|||||||
# undef PSEUDO
|
# undef PSEUDO
|
||||||
# define PSEUDO(name, syscall_name, args) \
|
# define PSEUDO(name, syscall_name, args) \
|
||||||
.text; \
|
.text; \
|
||||||
PSEUDO_PROLOGUE; \
|
|
||||||
ENTRY (__##syscall_name##_nocancel); \
|
ENTRY (__##syscall_name##_nocancel); \
|
||||||
CFI_SECTIONS; \
|
CFI_SECTIONS; \
|
||||||
DO_CALL (syscall_name, args); \
|
DO_CALL (syscall_name, args); \
|
||||||
@ -203,12 +202,8 @@ extern int __local_multiple_threads attribute_hidden;
|
|||||||
# define SINGLE_THREAD_P __builtin_expect (__local_multiple_threads == 0, 1)
|
# define SINGLE_THREAD_P __builtin_expect (__local_multiple_threads == 0, 1)
|
||||||
# else
|
# else
|
||||||
# define SINGLE_THREAD_P \
|
# define SINGLE_THREAD_P \
|
||||||
ldr ip, 1b; \
|
LDST_PCREL(ldr, ip, ip, __local_multiple_threads); \
|
||||||
2: \
|
teq ip, #0
|
||||||
ldr ip, [pc, ip]; \
|
|
||||||
teq ip, #0;
|
|
||||||
# define PSEUDO_PROLOGUE \
|
|
||||||
1: .word __local_multiple_threads - 2f - PC_OFS;
|
|
||||||
# endif
|
# endif
|
||||||
# else
|
# else
|
||||||
/* There is no __local_multiple_threads for librt, so use the TCB. */
|
/* There is no __local_multiple_threads for librt, so use the TCB. */
|
||||||
@ -217,7 +212,6 @@ extern int __local_multiple_threads attribute_hidden;
|
|||||||
__builtin_expect (THREAD_GETMEM (THREAD_SELF, \
|
__builtin_expect (THREAD_GETMEM (THREAD_SELF, \
|
||||||
header.multiple_threads) == 0, 1)
|
header.multiple_threads) == 0, 1)
|
||||||
# else
|
# else
|
||||||
# define PSEUDO_PROLOGUE
|
|
||||||
# define SINGLE_THREAD_P \
|
# define SINGLE_THREAD_P \
|
||||||
stmfd sp!, {r0, lr}; \
|
stmfd sp!, {r0, lr}; \
|
||||||
cfi_adjust_cfa_offset (8); \
|
cfi_adjust_cfa_offset (8); \
|
||||||
|
@ -110,12 +110,10 @@
|
|||||||
# if RTLD_PRIVATE_ERRNO
|
# if RTLD_PRIVATE_ERRNO
|
||||||
# define SYSCALL_ERROR_HANDLER \
|
# define SYSCALL_ERROR_HANDLER \
|
||||||
__local_syscall_error: \
|
__local_syscall_error: \
|
||||||
ldr r1, 1f; \
|
rsb r0, r0, #0; \
|
||||||
rsb r0, r0, #0; \
|
LDST_PCREL(str, r0, r1, C_SYMBOL_NAME(rtld_errno)); \
|
||||||
0: str r0, [pc, r1]; \
|
mvn r0, #0; \
|
||||||
mvn r0, #0; \
|
DO_RET(lr)
|
||||||
DO_RET(lr); \
|
|
||||||
1: .word C_SYMBOL_NAME(rtld_errno) - 0b - PC_OFS;
|
|
||||||
# else
|
# else
|
||||||
# if defined(__ARM_ARCH_4T__) && defined(__THUMB_INTERWORK__)
|
# if defined(__ARM_ARCH_4T__) && defined(__THUMB_INTERWORK__)
|
||||||
# define POP_PC \
|
# define POP_PC \
|
||||||
|
Loading…
Reference in New Issue
Block a user