llvm-project/clang/test/Profile
Jinsong Ji 25c30324e9 [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
2021-09-29 00:47:25 +00:00
..
Inputs [Coverage] Add support for Branch Coverage in LLVM Source-Based Code Coverage 2021-01-05 09:51:51 -06:00
README
branch-logical-mixed.cpp [Coverage] Fix Profile test failures from commit rG9f2967bcfe2f 2021-01-05 14:53:07 -06:00
branch-profdup.cpp [Coverage] Fix test failures from commit rG9f2967bcfe2f 2021-01-05 13:35:52 -06:00
c-avoid-direct-call.c
c-captured.c [test] Add {{.*}} to make tests immune to dso_local/dso_preemptable/(none) differences 2020-12-30 20:52:01 -08:00
c-collision.c [PGO] Fix computation of function Hash 2020-05-27 09:15:21 +02:00
c-counter-overflows.c Revert "Use uint64_t for branch weights instead of uint32_t" 2020-10-31 00:25:32 -07:00
c-general.c [Coverage] Add support for Branch Coverage in LLVM Source-Based Code Coverage 2021-01-05 09:51:51 -06:00
c-generate.c Reapply multiple "[clang][cli]" patches 2021-01-06 13:27:19 +01:00
c-indirect-call.c
c-linkage-available_externally.c [InstrProfiling] Make CountersPtr in __profd_ relative 2021-07-30 11:52:18 -07:00
c-linkage.c Revert test fixups after e9a9c85098 (which reverted a14fc74). 2021-06-04 10:42:25 -04:00
c-outdated-data.c
c-ternary.c [test] Add {{.*}} to make tests immune to dso_local/dso_preemptable/(none) differences 2020-12-30 20:52:01 -08:00
c-unprofiled-blocks.c [clang] Add mustprogress and llvm.loop.mustprogress attribute deduction 2020-11-04 22:03:14 -05:00
c-unprofiled.c
c-unreachable-after-switch.c [PGO, test] Fix typo in FileCheck var 2021-04-03 08:44:46 +01:00
coverage-prefix-map.c [Driver] Rename -fprofile-{prefix-map,compilation-dir} to -fcoverage-{prefix-map,compilation-dir} 2021-02-25 21:40:12 -08:00
cxx-abc-deleting-dtor.cpp [CodeGen] Apply 'nonnull' and 'dereferenceable(N)' to 'this' pointer 2020-11-16 17:39:17 -08:00
cxx-class.cpp Revert "Use uint64_t for branch weights instead of uint32_t" 2020-10-31 00:25:32 -07:00
cxx-hash-v2.cpp
cxx-implicit.cpp
cxx-indirect-call.cpp
cxx-lambda.cpp [Coverage] Add support for Branch Coverage in LLVM Source-Based Code Coverage 2021-01-05 09:51:51 -06:00
cxx-linkage.cpp Revert test fixups after e9a9c85098 (which reverted a14fc74). 2021-06-04 10:42:25 -04:00
cxx-missing-bodies.cpp
cxx-rangefor.cpp Revert "Use uint64_t for branch weights instead of uint32_t" 2020-10-31 00:25:32 -07:00
cxx-stmt-initializers.cpp
cxx-structors.cpp
cxx-templates.cpp [AIX] Change the linkage of profiling counter/data to be private 2021-09-29 00:47:25 +00:00
cxx-throws.cpp Revert "Use uint64_t for branch weights instead of uint32_t" 2020-10-31 00:25:32 -07:00
cxx-virtual-destructor-calls.cpp
def-assignop.cpp
def-ctors.cpp
def-dtors.cpp
func-entry.c
gcc-flag-compatibility-aix.c Update: clang/test/Profile/gcc-flag-compatibility.c to have -flto on AIX 2021-08-09 14:57:38 +00:00
gcc-flag-compatibility.c Update: clang/test/Profile/gcc-flag-compatibility.c to have -flto on AIX 2021-08-09 14:57:38 +00:00
objc-general.m Revert "Use uint64_t for branch weights instead of uint32_t" 2020-10-31 00:25:32 -07:00
profile-does-not-exist.c
profile-summary.c

README

These are tests for instrumentation based profiling.  This specifically means
the -fprofile-instr-generate and -fprofile-instr-use driver flags.

Tests in this directory should usually test both:

  - the generation of instrumentation (-fprofile-instr-generate), and
  - the use of profile data from instrumented runs (-fprofile-instr-use).

In order to test -fprofile-instr-use without actually running an instrumented
program, .profdata files are checked into Inputs/.

The input source files must include a main function such that building with
-fprofile-instr-generate and running the resulting program generates the same
.profdata file that is consumed by the tests for -fprofile-instr-use.  Even
tests that only check -fprofile-instr-use should include such a main function,
so that profile data can be regenerated as the .profdata file format evolves.