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

Message ID 20240121032326.1952820-1-mengqinggang@loongson.cn
State Unresolved
Headers
Series LoongArch: gas: Start a new frag after instructions that can be relaxed |

Checks

Context Check Description
snail/binutils-gdb-check warning Git am fail log

Commit Message

mengqinggang Jan. 21, 2024, 3:23 a.m. UTC
  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(-)
  

Patch

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);