This patch adds getFirstInstructionOffset method for BinaryFunction which is used to properly handle cases where data is at zero offset in a function. The main change is that we add basic block at first instruction offset when disassembling, which prevents assertion failures in buildCFG.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
Overall LGTM
bolt/test/AArch64/data-at-0-offset.c | ||
---|---|---|
4 | Which warning is supposed to be here? Please update with more specific string |
bolt/test/AArch64/data-at-0-offset.c | ||
---|---|---|
2 |
Seems like clang used on buildkite doesn't mark .space directive as data, changed test to use repeated .byte instead
bolt/test/AArch64/data-at-0-offset.c | ||
---|---|---|
4 | Well, without my patch it just fails with assertion llvm-project/bolt/lib/Core/BinaryFunction.cpp:1982: bool llvm::bolt::BinaryFunction::buildCFG(llvm::bolt::MCPlusBuilder::AllocatorIdTy): Assertion 'PrevBB && "no previous basic block for a fall through"' failed. But just in case i now added check for disassembling failure. |
Thanks for reviewing @yota9 and thanks for your contribution @treapster. Do you need me to commit this?
@rafauler, yes, it'll be cool if you commit. My author string is Denis Revunov <revunov.denis@huawei-partners.com>. Thanks in advance!