]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
Add missing powerpc64 relocation support to libdwarf
authorjhibbits <jhibbits@FreeBSD.org>
Wed, 29 May 2019 02:02:56 +0000 (02:02 +0000)
committerjhibbits <jhibbits@FreeBSD.org>
Wed, 29 May 2019 02:02:56 +0000 (02:02 +0000)
commit70d77b35c08df3329b745af6efe69eeaf5bd4aea
tree71c70d1b50d109b291bff80fce0161f199cbe10f
parent48fe76d737cd7b17b3c8436d6591aa3893afc29e
Add missing powerpc64 relocation support to libdwarf

Summary:
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
Reviewed By: emaste
Differential Revision: https://reviews.freebsd.org/D20367
contrib/elftoolchain/libdwarf/libdwarf_reloc.c