This is an archive of the discontinued LLVM Phabricator instance.

[RFC][BOLT] Create an independent namespace for jump tables
AbandonedPublic

Authored by rafauler on Sep 16 2022, 6:42 PM.

Details

Reviewers
Amir
maksfb
Group Reviewers
Restricted Project
Summary

Make jump tables inaccessible via our global symbol
table. Make jump table symbols only accessible via
BinaryContext::getOrCreateJumpTable(), called by our jump table
recognition heuristics. In practice, this means that any data access
in code will not reference a jump table, unless disassembly/cfg
analysis explictly recognize the code fragment as accessing a jump
table.

This solves bugs related to regular data references in code
accidentally being bound to a jump table, and this reference being
updated to a new (incorrect) location because we moved this jump
table.

An alternative solution to this would be to honor the connection of
JumpTable objects with their respective BinaryData entries (in the
global symbol table). To make this consistent, we would further need
to change jump table emission to emit all labels in BinaryData at that
location whenever emitting a jump table. Currently, this is
inconsistent and jump tables are poorly synced with the global symbol
table. This solution is more complicated than severing the connection
between jump table and the global symbols (do not publish a jump table
in our global symbol table), and will also lead to less functions
being processed (albeit this number should be small).

Fixes #55004

Diff Detail

Event Timeline

rafauler created this revision.Sep 16 2022, 6:42 PM
Herald added a reviewer: maksfb. · View Herald Transcript
Herald added a project: Restricted Project. · View Herald Transcript
rafauler requested review of this revision.Sep 16 2022, 6:42 PM
Herald added a project: Restricted Project. · View Herald TranscriptSep 16 2022, 6:42 PM
rafauler planned changes to this revision.Sep 16 2022, 6:43 PM

This diff is published for discussion only. The alternative implementation that is the most popular solution is in https://reviews.llvm.org/D134098.

rafauler abandoned this revision.Sep 16 2022, 7:01 PM