]> sourceware.org Git - glibc.git/commitdiff
LoongArch: Micro-optimize LD_PCREL
authorXi Ruoyao <xry111@xry111.site>
Sat, 26 Aug 2023 16:36:51 +0000 (00:36 +0800)
committercaiyinyu <caiyinyu@loongson.cn>
Tue, 29 Aug 2023 02:35:38 +0000 (10:35 +0800)
We are requiring Binutils >= 2.41, so explicit relocation syntax is
always supported by the assembler.  Use it to reduce one instruction.

Signed-off-by: Xi Ruoyao <xry111@xry111.site>
sysdeps/unix/sysv/linux/loongarch/pointer_guard.h

index b25e353b37e96abfbd32adb7d4015192121a4cae..d6c78687d4b23c5f388962902e6144b3112c080a 100644 (file)
 #ifndef POINTER_GUARD_H
 #define POINTER_GUARD_H
 
-/* Load a got-relative EXPR into G, using T.
-   Note G and T are register names.  */
+/* Load a got-relative EXPR into register G.  */
 #define LD_GLOBAL(G, EXPR) \
   la.global G,  EXPR; \
   REG_L     G,  G,  0;
 
-/* Load a pc-relative EXPR into G, using T.
-   Note G and T are register names.  */
+/* Load a pc-relative EXPR into register G.  */
 #define LD_PCREL(G, EXPR) \
-  la.pcrel  G,  EXPR; \
-  REG_L     G,  G,  0;
+  pcalau12i G, %pc_hi20(EXPR); \
+  REG_L     G, G, %pc_lo12(EXPR);
 
 #if (IS_IN (rtld) \
      || (!defined SHARED && (IS_IN (libc) \
This page took 0.039959 seconds and 5 git commands to generate.