]> sourceware.org Git - glibc.git/commitdiff
LoongArch: Fix ptr mangling/demangling features.
authorcaiyinyu <caiyinyu@loongson.cn>
Wed, 17 Aug 2022 00:17:39 +0000 (08:17 +0800)
committercaiyinyu <caiyinyu@loongson.cn>
Tue, 30 Aug 2022 03:45:22 +0000 (11:45 +0800)
sysdeps/loongarch/__longjmp.S
sysdeps/loongarch/setjmp.S
sysdeps/unix/sysv/linux/loongarch/sysdep.h

index c2c5b56a800cbfe5154cbe9298e2d43e02cff583..4207376f5e1b3ccf0fd10d083f2ac01313f7ba21 100644 (file)
@@ -22,7 +22,7 @@
 ENTRY (__longjmp)
 #ifdef PTR_MANGLE
        REG_L t0, a0, 0*SZREG
-       PTR_DEMANGLE (ra, t0, t1, t2)
+       PTR_DEMANGLE (ra, t0, t1)
        REG_L t0, a0, 1*SZREG
        PTR_DEMANGLE2 (sp, t0, t1)
 #else
index ec4ddc72dabfa1c3e1c25dea1e43d70a308de21c..298bb02a82692505f8ff5186ca872336c251bfc3 100644 (file)
@@ -30,7 +30,7 @@ END (setjmp)
 
 ENTRY (__sigsetjmp)
 #ifdef PTR_MANGLE
-       PTR_MANGLE (t0, ra, t1, t2)
+       PTR_MANGLE (t0, ra, t1)
        REG_S t0, a0, 0*SZREG
        PTR_MANGLE2 (t0, sp, t1)
        REG_S t0, a0, 1*SZREG
index 157cbd6c6b725302c961653c5206f43443b87a69..f4a1d23a97496147390aea424a01e541a89d6cc5 100644 (file)
@@ -316,29 +316,28 @@ extern long int __syscall_error (long int neg_errno);
 
 /* Pointer mangling is supported for LoongArch.  */
 
-/* Load or store to/from a got-relative EXPR into/from G, using T.
+/* Load a got-relative EXPR into G, using T.
    Note G and T are register names.  */
-#define LDST_GLOBAL(OP, G, T,  EXPR) \
-  pcalau12i T, %got_pc_hi20(EXPR); \
-  OP       T, T, %got_pc_lo12(EXPR); \
-  OP       G, T, 0;
+#define LD_GLOBAL(G, EXPR) \
+  la.global G, EXPR; \
+  REG_L            G,  G,  0;
 
-/* Load or store to/from a pc-relative EXPR into/from G, using T.
+/* Load a pc-relative EXPR into G, using T.
    Note G and T are register names.  */
-#define LDST_PCREL(OP, G, T,  EXPR) \
-  pcalau12i T, %pc_hi20(EXPR); \
-  OP       G, T, %pc_lo12(EXPR);
+#define LD_PCREL(G, EXPR) \
+  la.pcrel  G, EXPR; \
+  REG_L            G,  G,  0;
 
 #if (IS_IN (rtld) \
      || (!defined SHARED && (IS_IN (libc) \
      || IS_IN (libpthread))))
 
 #ifdef __ASSEMBLER__
-#define PTR_MANGLE(dst, src, guard, tmp) \
-  LDST_PCREL (REG_L, guard, tmp, __pointer_chk_guard_local); \
+#define PTR_MANGLE(dst, src, guard) \
+  LD_PCREL (guard, __pointer_chk_guard_local); \
   PTR_MANGLE2 (dst, src, guard);
-#define PTR_DEMANGLE(dst, src, guard, tmp) \
-  LDST_PCREL (REG_L, guard, tmp, __pointer_chk_guard_local); \
+#define PTR_DEMANGLE(dst, src, guard) \
+  LD_PCREL (guard, __pointer_chk_guard_local); \
   PTR_DEMANGLE2 (dst, src, guard);
 /* Use PTR_MANGLE2 for efficiency if guard is already loaded.  */
 #define PTR_MANGLE2(dst, src, guard) \
@@ -355,11 +354,11 @@ extern uintptr_t __pointer_chk_guard_local attribute_relro attribute_hidden;
 #else
 
 #ifdef __ASSEMBLER__
-#define PTR_MANGLE(dst, src, guard, tmp) \
-  LDST_GLOBAL (REG_L, guard, tmp, __pointer_chk_guard); \
+#define PTR_MANGLE(dst, src, guard) \
+  LD_GLOBAL (guard, __pointer_chk_guard); \
   PTR_MANGLE2 (dst, src, guard);
-#define PTR_DEMANGLE(dst, src, guard, tmp) \
-  LDST_GLOBAL (REG_L, guard, tmp, __pointer_chk_guard); \
+#define PTR_DEMANGLE(dst, src, guard) \
+  LD_GLOBAL (guard, __pointer_chk_guard); \
   PTR_DEMANGLE2 (dst, src, guard);
 /* Use PTR_MANGLE2 for efficiency if guard is already loaded.  */
 #define PTR_MANGLE2(dst, src, guard) \
This page took 0.048672 seconds and 5 git commands to generate.