[PATCH] D77858: [llvm-xray] Add llvm-xray extract support for 32 bit ARM

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 13 17:57:34 PDT 2020


MaskRay added a comment.

In D77858#1978965 <https://reviews.llvm.org/D77858#1978965>, @johnislarry wrote:

> Ah yeah, I see the assertion you're talking about.  It looks like the RelocationResolver for arm is incomplete maybe?  I've attached a picture of something I tried, but down the road it can't find the address for the symbol.
>
> F11726277: Screenshot 2020-04-13 17.00.19.png <https://reviews.llvm.org/F11726277>


`Object/RelocationResolver.cpp` is for static relocation types. It acts like a linker. `R_*_RELATIVE` are dynamic relocations typically handled by ld.so. `Object/RelocationResolver.cpp` does not need to know dynamic relocations. For certain dynamic relocations, there simply isn't enough information. In this case (EM_ARM is a REL target), we need to read the value from the executable to get the addend.

> It also looks like this doesn't affect results in release builds because later when we call RelocateOrElse, we always have an address, so we ignore the relocations entirely.
> 
> I would appreciate you taking it from here, but please let me know if it falls off your radar so I can pick it back up!

The problem is that the addresses in `xray_instr_map` do not need to use absolute addresses. They should be PC-relative initially to avoid `R_*_RELATIVE`. I am going to fix that so that we will not see `R_*_RELATIVE` in executables/shared objects. The status is unfortunately sad for 64-bit MIPS, which does not have a 64-bit relocation type `R_MIPS_PC64`. Interestingly, I just closed a bug related to `R_MIPS_PC64`... https://bugs.llvm.org/show_bug.cgi?id=44991

> At FB we're starting to use xray on Android to better understand our native code execution, so definitely interested in getting ARM variants working!

Ah, thanks!


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D77858/new/

https://reviews.llvm.org/D77858





More information about the llvm-commits mailing list