diff options
author | Wilco Dijkstra <wilco.dijkstra@arm.com> | 2025-01-02 14:39:39 +0000 |
---|---|---|
committer | Wilco Dijkstra <wilco.dijkstra@arm.com> | 2025-02-24 14:16:55 +0000 |
commit | 19860fd42e39cfa03ba3c3c8becf27229eabc597 (patch) | |
tree | ac573262d28cbf20b784e8f056806bb8865dd0b1 | |
parent | ce2f26a22e6b6f5c108d156afd9b43a452bb024c (diff) | |
download | glibc-19860fd42e39cfa03ba3c3c8becf27229eabc597.zip glibc-19860fd42e39cfa03ba3c3c8becf27229eabc597.tar.gz glibc-19860fd42e39cfa03ba3c3c8becf27229eabc597.tar.bz2 |
AArch64: Remove PTR_REG defines
Remove PTR_REG defines.
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
-rw-r--r-- | sysdeps/aarch64/crti.S | 2 | ||||
-rw-r--r-- | sysdeps/aarch64/dl-start.S | 16 | ||||
-rw-r--r-- | sysdeps/aarch64/dl-tlsdesc.S | 30 | ||||
-rw-r--r-- | sysdeps/aarch64/dl-trampoline.S | 13 | ||||
-rw-r--r-- | sysdeps/aarch64/start.S | 12 | ||||
-rw-r--r-- | sysdeps/aarch64/sysdep.h | 34 | ||||
-rw-r--r-- | sysdeps/unix/sysv/linux/aarch64/getcontext.S | 2 |
7 files changed, 41 insertions, 68 deletions
diff --git a/sysdeps/aarch64/crti.S b/sysdeps/aarch64/crti.S index 80da5dc..0c3ee40 100644 --- a/sysdeps/aarch64/crti.S +++ b/sysdeps/aarch64/crti.S @@ -61,7 +61,7 @@ .type call_weak_fn, %function call_weak_fn: adrp x0, :got:PREINIT_FUNCTION - ldr PTR_REG (0), [x0, #:got_lo12:PREINIT_FUNCTION] + ldr x0, [x0, #:got_lo12:PREINIT_FUNCTION] cbz x0, 1f b PREINIT_FUNCTION 1: diff --git a/sysdeps/aarch64/dl-start.S b/sysdeps/aarch64/dl-start.S index b26549b..2ccc219 100644 --- a/sysdeps/aarch64/dl-start.S +++ b/sysdeps/aarch64/dl-start.S @@ -30,11 +30,11 @@ ENTRY (_start) mov x0, sp bl _dl_start /* Returns user entry point in x0. */ - mov PTR_REG (21), PTR_REG (0) + mov x21, x0 /* Use GL(dl_aarch64_gcs) to set the shadow stack status. */ adrp x16, _rtld_local - add PTR_REG (16), PTR_REG (16), :lo12:_rtld_local + add x16, x16, :lo12:_rtld_local ldr x1, [x16, GL_DL_AARCH64_GCS_OFFSET] cbz x1, L(skip_gcs_enable) @@ -56,18 +56,18 @@ L(skip_gcs_enable): .type _dl_start_user, %function _dl_start_user: /* Get argc. */ - ldr PTR_REG (1), [sp] + ldr x1, [sp] /* Get argv. */ - add x2, sp, PTR_SIZE + add x2, sp, 8 /* Compute envp. */ - add PTR_REG (3), PTR_REG (2), PTR_REG (1), lsl PTR_LOG_SIZE - add PTR_REG (3), PTR_REG (3), PTR_SIZE + add x3, x2, x1, lsl 3 + add x3, x3, 8 /* Run the init functions of the loaded modules. */ - ldr PTR_REG (0), [x16] + ldr x0, [x16] bl _dl_init /* Load the finalizer function. */ adrp x0, _dl_fini - add PTR_REG (0), PTR_REG (0), :lo12:_dl_fini + add x0, x0, :lo12:_dl_fini /* Jump to the user's entry point. */ mov x16, x21 br x16 diff --git a/sysdeps/aarch64/dl-tlsdesc.S b/sysdeps/aarch64/dl-tlsdesc.S index 76048950..68afc44 100644 --- a/sysdeps/aarch64/dl-tlsdesc.S +++ b/sysdeps/aarch64/dl-tlsdesc.S @@ -75,7 +75,7 @@ .align 2 _dl_tlsdesc_return: BTI_C - ldr PTR_REG (0), [x0, #PTR_SIZE] + ldr x0, [x0, 8] RET cfi_endproc .size _dl_tlsdesc_return, .-_dl_tlsdesc_return @@ -98,9 +98,9 @@ _dl_tlsdesc_undefweak: BTI_C str x1, [sp, #-16]! cfi_adjust_cfa_offset (16) - ldr PTR_REG (0), [x0, #PTR_SIZE] + ldr x0, [x0, 8] mrs x1, tpidr_el0 - sub PTR_REG (0), PTR_REG (0), PTR_REG (1) + sub x0, x0, x1 ldr x1, [sp], #16 cfi_adjust_cfa_offset (-16) RET @@ -155,21 +155,21 @@ _dl_tlsdesc_dynamic: cfi_rel_offset (x4, 24) mrs x4, tpidr_el0 - ldr PTR_REG (1), [x0,#TLSDESC_ARG] - ldr PTR_REG (0), [x4,#TCBHEAD_DTV] - ldr PTR_REG (3), [x1,#TLSDESC_GEN_COUNT] - ldr PTR_REG (2), [x0,#DTV_COUNTER] - cmp PTR_REG (3), PTR_REG (2) + ldr x1, [x0, TLSDESC_ARG] + ldr x0, [x4, TCBHEAD_DTV] + ldr x3, [x1, TLSDESC_GEN_COUNT] + ldr x2, [x0, DTV_COUNTER] + cmp x3, x2 b.hi 2f /* Load r2 = td->tlsinfo.ti_module and r3 = td->tlsinfo.ti_offset. */ - ldp PTR_REG (2), PTR_REG (3), [x1,#TLSDESC_MODID] - add PTR_REG (0), PTR_REG (0), PTR_REG (2), lsl #(PTR_LOG_SIZE + 1) - ldr PTR_REG (0), [x0] /* Load val member of DTV entry. */ - cmp PTR_REG (0), #TLS_DTV_UNALLOCATED + ldp x2, x3, [x1, TLSDESC_MODID] + add x0, x0, x2, lsl 4 + ldr x0, [x0] /* Load val member of DTV entry. */ + cmp x0, TLS_DTV_UNALLOCATED b.eq 2f cfi_remember_state - sub PTR_REG (3), PTR_REG (3), PTR_REG (4) - add PTR_REG (0), PTR_REG (0), PTR_REG (3) + sub x3, x3, x4 + add x0, x0, x3 1: ldp x3, x4, [sp, #16] ldp x1, x2, [sp], #32 @@ -220,7 +220,7 @@ _dl_tlsdesc_dynamic: bl HIDDEN_JUMPTARGET(__tls_get_addr) mrs x1, tpidr_el0 - sub PTR_REG (0), PTR_REG (0), PTR_REG (1) + sub x0, x0, x1 RESTORE_Q_REGISTERS diff --git a/sysdeps/aarch64/dl-trampoline.S b/sysdeps/aarch64/dl-trampoline.S index e9fce9a..d6bed96 100644 --- a/sysdeps/aarch64/dl-trampoline.S +++ b/sysdeps/aarch64/dl-trampoline.S @@ -22,12 +22,11 @@ #include "dl-link.h" #define ip0 x16 -#define ip0l PTR_REG (16) #define ip1 x17 #define lr x30 /* RELA relocatons are 3 pointers */ -#define RELA_SIZE (PTR_SIZE * 3) +#define RELA_SIZE 24 .text .globl _dl_runtime_resolve @@ -85,7 +84,7 @@ _dl_runtime_resolve: cfi_rel_offset (q1, 80+7*16) /* Get pointer to linker struct. */ - ldr PTR_REG (0), [ip0, #-PTR_SIZE] + ldr x0, [ip0, -8] /* Prepare to call _dl_fixup(). */ ldr x1, [sp, 80+8*16] /* Recover &PLTGOT[n] */ @@ -209,7 +208,7 @@ _dl_runtime_profile: stp x0, x1, [x29, #OFFSET_RG + DL_OFFSET_RG_SP] /* Get pointer to linker struct. */ - ldr PTR_REG (0), [ip0, #-PTR_SIZE] + ldr x0, [ip0, -8] /* Prepare to call _dl_profile_fixup(). */ ldr x1, [x29, OFFSET_PLTGOTN] /* Recover &PLTGOT[n] */ @@ -228,8 +227,8 @@ _dl_runtime_profile: add x4, x29, #OFFSET_FS /* address of framesize */ bl _dl_profile_fixup - ldr ip0l, [x29, #OFFSET_FS] /* framesize == 0 */ - cmp ip0l, #0 + ldr ip0, [x29, #OFFSET_FS] /* framesize == 0 */ + cmp ip0, #0 bge 1f cfi_remember_state @@ -271,7 +270,7 @@ _dl_runtime_profile: 1: /* The new frame size is in ip0. */ - sub PTR_REG (1), PTR_REG (29), ip0l + sub x1, x29, ip0 and sp, x1, #0xfffffffffffffff0 str x0, [x29, #OFFSET_T1] diff --git a/sysdeps/aarch64/start.S b/sysdeps/aarch64/start.S index ef6b5ad..544e397 100644 --- a/sysdeps/aarch64/start.S +++ b/sysdeps/aarch64/start.S @@ -70,8 +70,8 @@ ENTRY(_start) mov x5, x0 /* Load argc and a pointer to argv */ - ldr PTR_REG (1), [sp, #0] - add x2, sp, #PTR_SIZE + ldr x1, [sp, #0] + add x2, sp, 8 /* Setup stack limit in argument register */ mov x6, sp @@ -79,14 +79,16 @@ ENTRY(_start) #ifdef PIC # ifdef SHARED adrp x0, :got:main - ldr PTR_REG (0), [x0, #:got_lo12:main] + ldr x0, [x0, #:got_lo12:main] # else adrp x0, __wrap_main add x0, x0, :lo12:__wrap_main # endif #else - /* Set up the other arguments in registers */ - MOVL (0, main) + movz x0, :abs_g3:main + movk x0, :abs_g2_nc:main + movk x0, :abs_g1_nc:main + movk x0, :abs_g0_nc:main #endif mov x3, #0 /* Used to be init. */ mov x4, #0 /* Used to be fini. */ diff --git a/sysdeps/aarch64/sysdep.h b/sysdeps/aarch64/sysdep.h index 036eb12..b4aa191 100644 --- a/sysdeps/aarch64/sysdep.h +++ b/sysdeps/aarch64/sysdep.h @@ -21,21 +21,7 @@ #include <sysdeps/generic/sysdep.h> -#ifdef __LP64__ # define AARCH64_R(NAME) R_AARCH64_ ## NAME -# define PTR_REG(n) x##n -# define PTR_LOG_SIZE 3 -# define PTR_ARG(n) -# define SIZE_ARG(n) -#else -# define AARCH64_R(NAME) R_AARCH64_P32_ ## NAME -# define PTR_REG(n) w##n -# define PTR_LOG_SIZE 2 -# define PTR_ARG(n) mov w##n, w##n -# define SIZE_ARG(n) mov w##n, w##n -#endif - -#define PTR_SIZE (1<<PTR_LOG_SIZE) #ifndef __ASSEMBLER__ /* Strip pointer authentication code from pointer p. */ @@ -199,28 +185,14 @@ GNU_PROPERTY (FEATURE_1_AND, FEATURE_1_BTI|FEATURE_1_GCS) Note R and T are register numbers and not register names. */ #define LDST_PCREL(OP, R, T, EXPR) \ adrp x##T, EXPR; \ - OP PTR_REG (R), [x##T, #:lo12:EXPR]; \ + OP x##R, [x##T, #:lo12:EXPR]; \ /* Load or store to/from a got-relative EXPR into/from R, using T. Note R and T are register numbers and not register names. */ #define LDST_GLOBAL(OP, R, T, EXPR) \ adrp x##T, :got:EXPR; \ - ldr PTR_REG (T), [x##T, #:got_lo12:EXPR]; \ - OP PTR_REG (R), [x##T]; - -/* Load an immediate into R. - Note R is a register number and not a register name. */ -#ifdef __LP64__ -# define MOVL(R, NAME) \ - movz PTR_REG (R), #:abs_g3:NAME; \ - movk PTR_REG (R), #:abs_g2_nc:NAME; \ - movk PTR_REG (R), #:abs_g1_nc:NAME; \ - movk PTR_REG (R), #:abs_g0_nc:NAME; -#else -# define MOVL(R, NAME) \ - movz PTR_REG (R), #:abs_g1:NAME; \ - movk PTR_REG (R), #:abs_g0_nc:NAME; -#endif + ldr x##T, [x##T, #:got_lo12:EXPR]; \ + OP x##R, [x##T]; /* Since C identifiers are not normally prefixed with an underscore on this system, the asm identifier `syscall_error' intrudes on the diff --git a/sysdeps/unix/sysv/linux/aarch64/getcontext.S b/sysdeps/unix/sysv/linux/aarch64/getcontext.S index 6e7fc24..b6e64e5 100644 --- a/sysdeps/unix/sysv/linux/aarch64/getcontext.S +++ b/sysdeps/unix/sysv/linux/aarch64/getcontext.S @@ -105,7 +105,7 @@ L(gcs_done): /* Grab the signal mask */ /* rt_sigprocmask (SIG_BLOCK, NULL, &ucp->uc_sigmask, _NSIG8) */ - add PTR_REG (2), PTR_REG (0), #UCONTEXT_SIGMASK + add x2, x0, UCONTEXT_SIGMASK mov x0, SIG_BLOCK mov x1, 0 mov x3, _NSIG8 |