about summary refs log tree commit diff
path: root/sysdeps/loongarch/Makefile
diff options
context:
space:
mode:
authormengqinggang <mengqinggang@loongson.cn>2024-05-08 10:06:15 +0800
committercaiyinyu <caiyinyu@loongson.cn>2024-05-15 10:31:53 +0800
commit1dbf2bef7934cee9829d875f11968d6ff1fee77f (patch)
treed9e2a0c544e5a7468bfc5149613155f2d2d4efdf /sysdeps/loongarch/Makefile
parentf942a732d37a96217ef828116ebe64a644db18d7 (diff)
downloadglibc-1dbf2bef7934cee9829d875f11968d6ff1fee77f.tar.gz
glibc-1dbf2bef7934cee9829d875f11968d6ff1fee77f.tar.xz
glibc-1dbf2bef7934cee9829d875f11968d6ff1fee77f.zip
LoongArch: Add support for TLS Descriptors
This is mostly based on AArch64 and RISC-V implementation.

Add R_LARCH_TLS_DESC32 and R_LARCH_TLS_DESC64 relocations.

For _dl_tlsdesc_dynamic function slow path, temporarily save and restore
all vector registers.
Diffstat (limited to 'sysdeps/loongarch/Makefile')
-rw-r--r--sysdeps/loongarch/Makefile34
1 files changed, 30 insertions, 4 deletions
diff --git a/sysdeps/loongarch/Makefile b/sysdeps/loongarch/Makefile
index 446bda6563..a4ee915eff 100644
--- a/sysdeps/loongarch/Makefile
+++ b/sysdeps/loongarch/Makefile
@@ -1,5 +1,7 @@
 ifeq ($(subdir),misc)
-sysdep_headers += sys/asm.h
+sysdep_headers += \
+  sys/asm.h \
+  # sysdep_headers
 
 tests += \
   tst-hwcap-tunables \
@@ -9,21 +11,45 @@ tst-hwcap-tunables-ARGS = -- $(host-test-program-cmd)
 endif
 
 ifeq ($(subdir),elf)
-gen-as-const-headers += dl-link.sym
+sysdep-dl-routines += \
+  dl-tlsdesc \
+  tlsdesc \
+  # sysdep-dl-routines
+
+gen-as-const-headers += \
+  dl-link.sym \
+  # gen-as-const-headers
+endif
+
+ifeq ($(subdir),csu)
+gen-as-const-headers += \
+  tlsdesc.sym \
+  # gen-as-const-headers
 endif
 
 ifeq ($(subdir),elf)
 sysdep-dl-routines += \
   dl-get-cpu-features \
   # sysdep-dl-routines
+
+# Disable the compiler from using LSX for TLS descriptor tests, or storing into
+# 16B TLS variable may clobber FP/vector registers and prevent us from checking
+# their contents.
+CFLAGS-tst-gnu2-tls2mod0.c += -mno-lsx
+CFLAGS-tst-gnu2-tls2mod1.c += -mno-lsx
+CFLAGS-tst-gnu2-tls2mod2.c += -mno-lsx
 endif
 
 # LoongArch's assembler also needs to know about PIC as it changes the
 # definition of some assembler macros.
-ASFLAGS-.os += $(pic-ccflag)
+ASFLAGS-.os += \
+  $(pic-ccflag) \
+  # ASFLAGS-.os
 
 # All the objects in lib*_nonshared.a need to be compiled with medium code
 # model or large applications may fail to link.
 ifeq (yes,$(have-cmodel-medium))
-CFLAGS-.oS += -mcmodel=medium
+CFLAGS-.oS += \
+  -mcmodel=medium \
+  # CFLAGS-.oS
 endif