Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 787623

Summary: www-client/firefox[clang]: .gnu_debuglink is busted when using LLD
Product: Gentoo Linux Reporter: Nekun <nekokun>
Component: Current packagesAssignee: Mozilla Gentoo Team <mozilla>
Status: CONFIRMED ---    
Severity: normal CC: herrtimson, jstein
Priority: Normal    
Version: unspecified   
Hardware: All   
OS: Linux   
URL: https://bugzilla.mozilla.org/show_bug.cgi?id=1485556
Whiteboard:
Package list:
Runtime testing required: ---
Attachments: emerge-info
emerge log
produced firefox executable
build log

Description Nekun 2021-05-02 09:05:26 UTC
Created attachment 705234 [details]
emerge-info

Portage is configured to "splitdebug -nostrip installsources". Debug information for firefox and its libraries appeared in /usr/lib64/debug, but:

1. Sources didn't installed

2. `.gnu_debuglink` in firefox binaries has only entries for Scrt|crti|crtn

~$ readelf -p .gnu_debuglink /usr/lib64/firefox/firefox

String dump of section '.gnu_debuglink':
  [     0]  Scrt1.o.debug
  [    12]  ]fcrti.o.debug
  [    27]  ^crtn.o.debug
  [    3a]  NF

~$ readelf -p .gnu_debuglink /usr/lib64/firefox/libxul.so

String dump of section '.gnu_debuglink':
  [     0]  crti.o.debug
  [    13]  ^crtn.o.debug
  [    26]  NF

3. Manual adding debug information in gdb through `add-symbol-file` has no effect, e.g. gdb didn't resolve function names in backtraces and didn't stop at breakpoints.

Will attach full build log later.
Comment 1 Nekun 2021-05-02 09:05:56 UTC
Created attachment 705237 [details]
emerge log
Comment 2 Nekun 2021-05-02 09:06:40 UTC
Created attachment 705240 [details]
produced firefox executable
Comment 3 Nekun 2021-05-02 09:10:25 UTC
https://tinystash.undef.im/dl/4dEiqZwFrprZrpLwNgSKtKNrg7gWFfMeLYap8pQWyBE2MdgcfiAhtNCdi9CRAUY7AXBu1dicbEFvTnqCutz6TP6E.debug

produced debug info for firefox executable (too large to attach on bugzilla)
Comment 4 Nekun 2021-05-02 09:33:16 UTC
Hrm, seems like adding correct debuglink with `objcopy --add-gnu-debuglink` to binary makes debugging work, please ignore third point.
Comment 5 Nekun 2021-05-02 10:45:46 UTC
Build log here: https://tinystash.undef.im/il/47YbyfYZ88QLTuredzDQbHn4SJuTbn7DdbToc15WoCvdk1MVwaMyMN19yaHWKuKyuBCoV1d3nqfN4s8uBN2K6Qpv.log

Stripping phase looks interesting:

strip: x86_64-pc-linux-gnu-strip --strip-unneeded -N __gentoo_check_ldflags__ -R .comment -R .GCC.command.line -R .note.gnu.gold-version
   /usr/lib64/firefox/liblgpllibs.so
   /usr/lib64/firefox/libmozavutil.so
   /usr/lib64/firefox/libmozavcodec.so
   /usr/lib64/firefox/libmozsandbox.so
   /usr/lib64/firefox/pingsender
   /usr/lib64/firefox/libmozsqlite3.so
   /usr/lib64/firefox/firefox
/usr/bin/debugedit: /var/tmp/portage/www-client/firefox-78.10.0/image/usr/lib64/firefox/liblgpllibs.so: DWARF version 0 unhandled
/usr/bin/debugedit: /var/tmp/portage/www-client/firefox-78.10.0/image/usr/lib64/firefox/libmozsandbox.so: DWARF version 0 unhandled
/usr/bin/debugedit: /var/tmp/portage/www-client/firefox-78.10.0/image/usr/lib64/firefox/libmozavcodec.so: DWARF version 0 unhandled
/usr/bin/debugedit: /var/tmp/portage/www-client/firefox-78.10.0/image/usr/lib64/firefox/pingsender: DWARF version 0 unhandled/usr/bin/debugedit: /var/tmp/portage/www-client/firefox-78.10.0/image/usr/lib64/firefox/libmozavutil.so: DWARF version 0 unhandled

