From c07ae520f10f01218640ae2a1f74fd01a4136e1b Mon Sep 17 00:00:00 2001
From: mengqinggang <mengqinggang@loongson.cn>
Date: Mon, 2 Sep 2024 09:51:04 +0800
Subject: [PATCH 11/15] LoongArch: Fix macro redefined warning in tls-desc.S

Undef macro to avoid redefined warning.
---
 sysdeps/loongarch/dl-tlsdesc-dynamic.h |  9 +++------
 sysdeps/loongarch/dl-tlsdesc.S         | 12 ++++++++++++
 2 files changed, 15 insertions(+), 6 deletions(-)

diff --git a/sysdeps/loongarch/dl-tlsdesc-dynamic.h b/sysdeps/loongarch/dl-tlsdesc-dynamic.h
index d10f4a88..3daf9910 100644
--- a/sysdeps/loongarch/dl-tlsdesc-dynamic.h
+++ b/sysdeps/loongarch/dl-tlsdesc-dynamic.h
@@ -19,9 +19,6 @@
    <https://www.gnu.org/licenses/>.  */
 
 #define FRAME_SIZE	  (-((-14 * SZREG) & ALMASK))
-#define FRAME_SIZE_LSX	  (-((-32 * SZVREG) & ALMASK))
-#define FRAME_SIZE_LASX	  (-((-32 * SZXREG) & ALMASK))
-#define FRAME_SIZE_FLOAT  (-((-24 * SZFREG) & ALMASK))
 
 	/* Handler for dynamic TLS symbols.
 	   Prototype:
@@ -155,7 +152,7 @@ Hign address	dynamic_block1 <----- dtv5  */
 #ifdef USE_LASX
   #define V_REG_S xvst
   #define V_REG_L xvld
-  #define V_SPACE FRAME_SIZE_LASX
+  #define V_SPACE (-((-32 * SZXREG) & ALMASK)) /* Space for LASX registers.  */
   #define V_REG(n) $xr##n
   #define V_REGS 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,  \
 		 17,18,19,20,21,22,23,24,25,26,27,28,29,30,31
@@ -163,7 +160,7 @@ Hign address	dynamic_block1 <----- dtv5  */
 #elif defined USE_LSX
   #define V_REG_S vst
   #define V_REG_L vld
-  #define V_SPACE FRAME_SIZE_LSX
+  #define V_SPACE (-((-32 * SZVREG) & ALMASK)) /* Space for LSX registers.  */
   #define V_REG(n) $vr##n
   #define V_REGS 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,  \
 		 17,18,19,20,21,22,23,24,25,26,27,28,29,30,31
@@ -171,7 +168,7 @@ Hign address	dynamic_block1 <----- dtv5  */
 #else
   #define V_REG_S fst.d
   #define V_REG_L fld.d
-  #define V_SPACE FRAME_SIZE_FLOAT
+  #define V_SPACE (-((-24 * SZFREG) & ALMASK)) /* Space for FLOAT registers.  */
   #define V_REG(n) $f##n
   #define V_REGS 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23
   #define V_REGSZ SZFREG
diff --git a/sysdeps/loongarch/dl-tlsdesc.S b/sysdeps/loongarch/dl-tlsdesc.S
index b6cfd612..be76c07c 100644
--- a/sysdeps/loongarch/dl-tlsdesc.S
+++ b/sysdeps/loongarch/dl-tlsdesc.S
@@ -69,6 +69,12 @@ _dl_tlsdesc_undefweak:
 #define Lslow Lslow_lasx
 #include "dl-tlsdesc-dynamic.h"
 #undef FRAME_SIZE
+#undef V_REG_S
+#undef V_REG_L
+#undef V_SPACE
+#undef V_REG
+#undef V_REGS
+#undef V_REGSZ
 #undef USE_LASX
 #undef _dl_tlsdesc_dynamic
 #undef Lret
@@ -80,6 +86,12 @@ _dl_tlsdesc_undefweak:
 #define Lslow Lslow_lsx
 #include "dl-tlsdesc-dynamic.h"
 #undef FRAME_SIZE
+#undef V_REG_S
+#undef V_REG_L
+#undef V_SPACE
+#undef V_REG
+#undef V_REGS
+#undef V_REGSZ
 #undef USE_LSX
 #undef _dl_tlsdesc_dynamic
 #undef Lret
-- 
2.43.0

