There is no functional change, only operations such as orc_print_{sp,fp}
are encapsulated into orc_print_dump(). It is convenient to add LoongArch
support later (because it needs to add orc_print_ra()).
Signed-off-by: Youling Tang <tangyouling@loongson.cn>
---
tools/objtool/arch/x86/orc.c | 23 ++++++++++++++++++-----
tools/objtool/include/objtool/orc.h | 5 +----
tools/objtool/orc_dump.c | 12 +-----------
3 files changed, 20 insertions(+), 20 deletions(-)
@@ -114,7 +114,7 @@ static const char *reg_name(unsigned int reg)
}
}
-const char *orc_type_name(unsigned int type)
+static const char *orc_type_name(unsigned int type)
{
switch (type) {
case UNWIND_HINT_TYPE_CALL:
@@ -128,7 +128,7 @@ const char *orc_type_name(unsigned int type)
}
}
-void orc_print_reg(unsigned int reg, int offset)
+static void orc_print_reg(unsigned int reg, int offset)
{
if (reg == ORC_REG_BP_INDIRECT)
printf("(bp%+d)", offset);
@@ -140,12 +140,25 @@ void orc_print_reg(unsigned int reg, int offset)
printf("%s%+d", reg_name(reg), offset);
}
-void orc_print_sp(void)
+static void orc_print_sp(void)
{
printf(" sp:");
}
-
-void orc_print_fp(void)
+static void orc_print_fp(void)
{
printf(" bp:");
}
+
+void orc_print_dump(struct elf *dummy_elf, struct orc_entry *orc, int i)
+{
+ orc_print_sp();
+
+ orc_print_reg(orc[i].sp_reg, bswap_if_needed(dummy_elf, orc[i].sp_offset));
+
+ orc_print_fp();
+
+ orc_print_reg(orc[i].bp_reg, bswap_if_needed(dummy_elf, orc[i].bp_offset));
+
+ printf(" type:%s signal:%d end:%d\n",
+ orc_type_name(orc[i].type), orc[i].signal, orc[i].end);
+}
@@ -10,9 +10,6 @@
int init_orc_entry(struct orc_entry *orc, struct cfi_state *cfi,
struct instruction *insn);
-const char *orc_type_name(unsigned int type);
-void orc_print_reg(unsigned int reg, int offset);
-void orc_print_sp(void);
-void orc_print_fp(void);
+void orc_print_dump(struct elf *dummy_elf, struct orc_entry *orc, int i);
#endif /* _OBJTOOL_ORC_H */
@@ -151,17 +151,7 @@ int orc_dump(const char *_objname)
printf("%llx:", (unsigned long long)(orc_ip_addr + (i * sizeof(int)) + orc_ip[i]));
}
-
- orc_print_sp();
-
- orc_print_reg(orc[i].sp_reg, bswap_if_needed(&dummy_elf, orc[i].sp_offset));
-
- orc_print_fp();
-
- orc_print_reg(orc[i].bp_reg, bswap_if_needed(&dummy_elf, orc[i].bp_offset));
-
- printf(" type:%s signal:%d end:%d\n",
- orc_type_name(orc[i].type), orc[i].signal, orc[i].end);
+ orc_print_dump(&dummy_elf, orc, i);
}
elf_end(elf);