Bug 26738 - .debug_line reference above end of section (mipsel)
Summary: .debug_line reference above end of section (mipsel)
Status: RESOLVED FIXED
Alias: None
Product: dwz
Classification: Unclassified
Component: default (show other bugs)
Version: unspecified
: P2 normal
Target Milestone: ---
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-10-15 15:56 UTC by Matthias Klose
Modified: 2021-03-05 06:32 UTC (History)
3 users (show)

See Also:
Host:
Target: mipsel-linux-gnu
Build:
Last reconfirmed:


Attachments
test case (89.11 KB, application/x-compressed-tar)
2020-10-15 15:56 UTC, Matthias Klose
Details
More minimal reproducer (8.10 KB, application/x-compressed-tar)
2021-03-04 08:18 UTC, Tom de Vries
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Matthias Klose 2020-10-15 15:56:48 UTC
Created attachment 12902 [details]
test case

this is seen on mipsel-linux-gnu, not on other archs, and not on mips64el-linux-gnu. seen both with 0.13 and trunk.

../dwz-0.13+20201015/debian/dwz/usr/bin/dwz -mdebian/python3-dbus-tests/usr/lib/debug/.dwz/mipsel-linux-gnu/python3-dbus-tests.debug -M/usr/lib/debug/.dwz/mipsel-linux-gnu/python3-dbus-tests.debug -- debian/python3-dbus-tests/usr/lib/python3/dist-packages/dbus_py_test.cpython-38-mipsel-linux-gnu.so debian/python3-dbus-tests/usr/lib/python3/dist-packages/dbus_py_test.cpython-39-mipsel-linux-gnu.so debian/python3-dbus-tests/usr/libexec/installed-tests/dbus-python/python3.8/test/test-import-repeatedly debian/python3-dbus-tests/usr/libexec/installed-tests/dbus-python/python3.9/test/test-import-repeatedly
../dwz-0.13+20201015/debian/dwz/usr/bin/dwz: debian/python3-dbus-tests/usr/lib/python3/dist-packages/dbus_py_test.cpython-38-mipsel-linux-gnu.so: DWARF compression not beneficial - old size 8764 new size 8764
../dwz-0.13+20201015/debian/dwz/usr/bin/dwz: debian/python3-dbus-tests/usr/lib/python3/dist-packages/dbus_py_test.cpython-39-mipsel-linux-gnu.so: DWARF compression not beneficial - old size 7733 new size 7733
../dwz-0.13+20201015/debian/dwz/usr/bin/dwz: debian/python3-dbus-tests/usr/libexec/installed-tests/dbus-python/python3.8/test/test-import-repeatedly: DWARF compression not beneficial - old size 649 new size 649
../dwz-0.13+20201015/debian/dwz/usr/bin/dwz: debian/python3-dbus-tests/usr/libexec/installed-tests/dbus-python/python3.9/test/test-import-repeatedly: DWARF compression not beneficial - old size 649 new size 649
../dwz-0.13+20201015/debian/dwz/usr/bin/dwz: debian/python3-dbus-tests/usr/lib/debug/.dwz/mipsel-linux-gnu/python3-dbus-tests.debug: .debug_line reference above end of section
Comment 1 Mark Wielaard 2020-10-15 16:39:23 UTC
(In reply to Matthias Klose from comment #0)
> Created attachment 12902 [details]
> test case
> 
> this is seen on mipsel-linux-gnu, not on other archs, and not on
> mips64el-linux-gnu. seen both with 0.13 and trunk.

I can replicate it with the provided reproducer.
But there is something odd with the .debug sections.
They all have an unknown section type: SHT_LOPROC+1e
And eu-readelf has trouble reading the debuginfo itself.

Do you happen to know whether mipsel-linux-gnu uses some special interpretation of ELF/DWARF?
Comment 2 Tom de Vries 2021-03-02 13:20:58 UTC
Tentative fix:
...
diff --git a/dwz.c b/dwz.c                                                                    
index af1c5af..5effbc1 100644                                                                 
--- a/dwz.c                                                                                   
+++ b/dwz.c                                                                                   
@@ -15150,7 +15150,7 @@ write_multifile (DSO *dso)
                            debug_sections[DEBUG_MACRO].new_size)                             
                     != (ssize_t) debug_sections[DEBUG_MACRO].new_size)                       
              || (strp_htab != NULL && write_multifile_strp ())                               
-             || (line_htab != NULL && write_multifile_line ()))                              
+             || write_multifile_line ())                                                     
            {                                                                                 
              error (0, 0, "Error writing multi-file temporary files");                       
              ret = 1;                                                                        
...
Comment 4 Tom de Vries 2021-03-04 08:18:48 UTC
Created attachment 13282 [details]
More minimal reproducer