diff options
author | Amir Ayupov <aaupov@fb.com> | 2021-12-01 21:14:56 -0800 |
---|---|---|
committer | Maksim Panchenko <maks@fb.com> | 2021-12-01 21:14:56 -0800 |
commit | 6aa735ceaf63150690923e9e5e0319eace3056f8 (patch) | |
tree | 9c09a00012629d64d88d8087994318afe7fa981d /bolt/lib/Rewrite/ExecutableFileMemoryManager.cpp | |
parent | 69706eafab6b22e4e182762b43e2e7c5f299c3d7 (diff) | |
download | llvm-6aa735ceaf63150690923e9e5e0319eace3056f8.zip llvm-6aa735ceaf63150690923e9e5e0319eace3056f8.tar.gz llvm-6aa735ceaf63150690923e9e5e0319eace3056f8.tar.bz2 |
[BOLT] Split functions: support fragments with multiple parents
Summary:
Gracefully handle binaries with split functions where two fragments are folded
into one, resulting in a fragment with two parent functions.
This behavior is expected in GCC8+ with -O2 optimization level, where both
function splitting and ICF are enabled by default.
On the BOLT side, the changes are:
- BinaryFunction: allow multiple parent fragments:
- `ParentFragment` --> `ParentFragments`,
- `setParentFragment` --> `addParentFragment`.
- BinaryContext:
- `populateJumpTables`: mark fragments to be skipped later,
- `registerFragment`: add a name heuristic check, return false if it failed,
- `processInterproceduralReferences`: check if `registerFragment`
succeeded, otherwise issue a warning,
- `skipMarkedFragments`: move out fragment traversal and skipping from
`populateJumpTables` into a separate function.
This change fixes an issue where unrelated functions might be registered
as fragments:
```
BOLT-WARNING: interprocedural reference between unrelated fragments:
bad_gs/1(*2) and amd_decode_mce.cold.27/1(*2)
```
(Linux kernel binary)
(cherry picked from FBD32786688)
Diffstat (limited to 'bolt/lib/Rewrite/ExecutableFileMemoryManager.cpp')
0 files changed, 0 insertions, 0 deletions