1# REQUIRES: x86
2# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t
3# RUN: ld.lld %t -o %t2
4# RUN: llvm-readobj --sections -l %t2 | FileCheck %s
5
6# Check that different output sections with the same flags are merged into a
7# single Read/Write PT_LOAD.
8
9.section .r,"a"
10.globl _start
11_start:
12.quad 0
13
14.section .a,"aw"
15.quad 1
16
17.section .b,"aw"
18.quad 2
19
20# CHECK:        Name: .r
21# CHECK-NEXT:   Type: SHT_PROGBITS
22# CHECK-NEXT:   Flags [
23# CHECK-NEXT:     SHF_ALLOC
24# CHECK-NEXT:   ]
25# CHECK-NEXT:   Address:
26# CHECK-NEXT:   Offset: 0x158
27# CHECK-NEXT:   Size:
28# CHECK-NEXT:   Link:
29# CHECK-NEXT:   Info:
30# CHECK-NEXT:   AddressAlignment:
31# CHECK-NEXT:   EntrySize:
32# CHECK-NEXT: }
33
34# CHECK:      ProgramHeaders [
35# CHECK-NEXT:   ProgramHeader {
36# CHECK-NEXT:     Type: PT_PHDR (0x6)
37# CHECK-NEXT:     Offset: 0x40
38# CHECK-NEXT:     VirtualAddress: 0x200040
39# CHECK-NEXT:     PhysicalAddress: 0x200040
40# CHECK-NEXT:     FileSize: 280
41# CHECK-NEXT:     MemSize: 280
42# CHECK-NEXT:     Flags [ (0x4)
43# CHECK-NEXT:       PF_R (0x4)
44# CHECK-NEXT:     ]
45# CHECK-NEXT:     Alignment: 8
46# CHECK-NEXT:   }
47# CHECK-NEXT:   ProgramHeader {
48# CHECK-NEXT:     Type: PT_LOAD
49# CHECK-NEXT:     Offset: 0x0
50# CHECK-NEXT:     VirtualAddress:
51# CHECK-NEXT:     PhysicalAddress:
52# CHECK-NEXT:     FileSize: 352
53# CHECK-NEXT:     MemSize: 352
54# CHECK-NEXT:     Flags [
55# CHECK-NEXT:       PF_R
56# CHECK-NEXT:     ]
57# CHECK-NEXT:     Alignment:
58# CHECK-NEXT:   }
59# CHECK-NEXT:   ProgramHeader {
60# CHECK-NEXT:     Type: PT_LOAD
61# CHECK-NEXT:     Offset:
62# CHECK-NEXT:     VirtualAddress:
63# CHECK-NEXT:     PhysicalAddress:
64# CHECK-NEXT:     FileSize: 16
65# CHECK-NEXT:     MemSize: 16
66# CHECK-NEXT:     Flags [
67# CHECK-NEXT:       PF_R
68# CHECK-NEXT:       PF_W
69# CHECK-NEXT:     ]
70# CHECK-NEXT:     Alignment:
71# CHECK-NEXT:   }
72# CHECK-NEXT:   ProgramHeader {
73# CHECK-NEXT:     Type: PT_GNU_STACK
74# CHECK-NEXT:     Offset: 0x0
75# CHECK-NEXT:     VirtualAddress: 0x0
76# CHECK-NEXT:     PhysicalAddress: 0x0
77# CHECK-NEXT:     FileSize: 0
78# CHECK-NEXT:     MemSize: 0
79# CHECK-NEXT:     Flags [
80# CHECK-NEXT:       PF_R
81# CHECK-NEXT:       PF_W
82# CHECK-NEXT:     ]
83# CHECK-NEXT:     Alignment: 0
84# CHECK-NEXT:   }
85# CHECK-NEXT: ]
86