[PATCH v1 1/4] LoongArch: Change DWARF2_CIE_DATA_ALIGNMENT to -4 for loongarch32
mengqinggang
mengqinggang@loongson.cn
Tue Jun 10 08:42:38 GMT 2025
From: Jiajie Chen <c@jia.je>
---
gas/config/tc-loongarch.c | 5 +++++
gas/config/tc-loongarch.h | 3 ++-
2 files changed, 7 insertions(+), 1 deletion(-)
diff --git a/gas/config/tc-loongarch.c b/gas/config/tc-loongarch.c
index be3dac208a5..4949d1759e4 100644
--- a/gas/config/tc-loongarch.c
+++ b/gas/config/tc-loongarch.c
@@ -112,6 +112,9 @@ const char EXP_CHARS[] = "eE";
/* or 0d1.2345e12. */
const char FLT_CHARS[] = "rRsSfFdDxXpP";
+/* The dwarf2 data alignment, adjusted for 32 or 64 bit. */
+int loongarch_cie_data_alignment;
+
const char md_shortopts[] = "O::g::G:";
static const char default_arch[] = DEFAULT_ARCH;
@@ -516,6 +519,8 @@ md_begin ()
/* FIXME: expressionS use 'offsetT' as constant,
* we want this is 64-bit type. */
assert (8 <= sizeof (offsetT));
+
+ loongarch_cie_data_alignment = LARCH_opts.ase_lp64 ? (-8) : (-4);
}
/* Called just before the assembler exits. */
diff --git a/gas/config/tc-loongarch.h b/gas/config/tc-loongarch.h
index ed20bcc202e..3d33da6ccb8 100644
--- a/gas/config/tc-loongarch.h
+++ b/gas/config/tc-loongarch.h
@@ -117,7 +117,8 @@ extern int loongarch_force_relocation (struct fix *);
FDE Code Alignment Factor (DWARF2_LINE_MIN_INSN_LENGTH) should be 1
because DW_CFA_advance_loc need to be relocated in bytes
when linker relaxation. */
-#define DWARF2_CIE_DATA_ALIGNMENT (-8)
+extern int loongarch_cie_data_alignment;
+#define DWARF2_CIE_DATA_ALIGNMENT loongarch_cie_data_alignment
#define DWARF2_DEFAULT_RETURN_COLUMN 1 /* FDE Return Address Register. */
#define tc_cfi_frame_initial_instructions \
--
2.34.1
More information about the Binutils
mailing list