aboutsummaryrefslogtreecommitdiff
path: root/gas/config/tc-loongarch.c
diff options
context:
space:
mode:
authormengqinggang <mengqinggang@loongson.cn>2024-01-18 19:03:11 +0800
committerliuzhensong <liuzhensong@loongson.cn>2024-01-24 16:32:40 +0800
commit601c741d5ce6cae53dad8b19da8ed9c5cae4b797 (patch)
tree7c8c4b9d41c55d68b8bd556bfa45ac0ab0d0fcfe /gas/config/tc-loongarch.c
parent27a750dd896cfc13f4368e4c8df14e6ea5bb718f (diff)
downloadgdb-601c741d5ce6cae53dad8b19da8ed9c5cae4b797.zip
gdb-601c741d5ce6cae53dad8b19da8ed9c5cae4b797.tar.gz
gdb-601c741d5ce6cae53dad8b19da8ed9c5cae4b797.tar.bz2
LoongArch: gas: Start a new frag after instructions that can be relaxed
For R_LARCH_TLS_{LE_HI20_R,LE_ADD_R,LD_PC_HI20,GD_PC_HI20, DESC_PC_HI20} relocations, start a new frag to get correct eh_frame Call Frame Information FDE DW_CFA_advance_loc info.
Diffstat (limited to 'gas/config/tc-loongarch.c')
-rw-r--r--gas/config/tc-loongarch.c19
1 files changed, 14 insertions, 5 deletions
diff --git a/gas/config/tc-loongarch.c b/gas/config/tc-loongarch.c
index 3c7d400..e6a9901 100644
--- a/gas/config/tc-loongarch.c
+++ b/gas/config/tc-loongarch.c
@@ -1070,13 +1070,22 @@ append_fixp_and_insn (struct loongarch_cl_insn *ip)
optimized away or compressed by the linker during relaxation, to prevent
the assembler from computing static offsets across such an instruction.
- This is necessary to get correct .eh_frame cfa info. If one cfa's two
- symbol is not in the same frag, it will generate relocs to calculate
- symbol subtraction. (gas/dw2gencfi.c:output_cfi_insn:
- if (symbol_get_frag (to) == symbol_get_frag (from))) */
+ This is necessary to get correct .eh_frame FDE DW_CFA_advance_loc info.
+ If one cfi_insn_data's two symbols are not in the same frag, it will
+ generate ADD and SUB relocations pairs to calculate DW_CFA_advance_loc.
+ (gas/dw2gencfi.c: output_cfi_insn:
+ if (symbol_get_frag (to) == symbol_get_frag (from)))
+
+ For macro instructions, only the first instruction expanded from macro
+ need to start a new frag. */
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_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);