blob: 1df263715bd91b3ee4fba20ac57f2355e0fd43ee [file] [log] [blame]
REQUIRES: x86_64-linux
This test ensures that llvm-profdata fails with a descriptive error message
when invoked on a memprof profiled binary which was built with position
independent code.
The input raw profile test has been generated from the following source code:
```
#include <stdlib.h>
#include <string.h>
int main(int argc, char **argv) {
char *x = (char *)malloc(10);
memset(x, 0, 10);
free(x);
x = (char *)malloc(10);
memset(x, 0, 10);
free(x);
return 0;
}
```
The following commands were used to compile the source to a memprof instrumented
executable and collect a raw binary format profile. Since the profile contains
virtual addresses for the callstack, we do not expect the raw binary profile to
be deterministic. The summary should be deterministic apart from changes to
the shared libraries linked in which could change the number of segments
recorded.
```
clang -fuse-ld=lld -Wl,--no-rosegment -gmlt -fdebug-info-for-profiling \
-fmemory-profile -mno-omit-leaf-frame-pointer -fno-omit-frame-pointer \
-fno-optimize-sibling-calls -m64 -Wl,-build-id -pie \
source.c -o pic.memprofexe
env MEMPROF_OPTIONS=log_path=stdout ./pic.memprofexe > pic.memprofraw
```
RUN: not llvm-profdata show --memory %p/Inputs/pic.memprofraw --profiled-binary %p/Inputs/pic.memprofexe -o - |& FileCheck %s
CHECK: Unsupported position independent code