[PATCH] D96757: [InstrProfiling] Use ELF section groups for counters, data and values

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 18 00:18:36 PST 2021


MaskRay accepted this revision.
MaskRay added a comment.

I have checked that the .o size increase should not be a concern for my internal users. So, LG, but the description needs some clarification.

> C identifier name input sections such as __llvm_prf_* are GC roots so they cannot be discarded.

Sorry, my previous wording is inaccurate. It should be: `__start_/__stop_ references retain C identifier name sections`.
This is different from being GC roots.

> The ELF section group semantics ensures that group members are retained or discarded as a unit. When a function symbol is discarded, this allows allows linker to discard counters, data and values associated with that function symbol as well.

I don't find incoming or outgoing relocations with `__llvm_prf_names`, but it appears to be a parallel table to `__llvm_prf_cnts`/`__llvm_prf_data`.
The idea is that `__llvm_prf_cnts` can be properly handled with the traditional GC semantics (text sections keep it live).
We use a section group to let `__llvm_prf_cnts` retain the associated `__llvm_prf_names` (and probably also `__llvm_prf_vals`).
Hope @davidxl can elaborate on the usage of these sections to make this paragraph accurate.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D96757



More information about the llvm-commits mailing list