[BOLT][AArch64] Detect veneers with missing data markers (#142069)
The linker may omit data markers for long absolute veneers causing BOLT to treat data as code. Detect such veneers and introduce data markers artificially before BOLT's disassembler kicks in.
This commit is contained in:
@@ -1341,6 +1341,19 @@ void RewriteInstance::discoverFileObjects() {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// The linker may omit data markers for absolute long veneers. Introduce
|
||||
// those markers artificially to assist the disassembler.
|
||||
for (BinaryFunction &BF :
|
||||
llvm::make_second_range(BC->getBinaryFunctions())) {
|
||||
if (BF.getOneName().starts_with("__AArch64AbsLongThunk_") &&
|
||||
BF.getSize() == 16 && !BF.getSizeOfDataInCodeAt(8)) {
|
||||
BC->errs() << "BOLT-WARNING: missing data marker detected in veneer "
|
||||
<< BF << '\n';
|
||||
BF.markDataAtOffset(8);
|
||||
BC->AddressToConstantIslandMap[BF.getAddress() + 8] = &BF;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!BC->IsLinuxKernel) {
|
||||
|
||||
Reference in New Issue
Block a user