xref: /aosp_15_r20/external/compiler-rt/test/profile/Linux/instrprof-dlopen.test (revision 7c3d14c8b49c529e04be81a3ce6f5cc23712e4c6)
1*7c3d14c8STreehugger RobotRUN: mkdir -p %t.d
2*7c3d14c8STreehugger RobotRUN: %clang_profgen -o %t.d/func.shared -fPIC -shared -fdata-sections -ffunction-sections -fuse-ld=gold -Wl,--gc-sections  %S/../Inputs/instrprof-dlopen-func.c
3*7c3d14c8STreehugger RobotRUN: %clang_profgen -o %t.d/func2.shared -fPIC -shared -fdata-sections -ffunction-sections -fuse-ld=gold -Wl,--gc-sections  %S/../Inputs/instrprof-dlopen-func2.c
4*7c3d14c8STreehugger RobotRUN: %clang -o %t-local -fPIC -DDLOPEN_FUNC_DIR=\"%t.d\" -DDLOPEN_FLAGS="RTLD_LAZY | RTLD_LOCAL" %S/../Inputs/instrprof-dlopen-main.c
5*7c3d14c8STreehugger RobotRUN: %clang -o %t-global -fPIC -DDLOPEN_FUNC_DIR=\"%t.d\" -DDLOPEN_FLAGS="RTLD_LAZY | RTLD_GLOBAL" %S/../Inputs/instrprof-dlopen-main.c
6*7c3d14c8STreehugger Robot
7*7c3d14c8STreehugger RobotRUN: %clang -c -o %t.d/main.o %S/../Inputs/instrprof-dlopen-main.c
8*7c3d14c8STreehugger RobotRUN: %clang_profgen -fdata-sections -ffunction-sections -fuse-ld=gold -Wl,--gc-sections  -o %t-static %S/../Inputs/instrprof-dlopen-func.c %S/../Inputs/instrprof-dlopen-func2.c %t.d/main.o
9*7c3d14c8STreehugger Robot
10*7c3d14c8STreehugger RobotRUN: env LLVM_PROFILE_FILE=%t-static.profraw %run %t-static
11*7c3d14c8STreehugger RobotRUN: env LLVM_PROFILE_FILE=%t-local.profraw %run %t-local
12*7c3d14c8STreehugger RobotRUN: env LLVM_PROFILE_FILE=%t-global.profraw %run %t-global
13*7c3d14c8STreehugger Robot
14*7c3d14c8STreehugger RobotRUN: llvm-profdata merge -o %t-static.profdata %t-static.profraw
15*7c3d14c8STreehugger RobotRUN: llvm-profdata merge -o %t-local.profdata %t-local.profraw
16*7c3d14c8STreehugger RobotRUN: llvm-profdata merge -o %t-global.profdata %t-global.profraw
17*7c3d14c8STreehugger Robot
18*7c3d14c8STreehugger RobotRUN: %clang_profuse=%t-static.profdata -o %t-func.static.ll -S -emit-llvm %S/../Inputs/instrprof-dlopen-func.c
19*7c3d14c8STreehugger RobotRUN: %clang_profuse=%t-local.profdata -o %t-func.local.ll -S -emit-llvm %S/../Inputs/instrprof-dlopen-func.c
20*7c3d14c8STreehugger RobotRUN: %clang_profuse=%t-global.profdata -o %t-func.global.ll -S -emit-llvm %S/../Inputs/instrprof-dlopen-func.c
21*7c3d14c8STreehugger RobotRUN: diff %t-func.static.ll %t-func.local.ll
22*7c3d14c8STreehugger RobotRUN: diff %t-func.static.ll %t-func.global.ll
23*7c3d14c8STreehugger Robot
24*7c3d14c8STreehugger RobotRUN: %clang_profuse=%t-static.profdata -o %t-func2.static.ll -S -emit-llvm %S/../Inputs/instrprof-dlopen-func2.c
25*7c3d14c8STreehugger RobotRUN: %clang_profuse=%t-local.profdata -o %t-func2.local.ll -S -emit-llvm %S/../Inputs/instrprof-dlopen-func2.c
26*7c3d14c8STreehugger RobotRUN: %clang_profuse=%t-global.profdata -o %t-func2.global.ll -S -emit-llvm %S/../Inputs/instrprof-dlopen-func2.c
27*7c3d14c8STreehugger RobotRUN: diff %t-func2.static.ll %t-func2.local.ll
28*7c3d14c8STreehugger RobotRUN: diff %t-func2.static.ll %t-func2.global.ll
29*7c3d14c8STreehugger Robot
30*7c3d14c8STreehugger RobotRUN: %clang_profuse=%t-static.profdata -o %t-main.static.ll -S -emit-llvm %S/../Inputs/instrprof-dlopen-main.c
31*7c3d14c8STreehugger RobotRUN: %clang_profuse=%t-local.profdata -o %t-main.local.ll -S -emit-llvm %S/../Inputs/instrprof-dlopen-main.c
32*7c3d14c8STreehugger RobotRUN: %clang_profuse=%t-local.profdata -o %t-main.global.ll -S -emit-llvm %S/../Inputs/instrprof-dlopen-main.c
33*7c3d14c8STreehugger RobotRUN: diff %t-main.static.ll %t-main.local.ll
34*7c3d14c8STreehugger RobotRUN: diff %t-main.static.ll %t-main.global.ll
35