[profile][test] Add -no-pie to make value profile merge work on Linux with default PIE
authorFangrui Song <i@maskray.me>
Thu, 12 Aug 2021 05:41:52 +0000 (22:41 -0700)
committerFangrui Song <i@maskray.me>
Thu, 12 Aug 2021 05:41:52 +0000 (22:41 -0700)
Alpine enables PIE by default.

compiler-rt/test/profile/Linux/instrprof-value-merge-lld.c
compiler-rt/test/profile/Linux/instrprof-value-merge.c

index af3e92d..2f0282f 100644 (file)
@@ -1,7 +1,7 @@
 // REQUIRES: lld-available
 /// Test ld with GC.
 
-// RUN: %clang_pgogen -o %t -O3 %S/Inputs/instrprof-value-merge.c -fuse-ld=lld -ffunction-sections -fdata-sections -Wl,--gc-sections -z start-stop-gc
+// RUN: %clang_pgogen -o %t -O3 %S/Inputs/instrprof-value-merge.c -no-pie -fuse-ld=lld -ffunction-sections -fdata-sections -Wl,--gc-sections -z start-stop-gc
 // RUN: rm -rf %t.profdir
 // RUN: env LLVM_PROFILE_FILE=%t.profdir/default_%m.profraw %run %t
 // RUN: env LLVM_PROFILE_FILE=%t.profdir/default_%m.profraw %run %t
index ccc4287..dc239e8 100644 (file)
@@ -1,4 +1,6 @@
-// RUN: %clang_pgogen -o %t -O3 %S/Inputs/instrprof-value-merge.c
+/// Without PIE function addresses are the same across runs and their value
+/// sites can be merged, matching the test.
+// RUN: %clang_pgogen -o %t -O3 %S/Inputs/instrprof-value-merge.c -no-pie
 // RUN: rm -rf %t.profdir
 // RUN: env LLVM_PROFILE_FILE=%t.profdir/default_%m.profraw %run %t
 // RUN: env LLVM_PROFILE_FILE=%t.profdir/default_%m.profraw %run %t
@@ -9,7 +11,7 @@
 
 /// -z start-stop-gc requires binutils 2.37. Don't test the option for now.
 /// TODO: Add -Wl,--gc-sections.
-// RUN: %clang_pgogen -o %t -O3 %S/Inputs/instrprof-value-merge.c -fuse-ld=bfd -ffunction-sections -fdata-sections
+// RUN: %clang_pgogen -o %t -O3 %S/Inputs/instrprof-value-merge.c -no-pie -fuse-ld=bfd -ffunction-sections -fdata-sections
 // RUN: rm -rf %t.profdir
 // RUN: env LLVM_PROFILE_FILE=%t.profdir/default_%m.profraw %run %t
 // RUN: env LLVM_PROFILE_FILE=%t.profdir/default_%m.profraw %run %t
@@ -18,7 +20,7 @@
 // RUN: env LLVM_PROFILE_FILE=%t.profdir/default_%m.profraw %run %t 1
 // RUN: llvm-profdata show -counts -function=main -ic-targets -memop-sizes %t.profdir/default_*.profraw | FileCheck %S/Inputs/instrprof-value-merge.c
 
-// RUN: %clang_pgogen -o %t -O3 %S/Inputs/instrprof-value-merge.c -fuse-ld=gold -ffunction-sections -fdata-sections
+// RUN: %clang_pgogen -o %t -O3 %S/Inputs/instrprof-value-merge.c -no-pie -fuse-ld=gold -ffunction-sections -fdata-sections
 // RUN: rm -rf %t.profdir
 // RUN: env LLVM_PROFILE_FILE=%t.profdir/default_%m.profraw %run %t
 // RUN: env LLVM_PROFILE_FILE=%t.profdir/default_%m.profraw %run %t