aboutsummaryrefslogtreecommitdiff
path: root/sysdeps/loongarch/dl-trampoline.S
diff options
context:
space:
mode:
authorcaiyinyu <caiyinyu@loongson.cn>2023-07-05 16:38:05 +0800
committercaiyinyu <caiyinyu@loongson.cn>2023-07-11 10:56:01 +0800
commit7f079fdc16e88ebb8020e17b2fd900e8924da29a (patch)
tree9d61e7774fb649ac00188093a15eb9c20f925430 /sysdeps/loongarch/dl-trampoline.S
parent0d341d09f27fdc48a0e65242f3701ba8ea980b37 (diff)
downloadglibc-7f079fdc16e88ebb8020e17b2fd900e8924da29a.zip
glibc-7f079fdc16e88ebb8020e17b2fd900e8924da29a.tar.gz
glibc-7f079fdc16e88ebb8020e17b2fd900e8924da29a.tar.bz2
LoongArch: Add vector implementation for _dl_runtime_resolve.
Diffstat (limited to 'sysdeps/loongarch/dl-trampoline.S')
-rw-r--r--sysdeps/loongarch/dl-trampoline.S84
1 files changed, 16 insertions, 68 deletions
diff --git a/sysdeps/loongarch/dl-trampoline.S b/sysdeps/loongarch/dl-trampoline.S
index ed9ec09..2a561b7 100644
--- a/sysdeps/loongarch/dl-trampoline.S
+++ b/sysdeps/loongarch/dl-trampoline.S
@@ -19,77 +19,25 @@
#include <sysdep.h>
#include <sys/asm.h>
-#include "dl-link.h"
-
-/* Assembler veneer called from the PLT header code for lazy loading.
- The PLT header passes its own args in t0-t2. */
-#ifdef __loongarch_soft_float
-#define FRAME_SIZE (-((-10 * SZREG) & ALMASK))
-#else
-#define FRAME_SIZE (-((-10 * SZREG - 8 * SZFREG) & ALMASK))
+#if HAVE_LOONGARCH_VEC_ASM
+#define USE_LASX
+#define _dl_runtime_resolve _dl_runtime_resolve_lasx
+#include "dl-trampoline.h"
+#undef FRAME_SIZE
+#undef USE_LASX
+#undef _dl_runtime_resolve
+
+#define USE_LSX
+#define _dl_runtime_resolve _dl_runtime_resolve_lsx
+#include "dl-trampoline.h"
+#undef FRAME_SIZE
+#undef USE_LSX
+#undef _dl_runtime_resolve
#endif
-ENTRY (_dl_runtime_resolve)
-
- /* Save arguments to stack. */
- ADDI sp, sp, -FRAME_SIZE
- REG_S ra, sp, 9*SZREG
- REG_S a0, sp, 1*SZREG
- REG_S a1, sp, 2*SZREG
- REG_S a2, sp, 3*SZREG
- REG_S a3, sp, 4*SZREG
- REG_S a4, sp, 5*SZREG
- REG_S a5, sp, 6*SZREG
- REG_S a6, sp, 7*SZREG
- REG_S a7, sp, 8*SZREG
-
-#ifndef __loongarch_soft_float
- FREG_S fa0, sp, 10*SZREG + 0*SZFREG
- FREG_S fa1, sp, 10*SZREG + 1*SZFREG
- FREG_S fa2, sp, 10*SZREG + 2*SZFREG
- FREG_S fa3, sp, 10*SZREG + 3*SZFREG
- FREG_S fa4, sp, 10*SZREG + 4*SZFREG
- FREG_S fa5, sp, 10*SZREG + 5*SZFREG
- FREG_S fa6, sp, 10*SZREG + 6*SZFREG
- FREG_S fa7, sp, 10*SZREG + 7*SZFREG
-#endif
-
- /* Update .got.plt and obtain runtime address of callee */
- SLLI a1, t1, 1
- or a0, t0, zero
- ADD a1, a1, t1
- la a2, _dl_fixup
- jirl ra, a2, 0
- or t1, v0, zero
-
- /* Restore arguments from stack. */
- REG_L ra, sp, 9*SZREG
- REG_L a0, sp, 1*SZREG
- REG_L a1, sp, 2*SZREG
- REG_L a2, sp, 3*SZREG
- REG_L a3, sp, 4*SZREG
- REG_L a4, sp, 5*SZREG
- REG_L a5, sp, 6*SZREG
- REG_L a6, sp, 7*SZREG
- REG_L a7, sp, 8*SZREG
-
-#ifndef __loongarch_soft_float
- FREG_L fa0, sp, 10*SZREG + 0*SZFREG
- FREG_L fa1, sp, 10*SZREG + 1*SZFREG
- FREG_L fa2, sp, 10*SZREG + 2*SZFREG
- FREG_L fa3, sp, 10*SZREG + 3*SZFREG
- FREG_L fa4, sp, 10*SZREG + 4*SZFREG
- FREG_L fa5, sp, 10*SZREG + 5*SZFREG
- FREG_L fa6, sp, 10*SZREG + 6*SZFREG
- FREG_L fa7, sp, 10*SZREG + 7*SZFREG
-#endif
-
- ADDI sp, sp, FRAME_SIZE
-
- /* Invoke the callee. */
- jirl zero, t1, 0
-END (_dl_runtime_resolve)
+#include "dl-trampoline.h"
+#include "dl-link.h"
ENTRY (_dl_runtime_profile)
/* LoongArch we get called with: