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
This commit is contained in:
parent
d8b985430c
commit
d9a48fc632
@ -44,7 +44,7 @@ _dwarf_get_reloc_type(Dwarf_P_Debug dbg, int is64)
|
||||
case DW_ISA_SPARC:
|
||||
return (is64 ? R_SPARC_UA64 : R_SPARC_UA32);
|
||||
case DW_ISA_PPC:
|
||||
return (R_PPC_ADDR32);
|
||||
return (is64 ? R_PPC64_ADDR64 : R_PPC_ADDR32);
|
||||
case DW_ISA_ARM:
|
||||
return (R_ARM_ABS32);
|
||||
case DW_ISA_MIPS:
|
||||
@ -97,6 +97,12 @@ _dwarf_get_reloc_size(Dwarf_Debug dbg, Dwarf_Unsigned rel_type)
|
||||
if (rel_type == R_PPC_ADDR32)
|
||||
return (4);
|
||||
break;
|
||||
case EM_PPC64:
|
||||
if (rel_type == R_PPC_ADDR32)
|
||||
return (4);
|
||||
else if (rel_type == R_PPC64_ADDR64)
|
||||
return (8);
|
||||
break;
|
||||
case EM_MIPS:
|
||||
if (rel_type == R_MIPS_32)
|
||||
return (4);
|
||||
|
Loading…
x
Reference in New Issue
Block a user