|
1 |
| -// REQUIRES: linux |
| 1 | +// REQUIRES: linux, lld-available |
2 | 2 | //
|
3 | 3 | // Make sure the build-id can be found in both EXEC and DYN (PIE) files,
|
4 |
| -// even when the note's section-start is forced to a weird address. |
| 4 | +// even when the note has been loaded at an offset address in memory. |
5 | 5 | // (The DYN case would also apply to libraries, not explicitly tested here.)
|
6 | 6 |
|
7 | 7 | // DEFINE: %{cflags} =
|
8 |
| -// DEFINE: %{check} = ( \ |
9 |
| -// DEFINE: %clang_profgen -Wl,--build-id -o %t %s %{cflags} && \ |
10 |
| -// DEFINE: env LLVM_PROFILE_FILE=%t.profraw %run %t && \ |
11 |
| -// DEFINE: llvm-readelf --notes %t && \ |
12 |
| -// DEFINE: llvm-profdata show --binary-ids %t.profraw \ |
| 8 | +// DEFINE: %{check} = ( \ |
| 9 | +// DEFINE: %clang_profgen -fuse-ld=lld -Wl,--build-id -o %t %s %{cflags} && \ |
| 10 | +// DEFINE: env LLVM_PROFILE_FILE=%t.profraw %run %t && \ |
| 11 | +// DEFINE: llvm-readelf --notes %t && \ |
| 12 | +// DEFINE: llvm-profdata show --binary-ids %t.profraw \ |
13 | 13 | // DEFINE: ) | FileCheck %s
|
14 | 14 |
|
15 | 15 | // REDEFINE: %{cflags} = -no-pie
|
|
18 | 18 | // REDEFINE: %{cflags} = -pie -fPIE
|
19 | 19 | // RUN: %{check}
|
20 | 20 |
|
21 |
| -// REDEFINE: %{cflags} = -no-pie -Wl,--section-start=.note.gnu.build-id=0x1000000 |
| 21 | +// Moving the note after .bss also gives it extra LOAD segment padding, |
| 22 | +// making its memory offset different than its file offset. |
| 23 | +// RUN: echo "SECTIONS { .note.gnu.build-id : {} } INSERT AFTER .bss;" >%t.script |
| 24 | + |
| 25 | +// REDEFINE: %{cflags} = -no-pie -Wl,--script=%t.script |
22 | 26 | // RUN: %{check}
|
23 | 27 |
|
24 |
| -// REDEFINE: %{cflags} = -pie -fPIE -Wl,--section-start=.note.gnu.build-id=0x1000000 |
| 28 | +// REDEFINE: %{cflags} = -pie -fPIE -Wl,--script=%t.script |
25 | 29 | // RUN: %{check}
|
26 | 30 |
|
27 | 31 | // CHECK-LABEL{LITERAL}: .note.gnu.build-id
|
28 | 32 | // CHECK: Build ID: [[ID:[0-9a-f]+]]
|
29 | 33 |
|
| 34 | +// CHECK-LABEL{LITERAL}: Instrumentation level: Front-end |
30 | 35 | // CHECK-LABEL{LITERAL}: Binary IDs:
|
31 | 36 | // CHECK-NEXT: [[ID]]
|
32 | 37 |
|
|
0 commit comments