]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
MFC r348347 (jhibbits): libdwarf: add missing powerpc64 relocation support
authorEd Maste <emaste@FreeBSD.org>
Sun, 8 Mar 2020 20:05:34 +0000 (20:05 +0000)
committerEd Maste <emaste@FreeBSD.org>
Sun, 8 Mar 2020 20:05:34 +0000 (20:05 +0000)
commit6b59524234887e08c425fe4ea80c69bb54d6a9c8
treed498560c32c5d68a9bf1a85cd7b3a23f7afc3038
parent60a47d87a38539c396e6fddbb144829384785d1e
MFC r348347 (jhibbits): libdwarf: add missing powerpc64 relocation support

Due to missing relocation support in libdwarf for powerpc64, handling of
dwarf info on unlinked objects was bogus.

Examining raw dwarf data on objects compiled on ppc64 with a modern compiler
(in-tree gcc tends to hide the issue, since it only rarely generates
relocations in .debug_info and uses DW_FORM_str instead of DW_FORM_strp for
everything), you will find that the dwarf data appears corrupt, with
repeated references to the compiler version where things like types and
function names should appear.

This happens because the 0 offset of .debug_str contains the compiler
version, and without applying the relocations, *all* indirect strings in
.dwarf_info will end up pointing to it.

This corruption then propogates to the CTF data, as ctfconvert relies on
libdwarf to read the dwarf info, for every compiled object (when building a
kernel.)

However, if you examine the dwarf data on a compiled executable, it will
appear correct, because during final link the relocations get applied and
baked in by the linker.

Submitted by: Brandon Bergren
contrib/elftoolchain/libdwarf/libdwarf_reloc.c