1# REQUIRES: x86
2# RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %p/Inputs/at7.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  RAM    : ORIGIN = 0x20000000, LENGTH = 0x200
8}
9
10SECTIONS {
11 .text : { *(.text) } > RAM AT> RAM
12 .sec  : { *(.sec)  } > RAM
13}
14
15# Make sure the memory for the .text section is only reserved once.
16# Previously, the location counter for both MemRegion and LMARegion
17# was increased unconditionally.
18
19
20# CHECK: Name              Type            Address          Off
21# CHECK: .text             PROGBITS        0000000020000000 001000
22# CHECK: .sec             PROGBITS        0000000020000001 001001
23
24# CHECK: Program Headers:
25# CHECK:      Type  Offset   VirtAddr           PhysAddr
26# CHECK-NEXT: LOAD  0x001000 0x0000000020000000 0x0000000020000000
27# CHECK-NEXT: LOAD  0x001001 0x0000000020000001 0x0000000020000001
28# CHECK-NOT: LOAD
29