45 lines · plain
1# REQUIRES: x862# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %p/Inputs/at2.s -o %t.o3# RUN: ld.lld -o %t.exe %t.o --script %s4# RUN: llvm-readelf -l %t.exe | FileCheck %s5# RUN: llvm-objdump --section-headers %t.exe | FileCheck %s --check-prefix=SECTIONS6 7MEMORY {8 AX (ax) : ORIGIN = 0x2000, LENGTH = 0x1009 AW (aw) : ORIGIN = 0x3000, LENGTH = 0x10010 FLASH (ax) : ORIGIN = 0x6000, LENGTH = 0x10011 RAM (aw) : ORIGIN = 0x7000, LENGTH = 0x10012}13 14SECTIONS {15 .foo1 : { *(.foo1) } > AX AT>FLASH16## In GNU ld, .foo1's LMA region is propagated to .foo2 because their VMA region17## is the same and .foo2 does not set an explicit address.18## lld sets .foo2's LMA region to null.19 .foo2 : { *(.foo2) } > AX20 21 .bar1 : { *(.bar1) } > AW22 .bar2 : { *(.bar2) } > "AW" AT > "RAM"23 .bar3 . : { *(.bar3) } > AW24 .bar4 : { *(.bar4) } > AW AT >RAM25}26 27# CHECK: Type Offset VirtAddr PhysAddr FileSiz MemSiz Flg Align28# CHECK-NEXT: LOAD 0x001000 0x0000000000002000 0x0000000000006000 0x000008 0x000008 R E 0x100029# CHECK-NEXT: LOAD 0x001008 0x0000000000002008 0x0000000000002008 0x000008 0x000008 R E 0x100030# CHECK-NEXT: LOAD 0x002000 0x0000000000003000 0x0000000000003000 0x000008 0x000008 RW 0x100031# CHECK-NEXT: LOAD 0x002008 0x0000000000003008 0x0000000000007000 0x000008 0x000008 RW 0x100032# CHECK-NEXT: LOAD 0x002010 0x0000000000003010 0x0000000000003010 0x000008 0x000008 RW 0x100033# CHECK-NEXT: LOAD 0x002018 0x0000000000003018 0x0000000000007008 0x000008 0x000008 RW 0x100034 35# SECTIONS: Sections:36# SECTIONS-NEXT: Idx Name Size VMA37# SECTIONS-NEXT: 0 00000000 000000000000000038# SECTIONS-NEXT: 1 .foo1 00000008 000000000000200039# SECTIONS-NEXT: 2 .foo2 00000008 000000000000200840# SECTIONS-NEXT: 3 .text 00000000 000000000000201041# SECTIONS-NEXT: 4 .bar1 00000008 000000000000300042# SECTIONS-NEXT: 5 .bar2 00000008 000000000000300843# SECTIONS-NEXT: 6 .bar3 00000008 000000000000301044# SECTIONS-NEXT: 7 .bar4 00000008 000000000000301845