[PATCH] debugedit: add MIPS support
Dmitry V. Levin
ldv@altlinux.org
Fri Apr 2 08:00:00 GMT 2021
From: "Ivan A. Melnikov" <iv@altlinux.org>
Date: Fri, 13 Nov 2020 15:51:08 +0400
According to the specification[1], all MIPS .debug_* sections are
marked with ELF type SHT_MIPS_DWARF. The format of the section
data stays the same, so we have can handle e.g. .debug_info
section as we used to.
As SHT_MIPS_DWARF is from processor-specific range, we have to check
that we're actually dealing with MIPS ELF file before handling such
sections.
[1] MIPS Extensions to DWARF Version 2.0. -- Silicon Graphics
Computer Systems, rev 1.17, 29 Aug 2001
Refs: https://bugzilla.altlinux.org/39284
Signed-off-by: Ivan A. Melnikov <iv@altlinux.org>
Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
---
tools/debugedit.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/tools/debugedit.c b/tools/debugedit.c
index 7c57e16..917c59b 100644
--- a/tools/debugedit.c
+++ b/tools/debugedit.c
@@ -3440,6 +3440,16 @@ main (int argc, char *argv[])
switch (dso->shdr[i].sh_type)
{
+ case SHT_MIPS_DWARF:
+ /* According to the specification, all MIPS .debug_* sections are
+ marked with ELF type SHT_MIPS_DWARF. As SHT_MIPS_DWARF is from
+ processor-specific range, we have to check that we're actually
+ dealing with MIPS ELF file before handling such sections. */
+ if (dso->ehdr.e_machine != EM_MIPS
+ && dso->ehdr.e_machine != EM_MIPS_RS3_LE) {
+ break;
+ }
+ /*@fallthrough@*/
case SHT_PROGBITS:
name = strptr (dso, dso->ehdr.e_shstrndx, dso->shdr[i].sh_name);
/* TODO: Handle stabs */
--
ldv
More information about the Debugedit
mailing list