[PATCH] D104060: Machine IR Profile

Ellis Hoag via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 28 16:23:58 PDT 2021


ellis added a comment.

In D104060#2839473 <https://reviews.llvm.org/D104060#2839473>, @MaskRay wrote:

>> Unfortunately this is not sufficient because we need to find the references once they are extracted out because the address ranges (either in the original binary and the extracted binary) are not valid or can be altered.
>
> I think extraction works but maybe your extraction operation is different?
>
> The `__llvm_prf_{data,cnts}` sections with D104556 <https://reviews.llvm.org/D104556> work this way. In the notation below, the address differences are in-memory.

Thanks for working on D104556 <https://reviews.llvm.org/D104556>. I'll have to study this to see if it can be extracted in all the same cases as MIP.

>   raw profile header:
>     CountersDelta = &D0 - &C0
>   
>   D0:
>     CounterPtr = (in-memory address difference) &D0 - &C0
>   D1:
>     CounterPtr = (in-memory address difference) &D1 - &C1
>   
>   C0: ...
>   C1: ...
>
> One can subtract CountersDelta from CounterPtr to get the on-disk D/C offset.
>
> D104556 <https://reviews.llvm.org/D104556> doesn't touch the `FunctionPointer` (absolute address) field in D.

I haven't looked into the `FunctionPointer` field, but I assume it generate dynamic relocations, which cannot be extracted from a shared library.

>> Use the ELF::SHF_GNU_RETAIN flag for the __llvm_mipmap section so that it doesn't get stripped by --gc-sections. The ELF::SHF_NOTE flag is not necessary.
>
> The problem is that all `__llvm_mipmap` sections will be retained, even if the referenced text sections are discarded.
> According to https://reviews.llvm.org/D96757#2567631 there could be a lot of waste.

It appears that only the mipmap header needs to be retained, so I'll update the flags.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D104060



More information about the llvm-commits mailing list