https://sourceware.org/bugzilla/show_bug.cgi?id=24321
Bug ID: 24321
Summary: Objcopy "--only-keep-debug" generates Bad Offset in
LOAD sections for lld built binaries
Product: binutils
Version: unspecified
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: binutils
Assignee: unassigned at sourceware dot org
Reporter: manojgupta at google dot com
Target Milestone: ---
We discovered that objcopy creates bad Offsets in LOAD section when generating
split-debug files for lld built binaries. This is breaking tools e.g Linux Perf
and more tools that rely on the splitdebug file for symbolization.
The shared file has a tblgen binary that was built with LLD.
https://drive.google.com/file/d/1PTlbzG7nqdu_TLRlpMdKasuBcG0r0LIu/view?usp=sharing
Type Offset VirtAddr PhysAddr
$ readelf -l tblgen/tblgen|grep LOAD
LOAD 0x0000000000000000 0x0000000000200000 0x0000000000200000
LOAD 0x0000000000722000 0x0000000000922000 0x0000000000922000
# Generate a split-debug debug info file with objcopy
$objcopy --only-keep-debug tblgen tblgen.dbg
$ readelf -l tblgen.dbg|grep LOAD
LOAD 0x0000000000000000 0x0000000000200000 0x0000000000200000
LOAD 0x0000000000001000 0x0000000000922000 0x0000000000922000
The Offset field for second LOAD entry is BAD, it should have been
0x0000000000722000.
If I use eu-strip from elfutils, the offsets are correct.
$ eu-strip --strip-debug tblgen -f tblgen.debug
$ readelf -l tblgen.debug |grep LOAD
LOAD 0x0000000000000000 0x0000000000200000 0x0000000000200000
LOAD 0x0000000000722000 0x0000000000922000 0x0000000000922000
--
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
bug-binutils mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/bug-binutils