Ed Maste | 6556aa6 | 2018-05-10 11:12:18 +0000 | [diff] [blame] | 1 | // REQUIRES: x86 |
George Rimar | 6b38018 | 2018-05-10 13:45:34 +0000 | [diff] [blame^] | 2 | // RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.o |
Ed Maste | 6556aa6 | 2018-05-10 11:12:18 +0000 | [diff] [blame] | 3 | // RUN: ld.lld %t.o -o %t -shared |
| 4 | // RUN: llvm-readobj -program-headers -sections %t | FileCheck %s |
| 5 | |
George Rimar | 6b38018 | 2018-05-10 13:45:34 +0000 | [diff] [blame^] | 6 | // PR37361: A note without SHF_ALLOC should not be included into a PT_NOTE program header. |
Ed Maste | 6556aa6 | 2018-05-10 11:12:18 +0000 | [diff] [blame] | 7 | |
George Rimar | 6b38018 | 2018-05-10 13:45:34 +0000 | [diff] [blame^] | 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:.*]] |
Ed Maste | 6556aa6 | 2018-05-10 11:12:18 +0000 | [diff] [blame] | 16 | |
George Rimar | 6b38018 | 2018-05-10 13:45:34 +0000 | [diff] [blame^] | 17 | // Check we still emit the non-alloc SHT_NOTE section and keep its type. |
Ed Maste | 6556aa6 | 2018-05-10 11:12:18 +0000 | [diff] [blame] | 18 | |
George Rimar | 6b38018 | 2018-05-10 13:45:34 +0000 | [diff] [blame^] | 19 | // CHECK: Name: .note.b |
| 20 | // CHECK-NEXT: Type: SHT_NOTE |
| 21 | // CHECK-NEXT: Flags [ |
| 22 | // CHECK-NEXT: ] |
Ed Maste | 6556aa6 | 2018-05-10 11:12:18 +0000 | [diff] [blame] | 23 | |
George Rimar | 6b38018 | 2018-05-10 13:45:34 +0000 | [diff] [blame^] | 24 | // CHECK: ProgramHeader { |
| 25 | // CHECK: Type: PT_NOTE |
| 26 | // CHECK-NEXT: Offset: |
| 27 | // CHECK-NEXT: VirtualAddress: 0x[[ADDR]] |
| 28 | // CHECK-NEXT: PhysicalAddress: 0x245 |
| 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 |