[all-commits] [llvm/llvm-project] 25c303: [AIX] Change the linkage of profiling counter/data...

jsji via All-commits all-commits at lists.llvm.org
Tue Sep 28 17:47:52 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 25c30324e953c1c0011d1ab7529991db5c6ba741
      https://github.com/llvm/llvm-project/commit/25c30324e953c1c0011d1ab7529991db5c6ba741
  Author: Jinsong Ji <jji at us.ibm.com>
  Date:   2021-09-29 (Wed, 29 Sep 2021)

  Changed paths:
    M clang/test/Profile/cxx-templates.cpp
    M llvm/lib/Transforms/Instrumentation/InstrProfiling.cpp
    M llvm/test/Instrumentation/InstrProfiling/profiling.ll

  Log Message:
  -----------
  [AIX] Change the linkage of profiling counter/data to be private

We generate symbols like `profc`/`profd` for each function, and put them into csects.
When there are weak functions,  we generate weak symbols for the functions as well,
with ELF (and some others),  linker (binder) will discard and only keep one copy of the weak symbols.

However, on AIX, the current binder can NOT discard the weak symbols if we put all of them into the same csect,
as binder can NOT discard a subset of a csect.

This creates a unique challenge for using those symbols to calculate some relative offsets.

This patch changed the linkage of `profc`/`profd` symbols to be private, so that all the profc/profd for each weak symbol will be *local* to objects, and all kept in the csect, so we won't have problem. Although only one of the counters will be used, all the pointer in the profd is correct.

The downside is that we won't be able to discard the duplicated counters and profile data,
but those can not be discarded even if we keep the weak linkage,
due to the binder limitation of not discarding a subsect of the csect either .

Reviewed By: Whitney, MaskRay

Differential Revision: https://reviews.llvm.org/D110422




More information about the All-commits mailing list