1// Test __llvm_profile_get_filename when the on-line merging mode is enabled.
2//
3// RUN: echo get_filename_from_DSO > shr.exp
4// RUN: %clang_pgogen -fPIC -shared %shared_linker_xopts -o %t.dso %p/../Inputs/instrprof-get-filename-dso.c
5// RUN: %clang_pgogen -o %t %s %t.dso
6// RUN: env LLVM_PROFILE_FILE="%t-%m.profraw" %run %t
7
8#include <string.h>
9
10const char *__llvm_profile_get_filename(void);
11extern const char *get_filename_from_DSO(void);
12
13int main(int argc, const char *argv[]) {
14 const char *filename1 = __llvm_profile_get_filename();
15 const char *filename2 = get_filename_from_DSO();
16
17 // Exit with code 1 if the two filenames are the same.
18 return strcmp(s1: filename1, s2: filename2) == 0;
19}
20

source code of compiler-rt/test/profile/Posix/instrprof-get-filename-merge-mode.c