1# REQUIRES: x86
2# RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %p/Inputs/at6.s -o %t.o
3# RUN: ld.lld %t.o --script %s -o %t
4# RUN: llvm-readelf -sections -program-headers %t | FileCheck %s
5
6MEMORY {
7  FLASH : ORIGIN = 0x08000000, LENGTH = 0x100
8  RAM   : ORIGIN = 0x20000000, LENGTH = 0x200
9}
10
11SECTIONS {
12 .text : { *(.text) } > FLASH
13 .sec1 : { *(.sec1) } > RAM
14 .sec2 : { *(.sec2) } > RAM AT > FLASH
15}
16
17# Make sure we create a separate PT_LOAD entry for .sec2. Previously,
18# it was added to the PT_LOAD entry of .sec1
19
20# CHECK: Name              Type            Address          Off
21# CHECK: .text             PROGBITS        0000000008000000 001000
22# CHECK: .sec1             PROGBITS        0000000020000000 002000
23# CHECK: .sec2             PROGBITS        0000000020000004 002004
24
25# CHECK: Program Headers:
26# CHECK:      Type  Offset   VirtAddr           PhysAddr
27# CHECK-NEXT: LOAD  0x001000 0x0000000008000000 0x0000000008000000
28# CHECK-NEXT: LOAD  0x002000 0x0000000020000000 0x0000000020000000
29# CHECK-NEXT: LOAD  0x002004 0x0000000020000004 0x0000000008000001
30# CHECK-NOT: LOAD
31