AArch64 uses $d* and $x* to interleave between text and data.
llvm-objdump didn't know about this so it ended up printing garbage. This is the initial support to to teach llvm-objdump how to behave correctly in this situation.
I think llvm-objdump needs a lot of love. For now, this is a missing functionality that blocks my lld AArch64 testing, so I implemented it in the most straightforward way. Comments are welcome, and appreciated.
Details
Diff Detail
Event Timeline
I'd rather we not loop over all the mapping symbols each time. Or at least do a binary search. Other than that it looks fine.
Much better, but I think it can still be improved.
auto DAI = std::lower_bound(Symbols.begin(), Symbols.end(), Index, SymCmp);
Index is >= Start, so you don't need to search past Symbols[si], no?
In fact, why do you need to search at all? When you are about to print a symbol from Start to End, you can check if the range for that symbol is data or not and you can do that by just maintaining a single "InCode" variable that is updated every time you pass a $x or $d.
Updated. Thank you for your help, Rafael!
This also now matches better with GNU objdump does, not showing mapping symbols.
tools/llvm-objdump/llvm-objdump.cpp | ||
---|---|---|
988 | As this is a target-independent file, shouldn't we also make sure $a and $t (for AArch32) are covered here? Are you going to do this in another patch? |
tools/llvm-objdump/llvm-objdump.cpp | ||
---|---|---|
988 | Hi James, I think I can take of this separately. Please file a PR and assign to me so I won't forget. Thanks, Davide |
As this is a target-independent file, shouldn't we also make sure $a and $t (for AArch32) are covered here? Are you going to do this in another patch?