[compiler-rt][profile] Make corrupted-profile.c more robust
authorLeonard Chan <leonardchan@google.com>
Fri, 24 Sep 2021 00:16:47 +0000 (17:16 -0700)
committerLeonard Chan <leonardchan@google.com>
Fri, 24 Sep 2021 00:16:47 +0000 (17:16 -0700)
commitc579c658cd42034449d4fa19f28b43f2082c0991
tree06751f70bd99944c4e377c9a8418579f2e4a67ff
parentc965fde7c234abbb311ab9f58e8684970a69c916
[compiler-rt][profile] Make corrupted-profile.c more robust

This test specifically checks that profiles are not mergeable if there's a
change in the CounterPtr in the profile header. The test manually changes
CounterPtr by explicitly calling memset on some offset into the profile file.
This test would fail if binary IDs were emitted because the offset calculation
does not take into account the binary ID sizes.

This patch updates the test to use types provided in profile/InstrProfData.inc
to make it more resistant to profile layout changes.

Differential Revision: https://reviews.llvm.org/D110277
compiler-rt/test/profile/Linux/corrupted-profile.c