brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.8 KiB · 6fc2eba Raw
41 lines · c
1// REQUIRES: linux, lld-available2//3// Make sure the build-id can be found in both EXEC and DYN (PIE) files,4// even when the note has been loaded at an offset address in memory.5// (The DYN case would also apply to libraries, not explicitly tested here.)6 7// DEFINE: %{cflags} =8 9// REDEFINE: %{cflags} = -no-pie10// RUN: %clang_profgen -fuse-ld=lld -Wl,--build-id -o %t %s %{cflags}11// RUN: env LLVM_PROFILE_FILE=%t.profraw %run %t12// RUN: llvm-readelf --notes %t > %t2 && llvm-profdata show --binary-ids %t.profraw >> %t2 && FileCheck %s < %t213 14// REDEFINE: %{cflags} = -pie -fPIE15// RUN: %clang_profgen -fuse-ld=lld -Wl,--build-id -o %t %s %{cflags}16// RUN: env LLVM_PROFILE_FILE=%t.profraw %run %t17// RUN: llvm-readelf --notes %t > %t2 && llvm-profdata show --binary-ids %t.profraw >> %t2 && FileCheck %s < %t218 19// Moving the note after .bss also gives it extra LOAD segment padding,20// making its memory offset different than its file offset.21// RUN: echo "SECTIONS { .note.gnu.build-id : {} } INSERT AFTER .bss;" >%t.script22 23// REDEFINE: %{cflags} = -no-pie -Wl,--script=%t.script24// RUN: %clang_profgen -fuse-ld=lld -Wl,--build-id -o %t %s %{cflags}25// RUN: env LLVM_PROFILE_FILE=%t.profraw %run %t26// RUN: llvm-readelf --notes %t > %t2 && llvm-profdata show --binary-ids %t.profraw >> %t2 && FileCheck %s < %t227 28// REDEFINE: %{cflags} = -pie -fPIE -Wl,--script=%t.script29// RUN: %clang_profgen -fuse-ld=lld -Wl,--build-id -o %t %s %{cflags}30// RUN: env LLVM_PROFILE_FILE=%t.profraw %run %t31// RUN: llvm-readelf --notes %t > %t2 && llvm-profdata show --binary-ids %t.profraw >> %t2 && FileCheck %s < %t232 33// CHECK-LABEL{LITERAL}: .note.gnu.build-id34// CHECK: Build ID: [[ID:[0-9a-f]+]]35 36// CHECK-LABEL{LITERAL}: Instrumentation level: Front-end37// CHECK-LABEL{LITERAL}: Binary IDs:38// CHECK-NEXT: [[ID]]39 40int main() { return 0; }41