|
| 1 | +// REQUIRES: aarch64 |
| 2 | + |
1 | 3 | // RUN: rm -rf %t && split-file %s %t && cd %t |
2 | 4 |
|
3 | 5 | // RUN: llvm-mc -triple=aarch64 -filetype=obj %s -o %t11.o |
4 | | -// RUN: llvm-mc -triple=aarch64 -filetype=obj merged-mixed-2.s -o %t12.o |
5 | | -// RUN: llvm-mc -triple=aarch64 -filetype=obj merged-mixed-3.s -o %t13.o |
| 6 | +// RUN: llvm-mc -triple=aarch64 -filetype=obj merged-property.s -o %t12.o |
| 7 | +// RUN: llvm-mc -triple=aarch64 -filetype=obj merged-property2.s -o %t13.o |
6 | 8 | // RUN: ld.lld -r %t11.o %t12.o %t13.o -o %t.merged1.o |
7 | 9 | // RUN: llvm-readelf -n %t.merged1.o | FileCheck %s --check-prefix=NOTE-MIXED |
8 | 10 |
|
| 11 | +/// This test verifies merging of AArch64 build attributes and GNU property notes. |
| 12 | +/// Three object files are combined: one with build attributes (PAuth information, BTI, PAC, GCS), |
| 13 | +/// and two with GNU property notes encoding the same feature bits. |
| 14 | +/// PAuth ABI info is provided in one of the files and it is expected to be preserved in the merged output. |
| 15 | + |
9 | 16 | // NOTE-MIXED: Displaying notes found in: .note.gnu.property |
10 | 17 | // NOTE-MIXED-NEXT: Owner Data size Description |
11 | 18 | // NOTE-MIXED-NEXT: GNU 0x00000028 NT_GNU_PROPERTY_TYPE_0 (property note) |
12 | 19 | // NOTE-MIXED-NEXT: Properties: aarch64 feature: BTI, PAC |
13 | 20 | // NOTE-MIXED-NEXT: AArch64 PAuth ABI core info: platform 0x31 (unknown), version 0x13 |
14 | 21 |
|
15 | | -/// The Build attributes section appearing in the output of |
16 | | -/// llvm-mc should not appear in the output of lld, because |
17 | | -/// AArch64 build attributes are being transformed into .gnu.properties. |
18 | | - |
19 | 22 | // CHECK: .note.gnu.property |
20 | 23 | // CHECK-NOT: .ARM.attributes |
21 | 24 |
|
|
28 | 31 | .aeabi_attribute Tag_Feature_GCS, 1 |
29 | 32 |
|
30 | 33 |
|
31 | | -//--- merged-mixed-2.s |
| 34 | +//--- merged-property.s |
32 | 35 | .section ".note.gnu.property", "a" |
33 | | - .long 4 // Name length is always 4 ("GNU") |
34 | | - .long end - begin // Data length |
35 | | - .long 5 // Type: NT_GNU_PROPERTY_TYPE_0 |
36 | | - .asciz "GNU" // Name |
37 | | - .p2align 3 |
| 36 | + .long 0x4 // Name length is always 4 ("GNU") |
| 37 | + .long end - begin // Data length |
| 38 | + .long 0x5 // Type: NT_GNU_PROPERTY_TYPE_0 |
| 39 | + .asciz "GNU" // Name |
| 40 | + .p2align 0x3 |
38 | 41 | begin: |
39 | | - .long 0xc0000000 // GNU_PROPERTY_AARCH64_FEATURE_1_AND |
40 | | - .long 4 |
41 | | - .long 7 // GNU_PROPERTY_AARCH64_FEATURE_1_BTI, PAC and GCS |
42 | | - .long 0 |
| 42 | + .long 0xc0000000 // GNU_PROPERTY_AARCH64_FEATURE_1_AND |
| 43 | + .long 0x4 |
| 44 | + .long 0x7 // pr_data: BTI (1), PAC (2), GCS (4) = 0b111 = 7 |
| 45 | + .long 0x0 |
43 | 46 | // PAuth ABI property note |
44 | | - .long 0xc0000001 // Type: GNU_PROPERTY_AARCH64_FEATURE_PAUTH |
45 | | - .long 16 // Data size |
46 | | - .quad 49 // PAuth ABI platform |
47 | | - .quad 19 // PAuth ABI version |
48 | | - .p2align 3 // Align to 8 byte for 64 bit |
| 47 | + .long 0xc0000001 // GNU_PROPERTY_AARCH64_FEATURE_PAUTH |
| 48 | + .long 0x10 // Data length |
| 49 | + .quad 0x31 // PAuth ABI platform |
| 50 | + .quad 0x13 // PAuth ABI version |
| 51 | + .p2align 0x3 // Align to 8 byte for 64 bit |
49 | 52 | end: |
50 | 53 |
|
51 | | -//--- merged-mixed-3.s |
| 54 | +//--- merged-property2.s |
52 | 55 | .section .note.gnu.property, "a" |
53 | | - .align 4 |
54 | | - .long 4 // namesz |
55 | | - .long 0x10 // descsz |
56 | | - .long 5 // type (NT_GNU_PROPERTY_TYPE_0) |
57 | | - .asciz "GNU" // name (null-terminated) |
58 | | - .align 4 |
59 | | - .long 0xc0000000 // pr_type (GNU_PROPERTY_AARCH64_FEATURE_1_AND) |
60 | | - .long 4 // pr_datasz |
61 | | - .long 7 // pr_data: BTI (1), PAC (2), GCS (4) = 0b111 = 7 |
62 | | - .long 0 // padding or next property |
| 56 | + .align 0x4 |
| 57 | + .long 0x4 // Name length is always 4 ("GNU") |
| 58 | + .long end2 - begin2 // Data length |
| 59 | + .long 0x5 // Type: NT_GNU_PROPERTY_TYPE_0 |
| 60 | + .asciz "GNU" // Name |
| 61 | +begin2: |
| 62 | + .align 0x4 |
| 63 | + .long 0xc0000000 // Type: GNU_PROPERTY_AARCH64_FEATURE_1_AND |
| 64 | + .long 0x4 // Data length |
| 65 | + .long 0x7 // pr_data: BTI (1), PAC (2), GCS (4) = 0b111 = 7 |
| 66 | + .long 0x0 |
| 67 | +end2: |
0 commit comments