Bug 2187 - [patch] ld-loader cannot find debug symbols on ubuntu 15.04
[patch] ld-loader cannot find debug symbols on ubuntu 15.04
Status: NEW
Product: dce
Classification: Unclassified
Component: other
unspecified
PC Linux
: P5 major
Assigned To: Hajime Tazaki
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2015-09-28 05:47 EDT by Roman Naumann
Modified: 2015-09-29 09:17 EDT (History)
2 users (show)

See Also:


Attachments
patch fixing both issues described in the bug report (1.21 KB, patch)
2015-09-28 05:47 EDT, Roman Naumann
Details | Diff
actual patch (previous was bogus, sorry!) (1.06 KB, patch)
2015-09-29 09:17 EDT, Roman Naumann
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Roman Naumann 2015-09-28 05:47:38 EDT
Created attachment 2153 [details]
patch fixing both issues described in the bug report

The build of ld-loader fails on Ubuntu 15.04, apparently due to two separate issues in the script extract-system-config.py.

1. The script cannot find the shared objects with debug symbols for Ubuntu 15.04. The script searches using a hard-coded list of file names. The fix in the attached patch extends this list to include the path to ld-2.21.so for Ubuntu 15.04.

2. The script reads the symbols contained in the shared object file by running readelf on it. While parsing the output of readelf with regular expressions, newlines are erroneously read into the strings that contain attribute values. The result looks like this (with debug printing of item.attributes):

{'DW_AT_sibling': '8f4b', 'DW_AT_decl_file': '24\n', 'DW_AT_name': 'rtld_global\n', 'DW_AT_byte_size': '3968\n', 'DW_AT_decl_line': '259\n'}
{'DW_AT_sibling': '91de', 'DW_AT_decl_file': '24\n', 'DW_AT_name': 'rtld_global_ro\n', 'DW_AT_byte_size': '296\n', 'DW_AT_decl_line': '447\n'}
...

This causes the dictionary lookup for item's attributes to fail, since the search term and the value differ by a newline.

I do not know why this (apparently) worked in the past. Trying an older version of the shared object, ld-2.19.so, resulted in the same behavior.

In my opinion, the safest way to fix the behavior and remove the trailing newlines is to expand the regular expression to regard newlines as an indicator that the group is finished. This way, the newlines are not part of the group that is read to build the attribute value. The patch attached contains this fix. It should work even if no newlines are found for compatibility (with the folks who do not see this bug).

With the patch applied, ld-loader builds for me on Ubuntu 15.04.
Comment 1 Roman Naumann 2015-09-29 09:17:58 EDT
Created attachment 2155 [details]
actual patch (previous was bogus, sorry!)

The previous patch was the wrong file. Find the actual patch as described in the bug report attached.