1# REQUIRES: x86
2# RUN: llvm-mc -filetype=obj -triple=x86_64-linux-gnu %s -o %t.o
3# RUN: ld.lld %t.o -o %t
4# RUN: llvm-readobj --sections --program-headers %t | FileCheck %s
5
6## Test that we generate the PT_GNU_PROPERTY segment type that describes the
7## .note.gnu.property if it is present.
8
9# CHECK:      Name: .note.gnu.property
10# CHECK-NEXT: Type: SHT_NOTE (0x7)
11# CHECK-NEXT: Flags [ (0x2)
12# CHECK-NEXT:   SHF_ALLOC (0x2)
13# CHECK-NEXT: ]
14# CHECK-NEXT: Address: 0x200190
15# CHECK-NEXT: Offset: 0x190
16# CHECK-NEXT: Size: 32
17# CHECK-NEXT: Link: 0
18# CHECK-NEXT: Info: 0
19# CHECK-NEXT: AddressAlignment: 8
20
21# CHECK:      Type: PT_GNU_PROPERTY (0x6474E553)
22# CHECK-NEXT: Offset: 0x190
23# CHECK-NEXT: VirtualAddress: 0x200190
24# CHECK-NEXT: PhysicalAddress: 0x200190
25# CHECK-NEXT: FileSize: 32
26# CHECK-NEXT: MemSize: 32
27# CHECK-NEXT: Flags [ (0x4)
28# CHECK-NEXT:   PF_R (0x4)
29# CHECK-NEXT: ]
30# CHECK-NEXT: Alignment: 8
31
32.section ".note.gnu.property", "a"
33.long 4
34.long 0x10
35.long 0x5
36.asciz "GNU"
37
38.long 0xc0000002 # GNU_PROPERTY_X86_FEATURE_1_AND
39.long 4
40.long 1          # GNU_PROPERTY_X86_FEATURE_1_IBT
41.long 0
42
43.text
44.globl _start
45 ret
46