* [PATCH] debugedit: add MIPS support @ 2021-04-02 8:00 Dmitry V. Levin 2021-04-02 23:03 ` Mark Wielaard 0 siblings, 1 reply; 3+ messages in thread From: Dmitry V. Levin @ 2021-04-02 8:00 UTC (permalink / raw) To: debugedit; +Cc: Ivan A. Melnikov 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 ^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] debugedit: add MIPS support 2021-04-02 8:00 [PATCH] debugedit: add MIPS support Dmitry V. Levin @ 2021-04-02 23:03 ` Mark Wielaard 2021-04-09 10:17 ` Ivan A. Melnikov 0 siblings, 1 reply; 3+ messages in thread From: Mark Wielaard @ 2021-04-02 23:03 UTC (permalink / raw) To: Dmitry V. Levin; +Cc: debugedit, Ivan A. Melnikov Hi Dmitry, Hi Ivan, On Fri, Apr 02, 2021 at 08:00:00AM +0000, Dmitry V. Levin wrote: > 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> This looks correct. I have pushed it to main. I don't have a MIPS setup to check, but don't you also need some R_MIPS value for setup_relbuf? Thanks, Mark ^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] debugedit: add MIPS support 2021-04-02 23:03 ` Mark Wielaard @ 2021-04-09 10:17 ` Ivan A. Melnikov 0 siblings, 0 replies; 3+ messages in thread From: Ivan A. Melnikov @ 2021-04-09 10:17 UTC (permalink / raw) To: Mark Wielaard; +Cc: Dmitry V. Levin, debugedit On Sat, Apr 03, 2021 at 01:03:09AM +0200, Mark Wielaard wrote: > Hi Dmitry, Hi Ivan, Hi Mark, Sorry for slow reply. > On Fri, Apr 02, 2021 at 08:00:00AM +0000, Dmitry V. Levin wrote: > > 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> > > This looks correct. I have pushed it to main. Thank you. > I don't have a MIPS setup to check, but don't you > also need some R_MIPS value for setup_relbuf? The thing is that there are several MIPS ABIs. Our primary target is MIPS32 with o32 (traditional) ABI. With this ABI, RELA relocations are not used, even for kernel modules, so all the relocations in .debug_info sections are "uniteresting", as the comment in setup_relbuf calls them. So, my patch is enough to support MIPS32 systems with o32 ABI. On the other hand, on MIPS64 systems with n64 ABI (the most whidespread ABI on 64-bit MIPS) at least 4 types of RELA relocations are used. They, indeed, should be added to setup_relbuf, and some of them may even require additional handling. I'm looking into that, but I haven't figured out all the details yet. I'll send a patch here when I'll have something. -- wbr, iv m. ^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-04-09 10:17 UTC | newest] Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2021-04-02 8:00 [PATCH] debugedit: add MIPS support Dmitry V. Levin 2021-04-02 23:03 ` Mark Wielaard 2021-04-09 10:17 ` Ivan A. Melnikov
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).