I recently discovered that `.profraw` headers are expected to be 8 byte
aligned.
643ba926c1/llvm/lib/ProfileData/InstrProfReader.cpp (L503-L506)
When function entry coverage mode is used, function counters are single
bytes, so it is likely that the size of the counters section is not 8
byte aligned. We can add padding after the counters section to guarantee
this.
Reviewed By: kyulee, gulfem
Differential Revision: https://reviews.llvm.org/D152479
15 lines
720 B
Plaintext
15 lines
720 B
Plaintext
# When linking an instrumented shared libary, the produced raw profile may have
|
|
# multiple headers which must be 8 byte aligned. Check that the counter section
|
|
# sizes are 8 byte aligned when using function entry coverage by attempting to
|
|
# merge the raw profile.
|
|
|
|
RUN: mkdir -p %t.d
|
|
RUN: %clang_pgogen -mllvm -pgo-function-entry-coverage -o %t.d/libfoo.so -fPIC -shared %S/../Inputs/instrprof-shared-lib.c
|
|
RUN: %clang_pgogen -mllvm -pgo-function-entry-coverage -o %t -L%t.d -rpath %t.d -lfoo %S/../Inputs/instrprof-shared-main.c
|
|
RUN: env LLVM_PROFILE_FILE=%t.profraw %run %t
|
|
RUN: llvm-profdata merge -o %t.profdata %t.profraw
|
|
RUN: llvm-profdata show --covered %t.profdata | FileCheck %s
|
|
|
|
CHECK-DAG: main
|
|
CHECK-DAG: foo
|