68 lines · plain
1// REQUIRES: aarch642 3// RUN: rm -rf %t && split-file %s %t && cd %t4 5// RUN: llvm-mc -triple=aarch64 -filetype=obj %s -o %t11.o6// RUN: llvm-mc -triple=aarch64 -filetype=obj merged-property.s -o %t12.o7// RUN: llvm-mc -triple=aarch64 -filetype=obj merged-property2.s -o %t13.o8// RUN: ld.lld -r %t11.o %t12.o %t13.o -o %t.merged1.o9// RUN: llvm-readelf -n %t.merged1.o | FileCheck %s --check-prefix=NOTE-MIXED10 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 16// NOTE-MIXED: Displaying notes found in: .note.gnu.property17// NOTE-MIXED-NEXT: Owner Data size Description18// NOTE-MIXED-NEXT: GNU 0x00000028 NT_GNU_PROPERTY_TYPE_0 (property note)19// NOTE-MIXED-NEXT: Properties: aarch64 feature: BTI, PAC20// NOTE-MIXED-NEXT: AArch64 PAuth ABI core info: platform 0x31 (unknown), version 0x1321 22// CHECK: .note.gnu.property23// CHECK-NOT: .ARM.attributes24 25.aeabi_subsection aeabi_pauthabi, required, uleb12826.aeabi_attribute Tag_PAuth_Platform, 4927.aeabi_attribute Tag_PAuth_Schema, 1928.aeabi_subsection aeabi_feature_and_bits, optional, uleb12829.aeabi_attribute Tag_Feature_BTI, 130.aeabi_attribute Tag_Feature_PAC, 131.aeabi_attribute Tag_Feature_GCS, 132 33 34//--- merged-property.s35.section ".note.gnu.property", "a"36 .long 0x4 // Name length is always 4 ("GNU")37 .long end - begin // Data length38 .long 0x5 // Type: NT_GNU_PROPERTY_TYPE_039 .asciz "GNU" // Name40 .p2align 0x341begin:42 .long 0xc0000000 // GNU_PROPERTY_AARCH64_FEATURE_1_AND43 .long 0x444 .long 0x7 // pr_data: BTI (1), PAC (2), GCS (4) = 0b111 = 745 .long 0x046 // PAuth ABI property note47 .long 0xc0000001 // GNU_PROPERTY_AARCH64_FEATURE_PAUTH48 .long 0x10 // Data length49 .quad 0x31 // PAuth ABI platform50 .quad 0x13 // PAuth ABI version51 .p2align 0x3 // Align to 8 byte for 64 bit52end:53 54//--- merged-property2.s55.section .note.gnu.property, "a"56 .align 0x457 .long 0x4 // Name length is always 4 ("GNU")58 .long end2 - begin2 // Data length59 .long 0x5 // Type: NT_GNU_PROPERTY_TYPE_060 .asciz "GNU" // Name61begin2:62 .align 0x463 .long 0xc0000000 // Type: GNU_PROPERTY_AARCH64_FEATURE_1_AND64 .long 0x4 // Data length65 .long 0x7 // pr_data: BTI (1), PAC (2), GCS (4) = 0b111 = 766 .long 0x067end2:68