/usr/bin/debugedit: /var/tmp/portage/www-client/firefox-78.10.0/image/usr/lib64/firefox/libmozsqlite3.so: DWARF version 0 unhandled
/usr/bin/debugedit: /var/tmp/portage/www-client/firefox-78.10.0/image/usr/lib64/firefox/firefox: DWARF version 0 unhandled
x86_64-pc-linux-gnu-objcopy: /var/tmp/portage/www-client/firefox-78.10.0/image/usr/lib64/firefox/stDBE7s1: debuglink section already exists
x86_64-pc-linux-gnu-objcopy: /var/tmp/portage/www-client/firefox-78.10.0/image/usr/lib64/firefox/stHUleOi: debuglink section already exists
x86_64-pc-linux-gnu-objcopy: /var/tmp/portage/www-client/firefox-78.10.0/image/usr/lib64/firefox/stk1qcSv: debuglink section already exists
x86_64-pc-linux-gnu-objcopy: /var/tmp/portage/www-client/firefox-78.10.0/image/usr/lib64/firefox/sttEqL5F: debuglink section already exists
x86_64-pc-linux-gnu-objcopy: /var/tmp/portage/www-client/firefox-78.10.0/image/usr/lib64/firefox/st1FcVkO: debuglink section already exists
x86_64-pc-linux-gnu-objcopy: /var/tmp/portage/www-client/firefox-78.10.0/image/usr/lib64/firefox/stPUsmZX: debuglink section already exists
x86_64-pc-linux-gnu-objcopy: /var/tmp/portage/www-client/firefox-78.10.0/image/usr/lib64/firefox/stbLUpad: debuglink section already exists
   /usr/lib64/firefox/libmozgtk.so
   /usr/lib64/firefox/libxul.so
   /usr/lib64/firefox/plugin-container
   /usr/lib64/firefox/gmp-clearkey/0.1/libclearkey.so
   /usr/lib64/firefox/gtk2/libmozgtk.so
/usr/bin/debugedit: /var/tmp/portage/www-client/firefox-78.10.0/image/usr/lib64/firefox/libmozgtk.so: DWARF version 0 unhandled
/usr/bin/debugedit: /var/tmp/portage/www-client/firefox-78.10.0/image/usr/lib64/firefox/plugin-container: DWARF version 0 unhandled
/usr/bin/debugedit: /var/tmp/portage/www-client/firefox-78.10.0/image/usr/lib64/firefox/gtk2/libmozgtk.so: DWARF version 0 unhandled
/usr/bin/debugedit: /var/tmp/portage/www-client/firefox-78.10.0/image/usr/lib64/firefox/gmp-clearkey/0.1/libclearkey.so: DWARF version 0 unhandled
x86_64-pc-linux-gnu-objcopy: /var/tmp/portage/www-client/firefox-78.10.0/image/usr/lib64/firefox/stuDDKsa: debuglink section already exists
x86_64-pc-linux-gnu-objcopy: /var/tmp/portage/www-client/firefox-78.10.0/image/usr/lib64/firefox/gtk2/stBxmDuH: debuglink section already exists
x86_64-pc-linux-gnu-objcopy: /var/tmp/portage/www-client/firefox-78.10.0/image/usr/lib64/firefox/gmp-clearkey/0.1/stVO4HYV: debuglink section already exists
x86_64-pc-linux-gnu-objcopy: /var/tmp/portage/www-client/firefox-78.10.0/image/usr/lib64/firefox/stAazH1P: debuglink section already exists
/usr/bin/debugedit: /var/tmp/portage/www-client/firefox-78.10.0/image/usr/lib64/firefox/libxul.so: DWARF version 0 unhandled
x86_64-pc-linux-gnu-objcopy: /var/tmp/portage/www-client/firefox-78.10.0/image/usr/lib64/firefox/stNahJyH: debuglink section already exists
Comment 6 Sam James archtester gentoo-dev Security 2021-05-02 10:53:16 UTC
Please compress and attach logs here for posterity.
Comment 7 Nekun 2021-05-02 11:06:20 UTC
(In reply to Sam James from comment #6)
> Please compress and attach logs here for posterity.

Firefox build log is about 15MB, bugzilla attachments is limited to 1MB for me.
Comment 8 Nekun 2021-05-02 11:10:03 UTC
Created attachment 705261 [details]
build log
Comment 9 Nekun 2021-05-02 11:10:11 UTC
Well, xz magically shrinks it to 340K, don't expected such high ratio :)