1// REQUIRES: x86
2// RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.o
3// RUN: ld.lld %t.o -o %t -shared
4// RUN: llvm-readobj -l --sections %t | FileCheck %s
5
6// PR37361: A note without SHF_ALLOC should not be included into a PT_NOTE program header.
7
8// CHECK:      Section {
9// CHECK:        Index:
10// CHECK:        Name: .note.a
11// CHECK-NEXT:   Type: SHT_NOTE
12// CHECK-NEXT:   Flags [
13// CHECK-NEXT:     SHF_ALLOC
14// CHECK-NEXT:   ]
15// CHECK-NEXT:   Address: 0x[[ADDR:.*]]
16
17// Check we still emit the non-alloc SHT_NOTE section and keep its type.
18
19// CHECK:        Name: .note.b
20// CHECK-NEXT:   Type: SHT_NOTE
21// CHECK-NEXT:   Flags [
22// CHECK-NEXT:   ]
23
24// CHECK:      ProgramHeader {
25// CHECK:        Type: PT_NOTE
26// CHECK-NEXT:   Offset:
27// CHECK-NEXT:   VirtualAddress: 0x[[ADDR]]
28// CHECK-NEXT:   PhysicalAddress: 0x[[ADDR]]
29// CHECK-NEXT:   FileSize: 16
30// CHECK-NEXT:   MemSize: 16
31// CHECK-NOT:  PT_NOTE
32
33.section        .note.a,"a",@note
34.quad 1
35.quad 2
36
37.section        .note.b,"",@note
38.quad 3
39