mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2024-12-13 19:24:21 +00:00
[BOLT] Give precedence to first AddressMap entries
When parsing AddressMap and there is a conflict in keys, where two entries share the same key, consider the first entry as the correct one, instead of the last. This matches previous behavior in BOLT and covers case such as BOLT creating a new basic block but sharing the same input offset of the previous (or entry) basic block. In this case, instead of translating debuginfo to use the newly created BB, translate using the BB that was originally read from input. This will increase our chances of getting debuginfo right. Tested via binary comparison in tests: X86/dwarf4-df-input-lowpc-ranges.test X86/dwarf5-df-input-lowpc-ranges.test Reviewed By: #bolt, maksfb, jobnoorman Differential Revision: https://reviews.llvm.org/D158686
This commit is contained in:
parent
4d27dffb43
commit
b5ac1697c8
@ -52,7 +52,8 @@ AddressMap AddressMap::parse(StringRef Buffer, const BinaryContext &BC) {
|
||||
while (Cursor && !DE.eof(Cursor)) {
|
||||
const auto Input = DE.getAddress(Cursor);
|
||||
const auto Output = DE.getAddress(Cursor);
|
||||
Parsed.Map.insert({Input, Output});
|
||||
if (!Parsed.Map.count(Input))
|
||||
Parsed.Map.insert({Input, Output});
|
||||
}
|
||||
|
||||
assert(Cursor && "Error reading address map section");
|
||||
|
Loading…
Reference in New Issue
Block a user