1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-25 12:12:47 +01:00
llvm-mirror/tools/obj2yaml
Alexander Yermolovich d12ae1eaf8 [LLD][LLVM] CG Graph profile using relocations
Currently when .llvm.call-graph-profile is created by llvm it explicitly encodes the symbol indices. This section is basically a black box for post processing tools. For example, if we run strip -s on the object files the symbol table changes, but indices in that section do not. In non-visible behavior indices point to wrong symbols. The visible behavior indices point outside of Symbol table: "invalid symbol index".

This patch changes the format by using R_*_NONE relocations to indicate the from/to symbols. The Frequency (Weight) will still be in the .llvm.call-graph-profile, but symbol information will be in relocation section. In LLD information from both sections is used to reconstruct call graph profile. Relocations themselves will never be applied.

With this approach post processing tools that handle relocations correctly work for this section also. Tools can add/remove symbols and as long as they handle relocation sections with this approach information stays correct.

Doing a quick experiment with clang-13.
The size went up from 107KB to 322KB, aggregate of all the input sections. Size of clang-13 binary is ~118MB. For users of -fprofile-use/-fprofile-sample-use the size of object files will go up slightly, it will not impact final binary size.

Reviewed By: jhenderson, MaskRay

Differential Revision: https://reviews.llvm.org/D104080
2021-06-24 09:09:33 -07:00
..
archive2yaml.cpp [yaml2obj][obj2yaml] - Teach tools to work with regular archives. 2020-10-28 15:27:11 +03:00
CMakeLists.txt [yaml2obj][obj2yaml] - Teach tools to work with regular archives. 2020-10-28 15:27:11 +03:00
coff2yaml.cpp Re-land "Migrate the rest of COFFObjectFile to Error" 2020-06-11 14:46:16 -07:00
dwarf2yaml.cpp [llvm] Use llvm::find_if (NFC) 2021-01-11 18:48:06 -08:00
elf2yaml.cpp [LLD][LLVM] CG Graph profile using relocations 2021-06-24 09:09:33 -07:00
macho2yaml.cpp [obj2yaml] Stop parsing the debug_str section when it encounters a string without the null terminator. 2020-09-08 16:09:36 +08:00
minidump2yaml.cpp [obj2yaml] - Cleanup error reporting (remove Error.cpp/.h files) 2020-08-26 14:25:11 +03:00
obj2yaml.cpp [NFC] Reordering parameters in getFile and getFileOrSTDIN 2021-03-25 09:47:49 -04:00
obj2yaml.h [yaml2obj][obj2yaml] - Teach tools to work with regular archives. 2020-10-28 15:27:11 +03:00
wasm2yaml.cpp [WebAssembly] Rename event to tag 2021-06-17 20:34:19 -07:00
xcoff2yaml.cpp [XCOFF][AIX] Enable tooling support for 64 bit symbol table parsing 2021-06-07 17:24:13 +00:00