Bug 39284

Summary: debugedit testsuite fails on mipsel
Product: Sisyphus Reporter: Ivan A. Melnikov <iv>
Component: rpm-buildAssignee: Ivan A. Melnikov <iv>
Status: CLOSED FIXED QA Contact: qa-sisyphus
Severity: normal    
Priority: P5 CC: arseny, glebfm, imz, ldv, placeholder, sin, vt
Version: unstable   
Hardware: mipsel   
OS: Linux   

Description Ivan A. Melnikov 2020-11-13 14:59:04 MSK
$ ssh gyle.sec task show 53635
id=53635 locked=no shared=no fail_early=yes test_only=no repo=sisyphus_mipsel owner=recycler state=FAILED try=1 iter=1
 100:srpm=rpm-build-4.0.4-alt155.src.rpm
 100:userid=recycler

From the logs:

## --------------------- ##
## rpm 4.0.4 test suite. ##
## --------------------- ##

RPM debugedit

  1: debugedit help                                  ok
  2: debugedit executable                            ok
  3: debugedit .debug_str objects                    FAILED (debugedit.at:101)
  4: debugedit .debug_str partial                    FAILED (debugedit.at:132)
  5: debugedit .debug_str exe                        FAILED (debugedit.at:162)
  6: debugedit .debug_info objects                   FAILED (debugedit.at:201)
  7: debugedit .debug_info partial                   FAILED (debugedit.at:224)
  8: debugedit .debug_info exe                       FAILED (debugedit.at:247)
  9: debugedit .debug_types objects                  ok
 10: debugedit .debug_types partial                  ok
 11: debugedit .debug_types exe                      ok
 12: debugedit .debug_line objects                   FAILED (debugedit.at:367)
 13: debugedit .debug_line partial                   FAILED (debugedit.at:389)
 14: debugedit .debug_line exe                       FAILED (debugedit.at:411)
 15: debugedit .debug_macro objects                  ok
 16: debugedit .debug_macro partial                  ok
 17: debugedit .debug_macro exe                      ok

## ------------- ##
## Test results. ##
## ------------- ##

ERROR: All 17 tests were run,
9 failed unexpectedly.
## ------------------------- ##
## rpmtests.log was created. ##
## ------------------------- ##
Comment 1 Ivan A. Melnikov 2020-11-13 15:13:54 MSK
Actually, saving sources into debuginfo packages never worked properly (or at all?) on mipsel.

The thing is that on MIPS, traditionally, the debug information is stored in a bit different way. For starters, debugedit should handle .debug_info section even if it has MIPS-specific SHT_MIPS_DWARF type:

http://git.altlinux.org/people/iv/packages/?p=rpm-build.git;a=commit;h=1d7d10edd03c2bc6557086eca22a115aa8f9dd00

That, at least, makes rpm-build testsuite pass, but there may be more to it. More testing is surely needed.
Comment 2 Vitaly Chikunov 2020-11-13 16:49:04 MSK
Btw, possible, you also need commit like this
http://git.altlinux.org/people/vt/packages/?p=rpm-build.git;a=commitdiff;h=bb0b76e75998641fdb94469e381688bcc74e3c8a
Comment 3 Ivan A. Melnikov 2020-11-16 15:07:20 MSK
(In reply to Vitaly Chikunov from comment #2)
> Btw, possible, you also need commit like this
> http://git.altlinux.org/people/vt/packages/?p=rpm-build.git;a=commitdiff;
> h=bb0b76e75998641fdb94469e381688bcc74e3c8a

Thank you for pointing this out. I would expect that something like that is needed, and it's easy to imagine what exectly (R_MIPS_32 reolcation for EM_MIPS and EM_MIPS_RS3_LE machines).

But for all the binaries I've seen the relocations for .debug_info section are stored in .rel.debug_info (of type REL) and have value zero, so are "uninteresting":

http://git.altlinux.org/people/iv/packages/?p=rpm-build.git;a=blob;f=tools/debugedit.c;h=051eea1227d1411887aef8a02d8d00ff22b834e6#l543

During this weekend, quite a few packages were build with rpm-build with my patch from comment #1, and "Unhandled relocation" error was not triggered in any of them.

Is there a way to make our current toolchain to produce a relocation against .debug_info section that would be "interesting" for setup_relbuf?
Comment 4 Vitaly Chikunov 2020-11-16 17:14:01 MSK
That bug was only triggered on kernel modules objects (ko).
Comment 5 Dmitry V. Levin 2021-03-23 01:01:07 MSK
(In reply to Ivan A. Melnikov from comment #3)
> http://git.altlinux.org/people/iv/packages/?p=rpm-build.git;a=blob;f=tools/
> debugedit.c;h=051eea1227d1411887aef8a02d8d00ff22b834e6#l543

Is this commit ready to be merged?
Comment 6 Ivan A. Melnikov 2021-03-23 12:26:52 MSK
> Is this commit ready to be merged?

Yes. It fixes debuginfo generation on mipsel, and makes the tests pass. rpm-build with this commit applied already works in sisyphus_mipsel and p9_mipsel for quite some time, so it's also well tested.

I don't seem to need another part Vitaly mentioned in comment #2, even to build debuginfo-enabled kernels, but I still don't now why mipsel is different from other platforms here and how exactly. That's the only thing that was holding me from pushing this change into the Sisyphus rpm-build more eagerly.
Comment 7 Ivan A. Melnikov 2021-07-30 10:28:14 MSK
This is fixed in debugedit upstream. With the transition to separately-packaged debugedit, this is fixed in Sisyphus and p10, too.