1# REQUIRES: x86
2# RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %p/Inputs/at8.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 AT > FLASH
14 .sec2 : { *(.sec2) } > RAM AT > FLASH
15 .sec3 : { *(.sec3) } > RAM AT > FLASH
16}
17
18# Make sure we do not issue a load-address overlap error
19# Previously, .sec3 would overwrite the LMAOffset in the
20# PT_LOAD header.
21
22# CHECK: Name              Type            Address          Off
23# CHECK: .text             PROGBITS        0000000008000000 000158
24# CHECK: .sec1             PROGBITS        0000000020000000 001000
25# CHECK: .sec2             PROGBITS        0000000020000008 001008
26# CHECK: .sec3             PROGBITS        0000000020000010 001010
27
28# CHECK: Program Headers:
29# CHECK:      Type  Offset   VirtAddr           PhysAddr
30# CHECK-NEXT: LOAD  0x001000 0x0000000020000000 0x0000000008000000
31# CHECK-NOT: LOAD
32