memory-at.test
1.24 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# REQUIRES: x86
# RUN: echo '.section .text,"ax"; .quad 0' > %t.s
# RUN: echo '.section .data,"aw"; .quad 0' >> %t.s
# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %t.s -o %t
# RUN: ld.lld %t --script %s -o %t2
# RUN: llvm-readobj -l %t2 | FileCheck %s
MEMORY {
FLASH (rx) : ORIGIN = 0x1000, LENGTH = 0x100
RAM (rwx) : ORIGIN = 0x2000, LENGTH = 0x100
}
SECTIONS {
.text : { *(.text*) } > FLASH
__etext = .;
.data : AT (__etext) { *(.data*) } > RAM
}
# CHECK: ProgramHeaders [
# CHECK-NEXT: ProgramHeader {
# CHECK-NEXT: Type: PT_LOAD
# CHECK-NEXT: Offset: 0x1000
# CHECK-NEXT: VirtualAddress: 0x1000
# CHECK-NEXT: PhysicalAddress: 0x1000
# CHECK-NEXT: FileSize: 8
# CHECK-NEXT: MemSize: 8
# CHECK-NEXT: Flags [
# CHECK-NEXT: PF_R
# CHECK-NEXT: PF_X
# CHECK-NEXT: ]
# CHECK-NEXT: Alignment:
# CHECK-NEXT: }
# CHECK-NEXT: ProgramHeader {
# CHECK-NEXT: Type: PT_LOAD
# CHECK-NEXT: Offset: 0x2000
# CHECK-NEXT: VirtualAddress: 0x2000
# CHECK-NEXT: PhysicalAddress: 0x1008
# CHECK-NEXT: FileSize: 8
# CHECK-NEXT: MemSize: 8
# CHECK-NEXT: Flags [
# CHECK-NEXT: PF_R
# CHECK-NEXT: PF_W
# CHECK-NEXT: ]
# CHECK-NEXT: Alignment:
# CHECK-NEXT: }