[PATCH] D76802: [InstrProfiling] Use !associated metadata for counters, data and values

Petr Hosek via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Jan 27 21:47:51 PST 2021


phosek added a comment.

In D76802#2526483 <https://reviews.llvm.org/D76802#2526483>, @MaskRay wrote:

> Looks quite good.
>
> In D76802#2526382 <https://reviews.llvm.org/D76802#2526382>, @phosek wrote:
>
>> @MaskRay does this look good to you?
>
> Looks like GNU ld has an infinite loop problem w.r.t self-link SHF_LINK_ORDER: https://sourceware.org/bugzilla/show_bug.cgi?id=27259

Thanks for checking this.

>> The reason is that the C identifier sections are considered as GC roots. Adding SHF_LINK_ORDER is a trick to defeat the GC root semantics.
>
> Hope GNU ld can implement the rule. For now, only `-fbinutils-version=none` can use this.

I've updated the logic to reflect that.

> About `counter-associated-metadata`: perhaps we should just call it `linkorder-counter`. `!associated` while being metadata, is actually similar to `, comdat` (it cannot be freely dropped) and its semantics is tightly coupled with `SHF_LINK_ORDER`. linkorder conveys more information than `associated` (`associated` can mean many things).

Done.

In D76802#2526485 <https://reviews.llvm.org/D76802#2526485>, @MaskRay wrote:

> Please also comment (and update the description) that self-link may be used. This is subtle. The reason is that the ELF section names (e.g. `__llvm_prf_cnts`) are C identifiers and considered GC roots in the absence of the `SHF_LINK_ORDER` flag.

Done.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D76802



More information about the cfe-commits mailing list