@@ -8797,6 +8797,26 @@ init_dwarf_regnames_riscv (void)
dwarf_regnames_lookup_func = regname_internal_riscv;
}
+static const char *const dwarf_regnames_loongarch[] =
+{
+ "$zero", "$ra", "$tp", "$sp", "$a0", "$a1", "$a2", "$a3", /* 0 - 7 */
+ "$a4", "$a5", "$a6", "$a7", "$t0", "$t1", "$t2", "$t3", /* 8 - 15 */
+ "$t4", "$t5", "$t6", "$t7", "$t8", "$r21","$fp", "$s0", /* 16 - 23 */
+ "$s1", "$s2", "$s3", "$s4", "$s5", "$s6", "$s7", "$s8", /* 24 - 31 */
+ "$fa0", "$fa1", "$fa2", "$fa3", "$fa4", "$fa5", "$fa6", "$fa7",
+ "$ft0", "$ft1", "$ft2", "$ft3", "$ft4", "$ft5", "$ft6", "$ft7",
+ "$ft8", "$ft9", "$ft10", "$ft11", "$ft12", "$ft13", "$ft14", "$ft15",
+ "$fs0", "$fs1", "$fs2", "$fs3", "$fs4", "$fs5", "$fs6", "$fs7",
+};
+
+static void
+init_dwarf_regnames_loongarch (void)
+{
+ dwarf_regnames = dwarf_regnames_loongarch;
+ dwarf_regnames_count = ARRAY_SIZE (dwarf_regnames_loongarch);
+ dwarf_regnames_lookup_func = regname_internal_by_table_only;
+}
+
void
init_dwarf_regnames_by_elf_machine_code (unsigned int e_machine)
{
@@ -8831,6 +8851,10 @@ init_dwarf_regnames_by_elf_machine_code (unsigned int e_machine)
init_dwarf_regnames_riscv ();
break;
+ case EM_LOONGARCH:
+ init_dwarf_regnames_loongarch ();
+ break;
+
default:
break;
}
@@ -8880,6 +8904,10 @@ init_dwarf_regnames_by_bfd_arch_and_mach (enum bfd_architecture arch,
init_dwarf_regnames_riscv ();
break;
+ case bfd_arch_loongarch:
+ init_dwarf_regnames_loongarch ();
+ break;
+
default:
break;
}
@@ -276,6 +276,8 @@ static struct htab *c_htab = NULL;
static struct htab *cr_htab = NULL;
static struct htab *v_htab = NULL;
static struct htab *x_htab = NULL;
+static struct htab *cfi_r_htab = NULL;
+static struct htab *cfi_f_htab = NULL;
void
loongarch_after_parse_args ()
@@ -322,15 +324,27 @@ loongarch_after_parse_args ()
if (!r_deprecated_htab)
r_deprecated_htab = str_htab_create (),
str_hash_insert (r_deprecated_htab, "", 0, 0);
+ /* Init cfi registers alias. */
+ if (!cfi_r_htab)
+ cfi_r_htab = str_htab_create (), str_hash_insert (cfi_r_htab, "", 0, 0);
r_abi_names = loongarch_r_normal_name;
for (i = 0; i < ARRAY_SIZE (loongarch_r_normal_name); i++)
- str_hash_insert (r_htab, loongarch_r_normal_name[i], (void *) (i + 1), 0);
-
+ {
+ str_hash_insert (r_htab, loongarch_r_normal_name[i],
+ (void *) (i + 1), 0);
+ str_hash_insert (cfi_r_htab, loongarch_r_normal_name[i],
+ (void *) (i + 1), 0);
+ }
/* Init ilp32/lp64 registers alias. */
r_abi_names = loongarch_r_alias;
for (i = 0; i < ARRAY_SIZE (loongarch_r_alias); i++)
- str_hash_insert (r_htab, loongarch_r_alias[i], (void *) (i + 1), 0);
+ {
+ str_hash_insert (r_htab, loongarch_r_alias[i],
+ (void *) (i + 1), 0);
+ str_hash_insert (cfi_r_htab, loongarch_r_alias[i],
+ (void *) (i + 1), 0);
+ }
for (i = 0; i < ARRAY_SIZE (loongarch_r_alias_1); i++)
str_hash_insert (r_htab, loongarch_r_alias_1[i], (void *) (i + 1), 0);
@@ -339,6 +353,15 @@ loongarch_after_parse_args ()
str_hash_insert (r_deprecated_htab, loongarch_r_alias_deprecated[i],
(void *) (i + 1), 0);
+ /* The .cfi directive supports register aliases without the "$" prefix. */
+ for (i = 0; i < ARRAY_SIZE (loongarch_r_cfi_name); i++)
+ {
+ str_hash_insert (cfi_r_htab, loongarch_r_cfi_name[i],
+ (void *)(i + 1), 0);
+ str_hash_insert (cfi_r_htab, loongarch_r_cfi_name_alias[i],
+ (void *)(i + 1), 0);
+ }
+
if (!cr_htab)
cr_htab = str_htab_create (), str_hash_insert (cr_htab, "", 0, 0);
@@ -353,21 +376,39 @@ loongarch_after_parse_args ()
if (!f_deprecated_htab)
f_deprecated_htab = str_htab_create (),
str_hash_insert (f_deprecated_htab, "", 0, 0);
+ if (!cfi_f_htab)
+ cfi_f_htab = str_htab_create (), str_hash_insert (cfi_f_htab, "", 0, 0);
f_abi_names = loongarch_f_normal_name;
for (i = 0; i < ARRAY_SIZE (loongarch_f_normal_name); i++)
- str_hash_insert (f_htab, loongarch_f_normal_name[i], (void *) (i + 1),
- 0);
-
+ {
+ str_hash_insert (f_htab, loongarch_f_normal_name[i],
+ (void *) (i + 1), 0);
+ str_hash_insert (cfi_f_htab, loongarch_f_normal_name[i],
+ (void *) (i + 1), 0);
+ }
/* Init float-ilp32/lp64 registers alias. */
f_abi_names = loongarch_f_alias;
for (i = 0; i < ARRAY_SIZE (loongarch_f_alias); i++)
- str_hash_insert (f_htab, loongarch_f_alias[i],
- (void *) (i + 1), 0);
+ {
+ str_hash_insert (f_htab, loongarch_f_alias[i],
+ (void *) (i + 1), 0);
+ str_hash_insert (cfi_f_htab, loongarch_f_alias[i],
+ (void *) (i + 1), 0);
+ }
for (i = 0; i < ARRAY_SIZE (loongarch_f_alias_deprecated); i++)
str_hash_insert (f_deprecated_htab, loongarch_f_alias_deprecated[i],
(void *) (i + 1), 0);
+ /* The .cfi directive supports register aliases without the "$" prefix. */
+ for (i = 0; i < ARRAY_SIZE (loongarch_f_cfi_name); i++)
+ {
+ str_hash_insert (cfi_f_htab, loongarch_f_cfi_name[i],
+ (void *)(i + 1), 0);
+ str_hash_insert (cfi_f_htab, loongarch_f_cfi_name_alias[i],
+ (void *)(i + 1), 0);
+ }
+
if (!fc_htab)
fc_htab = str_htab_create (), str_hash_insert (fc_htab, "", 0, 0);
@@ -1864,6 +1905,46 @@ loongarch_cfi_frame_initial_instructions (void)
cfi_add_CFA_def_cfa_register (3 /* $sp */);
}
+/* Convert REGNAME to a DWARF register number. */
+int
+tc_loongarch_regname_to_dw2regnum (char *regname)
+{
+ int reg;
+
+ /* Look up in the general purpose register table. */
+ if ((reg = (intptr_t) str_hash_find (cfi_r_htab, regname)) > 0)
+ return reg - 1;
+
+ /* Look up in the floating point register table. */
+ if ((reg = (intptr_t) str_hash_find (cfi_f_htab, regname)) > 0)
+ return reg + 31;
+
+ as_bad (_("unknown register `%s`"), regname);
+ return -1;
+}
+
+/* Derived from tc_parse_to_dw2regnum, but excluding the case where
+ the prefix '%'. */
+void
+tc_loongarch_parse_to_dw2regnum (expressionS *exp)
+{
+ SKIP_WHITESPACE ();
+ if (is_name_beginner (*input_line_pointer))
+ {
+ char *name, c;
+
+ c = get_symbol_name (& name);
+
+ exp->X_op = O_constant;
+ exp->X_add_number = tc_loongarch_regname_to_dw2regnum (name);
+
+ restore_line_pointer (c);
+ }
+ else
+ expression_and_evaluate (exp);
+}
+
+
void
loongarch_pre_output_hook (void)
{
@@ -1909,12 +1990,6 @@ loongarch_pre_output_hook (void)
subseg_set (seg, subseg);
}
-void
-tc_loongarch_parse_to_dw2regnum (expressionS *exp)
-{
- expression_and_evaluate (exp);
-}
-
void
md_show_usage (FILE *stream)
{
@@ -124,13 +124,15 @@ extern int loongarch_force_relocation (struct fix *);
loongarch_cfi_frame_initial_instructions
extern void loongarch_cfi_frame_initial_instructions (void);
+#define tc_parse_to_dw2regnum tc_loongarch_parse_to_dw2regnum
+extern void tc_loongarch_parse_to_dw2regnum (expressionS *);
+
+extern int tc_loongarch_regname_to_dw2regnum (char *);
+
#define tc_symbol_new_hook(sym) \
if (0 == strcmp (sym->bsym->name, FAKE_LABEL_NAME)) \
S_SET_OTHER (sym, STV_HIDDEN);
-#define tc_parse_to_dw2regnum tc_loongarch_parse_to_dw2regnum
-extern void tc_loongarch_parse_to_dw2regnum (expressionS *);
-
extern void loongarch_pre_output_hook (void);
#define md_pre_output_hook loongarch_pre_output_hook ()
#define GAS_SORT_RELOCS 1
new file mode 100644
@@ -0,0 +1,274 @@
+#objdump: --dwarf=frames
+
+.*: file format .*
+
+Contents of the .* section:
+
+
+00000000 [a-zA-Z0-9]+ 0[a-zA-Z0-9]+ CIE
+ Version: .*
+ Augmentation: .*
+ Code alignment factor: .*
+ Data alignment factor: .*
+ Return address column: .*
+ Augmentation data: .*
+#...
+[a-zA-Z0-9]+ [a-zA-Z0-9]+ [a-zA-Z0-9]+ FDE cie=00000000 pc=[a-zA-Z0-9]+\.\.[a-zA-Z0-9]+
+ DW_CFA_advance_loc: 4 to 0000000000000020
+ DW_CFA_offset_extended_sf: r0 \(\$zero\) at cfa\+8
+ DW_CFA_offset_extended_sf: r1 \(\$ra\) at cfa\+16
+ DW_CFA_offset_extended_sf: r2 \(\$tp\) at cfa\+24
+ DW_CFA_offset_extended_sf: r3 \(\$sp\) at cfa\+32
+ DW_CFA_offset_extended_sf: r4 \(\$a0\) at cfa\+40
+ DW_CFA_offset_extended_sf: r5 \(\$a1\) at cfa\+48
+ DW_CFA_offset_extended_sf: r6 \(\$a2\) at cfa\+56
+ DW_CFA_offset_extended_sf: r7 \(\$a3\) at cfa\+64
+ DW_CFA_offset_extended_sf: r8 \(\$a4\) at cfa\+72
+ DW_CFA_offset_extended_sf: r9 \(\$a5\) at cfa\+80
+ DW_CFA_offset_extended_sf: r10 \(\$a6\) at cfa\+88
+ DW_CFA_offset_extended_sf: r11 \(\$a7\) at cfa\+96
+ DW_CFA_offset_extended_sf: r12 \(\$t0\) at cfa\+104
+ DW_CFA_offset_extended_sf: r13 \(\$t1\) at cfa\+112
+ DW_CFA_offset_extended_sf: r14 \(\$t2\) at cfa\+120
+ DW_CFA_offset_extended_sf: r15 \(\$t3\) at cfa\+128
+ DW_CFA_offset_extended_sf: r16 \(\$t4\) at cfa\+136
+ DW_CFA_offset_extended_sf: r17 \(\$t5\) at cfa\+144
+ DW_CFA_offset_extended_sf: r18 \(\$t6\) at cfa\+152
+ DW_CFA_offset_extended_sf: r19 \(\$t7\) at cfa\+160
+ DW_CFA_offset_extended_sf: r20 \(\$t8\) at cfa\+168
+ DW_CFA_offset_extended_sf: r21 \(\$r21\) at cfa\+176
+ DW_CFA_offset_extended_sf: r22 \(\$fp\) at cfa\+184
+ DW_CFA_offset_extended_sf: r23 \(\$s0\) at cfa\+192
+ DW_CFA_offset_extended_sf: r24 \(\$s1\) at cfa\+200
+ DW_CFA_offset_extended_sf: r25 \(\$s2\) at cfa\+208
+ DW_CFA_offset_extended_sf: r26 \(\$s3\) at cfa\+216
+ DW_CFA_offset_extended_sf: r27 \(\$s4\) at cfa\+224
+ DW_CFA_offset_extended_sf: r28 \(\$s5\) at cfa\+232
+ DW_CFA_offset_extended_sf: r29 \(\$s6\) at cfa\+240
+ DW_CFA_offset_extended_sf: r30 \(\$s7\) at cfa\+248
+ DW_CFA_offset_extended_sf: r31 \(\$s8\) at cfa\+256
+ DW_CFA_offset_extended_sf: r0 \(\$zero\) at cfa\+8
+ DW_CFA_offset_extended_sf: r1 \(\$ra\) at cfa\+16
+ DW_CFA_offset_extended_sf: r2 \(\$tp\) at cfa\+24
+ DW_CFA_offset_extended_sf: r3 \(\$sp\) at cfa\+32
+ DW_CFA_offset_extended_sf: r4 \(\$a0\) at cfa\+40
+ DW_CFA_offset_extended_sf: r5 \(\$a1\) at cfa\+48
+ DW_CFA_offset_extended_sf: r6 \(\$a2\) at cfa\+56
+ DW_CFA_offset_extended_sf: r7 \(\$a3\) at cfa\+64
+ DW_CFA_offset_extended_sf: r8 \(\$a4\) at cfa\+72
+ DW_CFA_offset_extended_sf: r9 \(\$a5\) at cfa\+80
+ DW_CFA_offset_extended_sf: r10 \(\$a6\) at cfa\+88
+ DW_CFA_offset_extended_sf: r11 \(\$a7\) at cfa\+96
+ DW_CFA_offset_extended_sf: r12 \(\$t0\) at cfa\+104
+ DW_CFA_offset_extended_sf: r13 \(\$t1\) at cfa\+112
+ DW_CFA_offset_extended_sf: r14 \(\$t2\) at cfa\+120
+ DW_CFA_offset_extended_sf: r15 \(\$t3\) at cfa\+128
+ DW_CFA_offset_extended_sf: r16 \(\$t4\) at cfa\+136
+ DW_CFA_offset_extended_sf: r17 \(\$t5\) at cfa\+144
+ DW_CFA_offset_extended_sf: r18 \(\$t6\) at cfa\+152
+ DW_CFA_offset_extended_sf: r19 \(\$t7\) at cfa\+160
+ DW_CFA_offset_extended_sf: r20 \(\$t8\) at cfa\+168
+ DW_CFA_offset_extended_sf: r21 \(\$r21\) at cfa\+176
+ DW_CFA_offset_extended_sf: r22 \(\$fp\) at cfa\+184
+ DW_CFA_offset_extended_sf: r23 \(\$s0\) at cfa\+192
+ DW_CFA_offset_extended_sf: r24 \(\$s1\) at cfa\+200
+ DW_CFA_offset_extended_sf: r25 \(\$s2\) at cfa\+208
+ DW_CFA_offset_extended_sf: r26 \(\$s3\) at cfa\+216
+ DW_CFA_offset_extended_sf: r27 \(\$s4\) at cfa\+224
+ DW_CFA_offset_extended_sf: r28 \(\$s5\) at cfa\+232
+ DW_CFA_offset_extended_sf: r29 \(\$s6\) at cfa\+240
+ DW_CFA_offset_extended_sf: r30 \(\$s7\) at cfa\+248
+ DW_CFA_offset_extended_sf: r31 \(\$s8\) at cfa\+256
+ DW_CFA_offset_extended_sf: r0 \(\$zero\) at cfa\+8
+ DW_CFA_offset_extended_sf: r1 \(\$ra\) at cfa\+16
+ DW_CFA_offset_extended_sf: r2 \(\$tp\) at cfa\+24
+ DW_CFA_offset_extended_sf: r3 \(\$sp\) at cfa\+32
+ DW_CFA_offset_extended_sf: r4 \(\$a0\) at cfa\+40
+ DW_CFA_offset_extended_sf: r5 \(\$a1\) at cfa\+48
+ DW_CFA_offset_extended_sf: r6 \(\$a2\) at cfa\+56
+ DW_CFA_offset_extended_sf: r7 \(\$a3\) at cfa\+64
+ DW_CFA_offset_extended_sf: r8 \(\$a4\) at cfa\+72
+ DW_CFA_offset_extended_sf: r9 \(\$a5\) at cfa\+80
+ DW_CFA_offset_extended_sf: r10 \(\$a6\) at cfa\+88
+ DW_CFA_offset_extended_sf: r11 \(\$a7\) at cfa\+96
+ DW_CFA_offset_extended_sf: r12 \(\$t0\) at cfa\+104
+ DW_CFA_offset_extended_sf: r13 \(\$t1\) at cfa\+112
+ DW_CFA_offset_extended_sf: r14 \(\$t2\) at cfa\+120
+ DW_CFA_offset_extended_sf: r15 \(\$t3\) at cfa\+128
+ DW_CFA_offset_extended_sf: r16 \(\$t4\) at cfa\+136
+ DW_CFA_offset_extended_sf: r17 \(\$t5\) at cfa\+144
+ DW_CFA_offset_extended_sf: r18 \(\$t6\) at cfa\+152
+ DW_CFA_offset_extended_sf: r19 \(\$t7\) at cfa\+160
+ DW_CFA_offset_extended_sf: r20 \(\$t8\) at cfa\+168
+ DW_CFA_offset_extended_sf: r21 \(\$r21\) at cfa\+176
+ DW_CFA_offset_extended_sf: r22 \(\$fp\) at cfa\+184
+ DW_CFA_offset_extended_sf: r23 \(\$s0\) at cfa\+192
+ DW_CFA_offset_extended_sf: r24 \(\$s1\) at cfa\+200
+ DW_CFA_offset_extended_sf: r25 \(\$s2\) at cfa\+208
+ DW_CFA_offset_extended_sf: r26 \(\$s3\) at cfa\+216
+ DW_CFA_offset_extended_sf: r27 \(\$s4\) at cfa\+224
+ DW_CFA_offset_extended_sf: r28 \(\$s5\) at cfa\+232
+ DW_CFA_offset_extended_sf: r29 \(\$s6\) at cfa\+240
+ DW_CFA_offset_extended_sf: r30 \(\$s7\) at cfa\+248
+ DW_CFA_offset_extended_sf: r31 \(\$s8\) at cfa\+256
+ DW_CFA_offset_extended_sf: r0 \(\$zero\) at cfa\+8
+ DW_CFA_offset_extended_sf: r1 \(\$ra\) at cfa\+16
+ DW_CFA_offset_extended_sf: r2 \(\$tp\) at cfa\+24
+ DW_CFA_offset_extended_sf: r3 \(\$sp\) at cfa\+32
+ DW_CFA_offset_extended_sf: r4 \(\$a0\) at cfa\+40
+ DW_CFA_offset_extended_sf: r5 \(\$a1\) at cfa\+48
+ DW_CFA_offset_extended_sf: r6 \(\$a2\) at cfa\+56
+ DW_CFA_offset_extended_sf: r7 \(\$a3\) at cfa\+64
+ DW_CFA_offset_extended_sf: r8 \(\$a4\) at cfa\+72
+ DW_CFA_offset_extended_sf: r9 \(\$a5\) at cfa\+80
+ DW_CFA_offset_extended_sf: r10 \(\$a6\) at cfa\+88
+ DW_CFA_offset_extended_sf: r11 \(\$a7\) at cfa\+96
+ DW_CFA_offset_extended_sf: r12 \(\$t0\) at cfa\+104
+ DW_CFA_offset_extended_sf: r13 \(\$t1\) at cfa\+112
+ DW_CFA_offset_extended_sf: r14 \(\$t2\) at cfa\+120
+ DW_CFA_offset_extended_sf: r15 \(\$t3\) at cfa\+128
+ DW_CFA_offset_extended_sf: r16 \(\$t4\) at cfa\+136
+ DW_CFA_offset_extended_sf: r17 \(\$t5\) at cfa\+144
+ DW_CFA_offset_extended_sf: r18 \(\$t6\) at cfa\+152
+ DW_CFA_offset_extended_sf: r19 \(\$t7\) at cfa\+160
+ DW_CFA_offset_extended_sf: r20 \(\$t8\) at cfa\+168
+ DW_CFA_offset_extended_sf: r21 \(\$r21\) at cfa\+176
+ DW_CFA_offset_extended_sf: r22 \(\$fp\) at cfa\+184
+ DW_CFA_offset_extended_sf: r23 \(\$s0\) at cfa\+192
+ DW_CFA_offset_extended_sf: r24 \(\$s1\) at cfa\+200
+ DW_CFA_offset_extended_sf: r25 \(\$s2\) at cfa\+208
+ DW_CFA_offset_extended_sf: r26 \(\$s3\) at cfa\+216
+ DW_CFA_offset_extended_sf: r27 \(\$s4\) at cfa\+224
+ DW_CFA_offset_extended_sf: r28 \(\$s5\) at cfa\+232
+ DW_CFA_offset_extended_sf: r29 \(\$s6\) at cfa\+240
+ DW_CFA_offset_extended_sf: r30 \(\$s7\) at cfa\+248
+ DW_CFA_offset_extended_sf: r31 \(\$s8\) at cfa\+256
+ DW_CFA_offset_extended_sf: r32 \(\$fa0\) at cfa\+264
+ DW_CFA_offset_extended_sf: r33 \(\$fa1\) at cfa\+272
+ DW_CFA_offset_extended_sf: r34 \(\$fa2\) at cfa\+280
+ DW_CFA_offset_extended_sf: r35 \(\$fa3\) at cfa\+288
+ DW_CFA_offset_extended_sf: r36 \(\$fa4\) at cfa\+296
+ DW_CFA_offset_extended_sf: r37 \(\$fa5\) at cfa\+304
+ DW_CFA_offset_extended_sf: r38 \(\$fa6\) at cfa\+312
+ DW_CFA_offset_extended_sf: r39 \(\$fa7\) at cfa\+320
+ DW_CFA_offset_extended_sf: r40 \(\$ft0\) at cfa\+328
+ DW_CFA_offset_extended_sf: r41 \(\$ft1\) at cfa\+336
+ DW_CFA_offset_extended_sf: r42 \(\$ft2\) at cfa\+344
+ DW_CFA_offset_extended_sf: r43 \(\$ft3\) at cfa\+352
+ DW_CFA_offset_extended_sf: r44 \(\$ft4\) at cfa\+360
+ DW_CFA_offset_extended_sf: r45 \(\$ft5\) at cfa\+368
+ DW_CFA_offset_extended_sf: r46 \(\$ft6\) at cfa\+376
+ DW_CFA_offset_extended_sf: r47 \(\$ft7\) at cfa\+384
+ DW_CFA_offset_extended_sf: r48 \(\$ft8\) at cfa\+392
+ DW_CFA_offset_extended_sf: r49 \(\$ft9\) at cfa\+400
+ DW_CFA_offset_extended_sf: r50 \(\$ft10\) at cfa\+408
+ DW_CFA_offset_extended_sf: r51 \(\$ft11\) at cfa\+416
+ DW_CFA_offset_extended_sf: r52 \(\$ft12\) at cfa\+424
+ DW_CFA_offset_extended_sf: r53 \(\$ft13\) at cfa\+432
+ DW_CFA_offset_extended_sf: r54 \(\$ft14\) at cfa\+440
+ DW_CFA_offset_extended_sf: r55 \(\$ft15\) at cfa\+448
+ DW_CFA_offset_extended_sf: r56 \(\$fs0\) at cfa\+456
+ DW_CFA_offset_extended_sf: r57 \(\$fs1\) at cfa\+464
+ DW_CFA_offset_extended_sf: r58 \(\$fs2\) at cfa\+472
+ DW_CFA_offset_extended_sf: r59 \(\$fs3\) at cfa\+480
+ DW_CFA_offset_extended_sf: r60 \(\$fs4\) at cfa\+488
+ DW_CFA_offset_extended_sf: r61 \(\$fs5\) at cfa\+496
+ DW_CFA_offset_extended_sf: r62 \(\$fs6\) at cfa\+504
+ DW_CFA_offset_extended_sf: r63 \(\$fs7\) at cfa\+512
+ DW_CFA_offset_extended_sf: r32 \(\$fa0\) at cfa\+264
+ DW_CFA_offset_extended_sf: r33 \(\$fa1\) at cfa\+272
+ DW_CFA_offset_extended_sf: r34 \(\$fa2\) at cfa\+280
+ DW_CFA_offset_extended_sf: r35 \(\$fa3\) at cfa\+288
+ DW_CFA_offset_extended_sf: r36 \(\$fa4\) at cfa\+296
+ DW_CFA_offset_extended_sf: r37 \(\$fa5\) at cfa\+304
+ DW_CFA_offset_extended_sf: r38 \(\$fa6\) at cfa\+312
+ DW_CFA_offset_extended_sf: r39 \(\$fa7\) at cfa\+320
+ DW_CFA_offset_extended_sf: r40 \(\$ft0\) at cfa\+328
+ DW_CFA_offset_extended_sf: r41 \(\$ft1\) at cfa\+336
+ DW_CFA_offset_extended_sf: r42 \(\$ft2\) at cfa\+344
+ DW_CFA_offset_extended_sf: r43 \(\$ft3\) at cfa\+352
+ DW_CFA_offset_extended_sf: r44 \(\$ft4\) at cfa\+360
+ DW_CFA_offset_extended_sf: r45 \(\$ft5\) at cfa\+368
+ DW_CFA_offset_extended_sf: r46 \(\$ft6\) at cfa\+376
+ DW_CFA_offset_extended_sf: r47 \(\$ft7\) at cfa\+384
+ DW_CFA_offset_extended_sf: r48 \(\$ft8\) at cfa\+392
+ DW_CFA_offset_extended_sf: r49 \(\$ft9\) at cfa\+400
+ DW_CFA_offset_extended_sf: r50 \(\$ft10\) at cfa\+408
+ DW_CFA_offset_extended_sf: r51 \(\$ft11\) at cfa\+416
+ DW_CFA_offset_extended_sf: r52 \(\$ft12\) at cfa\+424
+ DW_CFA_offset_extended_sf: r53 \(\$ft13\) at cfa\+432
+ DW_CFA_offset_extended_sf: r54 \(\$ft14\) at cfa\+440
+ DW_CFA_offset_extended_sf: r55 \(\$ft15\) at cfa\+448
+ DW_CFA_offset_extended_sf: r56 \(\$fs0\) at cfa\+456
+ DW_CFA_offset_extended_sf: r57 \(\$fs1\) at cfa\+464
+ DW_CFA_offset_extended_sf: r58 \(\$fs2\) at cfa\+472
+ DW_CFA_offset_extended_sf: r59 \(\$fs3\) at cfa\+480
+ DW_CFA_offset_extended_sf: r60 \(\$fs4\) at cfa\+488
+ DW_CFA_offset_extended_sf: r61 \(\$fs5\) at cfa\+496
+ DW_CFA_offset_extended_sf: r62 \(\$fs6\) at cfa\+504
+ DW_CFA_offset_extended_sf: r63 \(\$fs7\) at cfa\+512
+ DW_CFA_offset_extended_sf: r32 \(\$fa0\) at cfa\+264
+ DW_CFA_offset_extended_sf: r33 \(\$fa1\) at cfa\+272
+ DW_CFA_offset_extended_sf: r34 \(\$fa2\) at cfa\+280
+ DW_CFA_offset_extended_sf: r35 \(\$fa3\) at cfa\+288
+ DW_CFA_offset_extended_sf: r36 \(\$fa4\) at cfa\+296
+ DW_CFA_offset_extended_sf: r37 \(\$fa5\) at cfa\+304
+ DW_CFA_offset_extended_sf: r38 \(\$fa6\) at cfa\+312
+ DW_CFA_offset_extended_sf: r39 \(\$fa7\) at cfa\+320
+ DW_CFA_offset_extended_sf: r40 \(\$ft0\) at cfa\+328
+ DW_CFA_offset_extended_sf: r41 \(\$ft1\) at cfa\+336
+ DW_CFA_offset_extended_sf: r42 \(\$ft2\) at cfa\+344
+ DW_CFA_offset_extended_sf: r43 \(\$ft3\) at cfa\+352
+ DW_CFA_offset_extended_sf: r44 \(\$ft4\) at cfa\+360
+ DW_CFA_offset_extended_sf: r45 \(\$ft5\) at cfa\+368
+ DW_CFA_offset_extended_sf: r46 \(\$ft6\) at cfa\+376
+ DW_CFA_offset_extended_sf: r47 \(\$ft7\) at cfa\+384
+ DW_CFA_offset_extended_sf: r48 \(\$ft8\) at cfa\+392
+ DW_CFA_offset_extended_sf: r49 \(\$ft9\) at cfa\+400
+ DW_CFA_offset_extended_sf: r50 \(\$ft10\) at cfa\+408
+ DW_CFA_offset_extended_sf: r51 \(\$ft11\) at cfa\+416
+ DW_CFA_offset_extended_sf: r52 \(\$ft12\) at cfa\+424
+ DW_CFA_offset_extended_sf: r53 \(\$ft13\) at cfa\+432
+ DW_CFA_offset_extended_sf: r54 \(\$ft14\) at cfa\+440
+ DW_CFA_offset_extended_sf: r55 \(\$ft15\) at cfa\+448
+ DW_CFA_offset_extended_sf: r56 \(\$fs0\) at cfa\+456
+ DW_CFA_offset_extended_sf: r57 \(\$fs1\) at cfa\+464
+ DW_CFA_offset_extended_sf: r58 \(\$fs2\) at cfa\+472
+ DW_CFA_offset_extended_sf: r59 \(\$fs3\) at cfa\+480
+ DW_CFA_offset_extended_sf: r60 \(\$fs4\) at cfa\+488
+ DW_CFA_offset_extended_sf: r61 \(\$fs5\) at cfa\+496
+ DW_CFA_offset_extended_sf: r62 \(\$fs6\) at cfa\+504
+ DW_CFA_offset_extended_sf: r63 \(\$fs7\) at cfa\+512
+ DW_CFA_offset_extended_sf: r32 \(\$fa0\) at cfa\+264
+ DW_CFA_offset_extended_sf: r33 \(\$fa1\) at cfa\+272
+ DW_CFA_offset_extended_sf: r34 \(\$fa2\) at cfa\+280
+ DW_CFA_offset_extended_sf: r35 \(\$fa3\) at cfa\+288
+ DW_CFA_offset_extended_sf: r36 \(\$fa4\) at cfa\+296
+ DW_CFA_offset_extended_sf: r37 \(\$fa5\) at cfa\+304
+ DW_CFA_offset_extended_sf: r38 \(\$fa6\) at cfa\+312
+ DW_CFA_offset_extended_sf: r39 \(\$fa7\) at cfa\+320
+ DW_CFA_offset_extended_sf: r40 \(\$ft0\) at cfa\+328
+ DW_CFA_offset_extended_sf: r41 \(\$ft1\) at cfa\+336
+ DW_CFA_offset_extended_sf: r42 \(\$ft2\) at cfa\+344
+ DW_CFA_offset_extended_sf: r43 \(\$ft3\) at cfa\+352
+ DW_CFA_offset_extended_sf: r44 \(\$ft4\) at cfa\+360
+ DW_CFA_offset_extended_sf: r45 \(\$ft5\) at cfa\+368
+ DW_CFA_offset_extended_sf: r46 \(\$ft6\) at cfa\+376
+ DW_CFA_offset_extended_sf: r47 \(\$ft7\) at cfa\+384
+ DW_CFA_offset_extended_sf: r48 \(\$ft8\) at cfa\+392
+ DW_CFA_offset_extended_sf: r49 \(\$ft9\) at cfa\+400
+ DW_CFA_offset_extended_sf: r50 \(\$ft10\) at cfa\+408
+ DW_CFA_offset_extended_sf: r51 \(\$ft11\) at cfa\+416
+ DW_CFA_offset_extended_sf: r52 \(\$ft12\) at cfa\+424
+ DW_CFA_offset_extended_sf: r53 \(\$ft13\) at cfa\+432
+ DW_CFA_offset_extended_sf: r54 \(\$ft14\) at cfa\+440
+ DW_CFA_offset_extended_sf: r55 \(\$ft15\) at cfa\+448
+ DW_CFA_offset_extended_sf: r56 \(\$fs0\) at cfa\+456
+ DW_CFA_offset_extended_sf: r57 \(\$fs1\) at cfa\+464
+ DW_CFA_offset_extended_sf: r58 \(\$fs2\) at cfa\+472
+ DW_CFA_offset_extended_sf: r59 \(\$fs3\) at cfa\+480
+ DW_CFA_offset_extended_sf: r60 \(\$fs4\) at cfa\+488
+ DW_CFA_offset_extended_sf: r61 \(\$fs5\) at cfa\+496
+ DW_CFA_offset_extended_sf: r62 \(\$fs6\) at cfa\+504
+ DW_CFA_offset_extended_sf: r63 \(\$fs7\) at cfa\+512
+#...
new file mode 100644
@@ -0,0 +1,281 @@
+# Check whether CFI directives can access all register names.
+ .text
+ .globl _start
+_start:
+ .cfi_startproc
+ nop
+
+ # ABI GPRs name
+ .cfi_offset $r0, 8
+ .cfi_offset $r1, 16
+ .cfi_offset $r2, 24
+ .cfi_offset $r3, 32
+ .cfi_offset $r4, 40
+ .cfi_offset $r5, 48
+ .cfi_offset $r6, 56
+ .cfi_offset $r7, 64
+ .cfi_offset $r8, 72
+ .cfi_offset $r9, 80
+ .cfi_offset $r10,88
+ .cfi_offset $r11,96
+ .cfi_offset $r12,104
+ .cfi_offset $r13,112
+ .cfi_offset $r14,120
+ .cfi_offset $r15,128
+ .cfi_offset $r16,136
+ .cfi_offset $r17,144
+ .cfi_offset $r18,152
+ .cfi_offset $r19,160
+ .cfi_offset $r20,168
+ .cfi_offset $r21,176
+ .cfi_offset $r22,184
+ .cfi_offset $r23,192
+ .cfi_offset $r24,200
+ .cfi_offset $r25,208
+ .cfi_offset $r26,216
+ .cfi_offset $r27,224
+ .cfi_offset $r28,232
+ .cfi_offset $r29,240
+ .cfi_offset $r30,248
+ .cfi_offset $r31,256
+
+ # ABI GPRs alias
+ .cfi_offset $zero,8
+ .cfi_offset $ra, 16
+ .cfi_offset $tp, 24
+ .cfi_offset $sp, 32
+ .cfi_offset $a0, 40
+ .cfi_offset $a1, 48
+ .cfi_offset $a2, 56
+ .cfi_offset $a3, 64
+ .cfi_offset $a4, 72
+ .cfi_offset $a5, 80
+ .cfi_offset $a6, 88
+ .cfi_offset $a7, 96
+ .cfi_offset $t0, 104
+ .cfi_offset $t1, 112
+ .cfi_offset $t2, 120
+ .cfi_offset $t3, 128
+ .cfi_offset $t4, 136
+ .cfi_offset $t5, 144
+ .cfi_offset $t6, 152
+ .cfi_offset $t7, 160
+ .cfi_offset $t8, 168
+ .cfi_offset $r21, 176
+ .cfi_offset $fp, 184
+ .cfi_offset $s0, 192
+ .cfi_offset $s1, 200
+ .cfi_offset $s2, 208
+ .cfi_offset $s3, 216
+ .cfi_offset $s4, 224
+ .cfi_offset $s5, 232
+ .cfi_offset $s6, 240
+ .cfi_offset $s7, 248
+ .cfi_offset $s8, 256
+
+ # numeric GPRs alias
+ .cfi_offset r0, 8
+ .cfi_offset r1, 16
+ .cfi_offset r2, 24
+ .cfi_offset r3, 32
+ .cfi_offset r4, 40
+ .cfi_offset r5, 48
+ .cfi_offset r6, 56
+ .cfi_offset r7, 64
+ .cfi_offset r8, 72
+ .cfi_offset r9, 80
+ .cfi_offset r10,88
+ .cfi_offset r11,96
+ .cfi_offset r12,104
+ .cfi_offset r13,112
+ .cfi_offset r14,120
+ .cfi_offset r15,128
+ .cfi_offset r16,136
+ .cfi_offset r17,144
+ .cfi_offset r18,152
+ .cfi_offset r19,160
+ .cfi_offset r20,168
+ .cfi_offset r21,176
+ .cfi_offset r22,184
+ .cfi_offset r23,192
+ .cfi_offset r24,200
+ .cfi_offset r25,208
+ .cfi_offset r26,216
+ .cfi_offset r27,224
+ .cfi_offset r28,232
+ .cfi_offset r29,240
+ .cfi_offset r30,248
+ .cfi_offset r31,256
+
+ # without "$" GPRs alias
+ .cfi_offset zero,8
+ .cfi_offset ra, 16
+ .cfi_offset tp, 24
+ .cfi_offset sp, 32
+ .cfi_offset a0, 40
+ .cfi_offset a1, 48
+ .cfi_offset a2, 56
+ .cfi_offset a3, 64
+ .cfi_offset a4, 72
+ .cfi_offset a5, 80
+ .cfi_offset a6, 88
+ .cfi_offset a7, 96
+ .cfi_offset t0, 104
+ .cfi_offset t1, 112
+ .cfi_offset t2, 120
+ .cfi_offset t3, 128
+ .cfi_offset t4, 136
+ .cfi_offset t5, 144
+ .cfi_offset t6, 152
+ .cfi_offset t7, 160
+ .cfi_offset t8, 168
+ .cfi_offset r21, 176
+ .cfi_offset fp, 184
+ .cfi_offset s0, 192
+ .cfi_offset s1, 200
+ .cfi_offset s2, 208
+ .cfi_offset s3, 216
+ .cfi_offset s4, 224
+ .cfi_offset s5, 232
+ .cfi_offset s6, 240
+ .cfi_offset s7, 248
+ .cfi_offset s8, 256
+
+ # ABI FPRs names
+ .cfi_offset $f0, 264
+ .cfi_offset $f1, 272
+ .cfi_offset $f2, 280
+ .cfi_offset $f3, 288
+ .cfi_offset $f4, 296
+ .cfi_offset $f5, 304
+ .cfi_offset $f6, 312
+ .cfi_offset $f7, 320
+ .cfi_offset $f8, 328
+ .cfi_offset $f9, 336
+ .cfi_offset $f10,344
+ .cfi_offset $f11,352
+ .cfi_offset $f12,360
+ .cfi_offset $f13,368
+ .cfi_offset $f14,376
+ .cfi_offset $f15,384
+ .cfi_offset $f16,392
+ .cfi_offset $f17,400
+ .cfi_offset $f18,408
+ .cfi_offset $f19,416
+ .cfi_offset $f20,424
+ .cfi_offset $f21,432
+ .cfi_offset $f22,440
+ .cfi_offset $f23,448
+ .cfi_offset $f24,456
+ .cfi_offset $f25,464
+ .cfi_offset $f26,472
+ .cfi_offset $f27,480
+ .cfi_offset $f28,488
+ .cfi_offset $f29,496
+ .cfi_offset $f30,504
+ .cfi_offset $f31,512
+
+ # ABI FPRs alias
+ .cfi_offset $fa0, 264
+ .cfi_offset $fa1, 272
+ .cfi_offset $fa2, 280
+ .cfi_offset $fa3, 288
+ .cfi_offset $fa4, 296
+ .cfi_offset $fa5, 304
+ .cfi_offset $fa6, 312
+ .cfi_offset $fa7, 320
+ .cfi_offset $ft0, 328
+ .cfi_offset $ft1, 336
+ .cfi_offset $ft2,344
+ .cfi_offset $ft3,352
+ .cfi_offset $ft4,360
+ .cfi_offset $ft5,368
+ .cfi_offset $ft6,376
+ .cfi_offset $ft7,384
+ .cfi_offset $ft8,392
+ .cfi_offset $ft9,400
+ .cfi_offset $ft10,408
+ .cfi_offset $ft11,416
+ .cfi_offset $ft12,424
+ .cfi_offset $ft13,432
+ .cfi_offset $ft14,440
+ .cfi_offset $ft15,448
+ .cfi_offset $fs0,456
+ .cfi_offset $fs1,464
+ .cfi_offset $fs2,472
+ .cfi_offset $fs3,480
+ .cfi_offset $fs4,488
+ .cfi_offset $fs5,496
+ .cfi_offset $fs6,504
+ .cfi_offset $fs7,512
+
+ # numeric FPRs names
+ .cfi_offset f0, 264
+ .cfi_offset f1, 272
+ .cfi_offset f2, 280
+ .cfi_offset f3, 288
+ .cfi_offset f4, 296
+ .cfi_offset f5, 304
+ .cfi_offset f6, 312
+ .cfi_offset f7, 320
+ .cfi_offset f8, 328
+ .cfi_offset f9, 336
+ .cfi_offset f10,344
+ .cfi_offset f11,352
+ .cfi_offset f12,360
+ .cfi_offset f13,368
+ .cfi_offset f14,376
+ .cfi_offset f15,384
+ .cfi_offset f16,392
+ .cfi_offset f17,400
+ .cfi_offset f18,408
+ .cfi_offset f19,416
+ .cfi_offset f20,424
+ .cfi_offset f21,432
+ .cfi_offset f22,440
+ .cfi_offset f23,448
+ .cfi_offset f24,456
+ .cfi_offset f25,464
+ .cfi_offset f26,472
+ .cfi_offset f27,480
+ .cfi_offset f28,488
+ .cfi_offset f29,496
+ .cfi_offset f30,504
+ .cfi_offset f31,512
+
+ # without "$" FPRs alias
+ .cfi_offset fa0, 264
+ .cfi_offset fa1, 272
+ .cfi_offset fa2, 280
+ .cfi_offset fa3, 288
+ .cfi_offset fa4, 296
+ .cfi_offset fa5, 304
+ .cfi_offset fa6, 312
+ .cfi_offset fa7, 320
+ .cfi_offset ft0, 328
+ .cfi_offset ft1, 336
+ .cfi_offset ft2,344
+ .cfi_offset ft3,352
+ .cfi_offset ft4,360
+ .cfi_offset ft5,368
+ .cfi_offset ft6,376
+ .cfi_offset ft7,384
+ .cfi_offset ft8,392
+ .cfi_offset ft9,400
+ .cfi_offset ft10,408
+ .cfi_offset ft11,416
+ .cfi_offset ft12,424
+ .cfi_offset ft13,432
+ .cfi_offset ft14,440
+ .cfi_offset ft15,448
+ .cfi_offset fs0,456
+ .cfi_offset fs1,464
+ .cfi_offset fs2,472
+ .cfi_offset fs3,480
+ .cfi_offset fs4,488
+ .cfi_offset fs5,496
+ .cfi_offset fs6,504
+ .cfi_offset fs7,512
+
+ nop
+ .cfi_endproc
@@ -267,6 +267,10 @@ dec2 : [1-9][0-9]?
extern const char *const loongarch_cr_normal_name[4];
extern const char *const loongarch_v_normal_name[32];
extern const char *const loongarch_x_normal_name[32];
+ extern const char *const loongarch_r_cfi_name[32];
+ extern const char *const loongarch_r_cfi_name_alias[32];
+ extern const char *const loongarch_f_cfi_name[32];
+ extern const char *const loongarch_f_cfi_name_alias[32];
extern struct loongarch_ase loongarch_ASEs[];
@@ -126,6 +126,38 @@ const char *const loongarch_x_normal_name[32] =
"$xr24", "$xr25", "$xr26", "$xr27", "$xr28", "$xr29", "$xr30", "$xr31",
};
+const char *const loongarch_r_cfi_name[32] =
+{
+ "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7",
+ "r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15",
+ "r16", "r17", "r18", "r19", "r20", "r21", "r22", "r23",
+ "r24", "r25", "r26", "r27", "r28", "r29", "r30", "r31",
+};
+
+const char *const loongarch_r_cfi_name_alias[32] =
+{
+ "zero", "ra", "tp", "sp", "a0", "a1", "a2", "a3",
+ "a4", "a5", "a6", "a7", "t0", "t1", "t2", "t3",
+ "t4", "t5", "t6", "t7", "t8", "r21","fp", "s0",
+ "s1", "s2", "s3", "s4", "s5", "s6", "s7", "s8",
+};
+
+const char *const loongarch_f_cfi_name[32] =
+{
+ "f0", "f1", "f2", "f3", "f4", "f5", "f6", "f7",
+ "f8", "f9", "f10", "f11", "f12", "f13", "f14", "f15",
+ "f16", "f17", "f18", "f19", "f20", "f21", "f22", "f23",
+ "f24", "f25", "f26", "f27", "f28", "f29", "f30", "f31",
+};
+
+const char *const loongarch_f_cfi_name_alias[32] =
+{
+ "fa0", "fa1", "fa2", "fa3", "fa4", "fa5", "fa6", "fa7",
+ "ft0", "ft1", "ft2", "ft3", "ft4", "ft5", "ft6", "ft7",
+ "ft8", "ft9", "ft10", "ft11", "ft12", "ft13", "ft14", "ft15",
+ "fs0", "fs1", "fs2", "fs3", "fs4", "fs5", "fs6", "fs7",
+};
+
/* Can not use xx_pa for abs. */
/* For LoongArch32 abs. */