about summary refs log tree commit diff
path: root/sysdeps/loongarch/dl-machine.h
diff options
context:
space:
mode:
authormengqinggang <mengqinggang@loongson.cn>2024-07-05 10:40:33 +0800
committercaiyinyu <caiyinyu@loongson.cn>2024-08-09 09:06:17 +0800
commit5662433c38c1925bd937cd50232fe4251bc20d04 (patch)
tree9174165f8bc3fa9ebc36db7938cd433d7e214902 /sysdeps/loongarch/dl-machine.h
parentd5f1da2a8a889e4868615f9b155ca67f10d46b5b (diff)
downloadglibc-5662433c38c1925bd937cd50232fe4251bc20d04.tar.gz
glibc-5662433c38c1925bd937cd50232fe4251bc20d04.tar.xz
glibc-5662433c38c1925bd937cd50232fe4251bc20d04.zip
LoongArch: Add cfi instructions for _dl_tlsdesc_dynamic
In _dl_tlsdesc_dynamic, there are three 'addi.d sp, sp, -size'
instructions to allocate stack size for Float/LSX/LASX registers.
Every 'addi.d sp, sp, -size' needs a cfi_adjust_cfa_offset because
of sp is used to compute CFA. But only one 'addi.d sp, sp, -size'
will be run according to HWCAP value. And all cfi_adjust_cfa_offset
will be executed in stack unwinding, it result in incorrect CFA.

Change _dl_tlsdesc_dynamic to _dl_tlsdesc_dynamic,
_dl_tlsdesc_dynamic_lsx and _dl_tlsdesc_dynamic_lasx.
Conflicting cfi instructions can be distributed to the three functions.
And cfi instructions can correspond to stack down instructions.
Diffstat (limited to 'sysdeps/loongarch/dl-machine.h')
-rw-r--r--sysdeps/loongarch/dl-machine.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/sysdeps/loongarch/dl-machine.h b/sysdeps/loongarch/dl-machine.h
index ab6f1da7c0..a15d8e0ab6 100644
--- a/sysdeps/loongarch/dl-machine.h
+++ b/sysdeps/loongarch/dl-machine.h
@@ -223,6 +223,13 @@ elf_machine_rela (struct link_map *map, struct r_scope_elem *scope[],
 	      {
 		td->arg = _dl_make_tlsdesc_dynamic (sym_map,
 			      sym->st_value + reloc->r_addend);
+# ifndef __loongarch_soft_float
+		if (RTLD_SUPPORT_LASX)
+		  td->entry = _dl_tlsdesc_dynamic_lasx;
+		else if (RTLD_SUPPORT_LSX)
+		  td->entry = _dl_tlsdesc_dynamic_lsx;
+		else
+# endif
 		td->entry = _dl_tlsdesc_dynamic;
 	      }
 	    else