[PATCH] LoongArch: gas: Start a new frag after instructions that can be relaxed

mengqinggang mengqinggang@loongson.cn
Sun Jan 21 03:23:26 GMT 2024
For R_LARCH_TLS_{LE_HI20_R,LE_ADD_R,IE_PC_HI20,LD_PC_HI20,GD_PC_HI20,
TLS_DESC_PC_HI20} relocations, start a new frag to get correct eh_frame info.
---
 gas/config/tc-loongarch.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/gas/config/tc-loongarch.c b/gas/config/tc-loongarch.c
index 863ac9cea43..47ec8441a3b 100644
--- a/gas/config/tc-loongarch.c
+++ b/gas/config/tc-loongarch.c
@@ -1089,7 +1089,13 @@ append_fixp_and_insn (struct loongarch_cl_insn *ip)
      if (symbol_get_frag (to) == symbol_get_frag (from)))  */
   if (LARCH_opts.relax
       && (BFD_RELOC_LARCH_PCALA_HI20 == reloc_info[0].type
-	  || BFD_RELOC_LARCH_GOT_PC_HI20 == reloc_info[0].type))
+	  || BFD_RELOC_LARCH_GOT_PC_HI20 == reloc_info[0].type
+	  || BFD_RELOC_LARCH_TLS_LE_HI20_R == reloc_info[0].type
+	  || BFD_RELOC_LARCH_TLS_LE_ADD_R == reloc_info[0].type
+	  || BFD_RELOC_LARCH_TLS_IE_PC_HI20 == reloc_info[0].type
+	  || BFD_RELOC_LARCH_TLS_LD_PC_HI20 == reloc_info[0].type
+	  || BFD_RELOC_LARCH_TLS_GD_PC_HI20 == reloc_info[0].type
+	  || BFD_RELOC_LARCH_TLS_DESC_PC_HI20 == reloc_info[0].type))
     {
       frag_wane (frag_now);
       frag_new (0);
-- 
2.36.0



More information about the Binutils mailing list