Bug 397357 - symbols not loaded with binutils-2.31.1 unless -fuse-ld=gold specified to gcc/g++
Summary: symbols not loaded with binutils-2.31.1 unless -fuse-ld=gold specified to gcc...
Status: REPORTED
Alias: None
Product: valgrind
Classification: Developer tools
Component: general (show other bugs)
Version: 3.13.0
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: Julian Seward
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-08-11 04:10 UTC by starlight.2014q4
Modified: 2018-08-21 11:15 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description starlight.2014q4 2018-08-11 04:10:16 UTC
Unusual setup here, running ancient distro and kernel but with recent/current tools built from source.

Compiled and installed binutils-2.31.1 a week ago and just noticed that valgrind no longer reads .debug_info from 64-bit ELF binaries unless gcc/g++ is invoked with -fuse-ld=gold to select linking with gold linker.

Was at valgrind 3.10.0, immediately built and installed 3.13.0 which made no difference.  Problem appears independent of GCC version, tried 4.9.4 and 8.2, both C and C++.

Invoking valgrind with --trace-symtab=yes -v shows symbols from prior binutils generated libraries loading but for the target, loading fails with

{{{
------ Examining the program headers ------
PT_LOAD[2]: p_vaddr 0x400000 (prev 0x0)
PT_LOAD[2]:   p_offset 0, p_filesz 7240, perms r--
--26491-- ELF section outside all mapped regions
------ ELF reading failed ------
------ name = xxxx
------ end ELF OBJECT -------------------------------------------------------
}}}

instead of progressing to PT_LOAD[3] and then

{{{
------ Examining the section headers ------
------ Finding image addresses for debug-info sections ------
------ The contents of .debug_ranges ------
------ The contents of .debug_abbrev ------
------ Parsing .debug_info section ------
------ .debug_info reading was successful ------
------ Canonicalising the acquired info ------
------ Notifying m_redir ------
------ name = xxxx
------ end ELF OBJECT -------------------------------------------------------
}}}

Appears the sort of issue worth fixing; or if too difficult, recognize and recommend users link with gold.

Suggest valgrind complain when ELF reading fails.  Without --trace-symtab=yes no indication is present.
Comment 1 starlight.2014q4 2018-08-11 04:24:54 UTC
Neglected to mention GDB 8.1 has no issue with default-linker ELF files.
Comment 2 Tom Hughes 2018-08-11 06:35:25 UTC
Try building from git - this is most likely already fixed.
Comment 3 starlight.2014q4 2018-08-11 17:09:56 UTC
Willing to built and test, but snapshots are disabled on the repository and while I appreciate the beauty of it, I've never much needed git.  Swamped at present; don't have time for it.  If a snap can be posted or enabled in the repository will test it.
Comment 4 Gilles 2018-08-21 11:15:11 UTC
For what it's worth, I can confirm the issue, and also that it is fixed on current git master.