[BOLT] For non-simple functions always update jump tables in-place

Summary:
For non-simple function we can miss a reference to a jump table or
to an indirect goto table. If we move the jump table, the missed
reference will not get updated, and the corresponding indirect jump
will end up in the old (wrong) location. Updating the original jump
table in-place should take care of the issue.

(cherry picked from FBD13849776)
This commit is contained in:
Maksim Panchenko 2019-01-28 13:46:18 -08:00
parent af81c7ff80
commit 365bd1f1c8
1 changed files with 1 additions and 1 deletions

View File

@ -3757,7 +3757,7 @@ void BinaryFunction::emitJumpTables(MCStreamer *Streamer) {
auto &JT = *JTI.second;
if (opts::PrintJumpTables)
JT.print(outs());
if (opts::JumpTables == JTS_BASIC && BC.HasRelocations) {
if ((opts::JumpTables == JTS_BASIC || !isSimple()) && BC.HasRelocations) {
JT.updateOriginal();
} else {
MCSection *HotSection, *ColdSection;