aboutsummaryrefslogtreecommitdiffstats
path: root/test/ELF/linkerscript/memory-include.test
blob: 340328225bde3efd09b94a849cef51806968149b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# REQUIRES: x86

# RUN: echo '.section .text,"ax"; .global _start; nop' > %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.o

# RUN: echo "RAM2 (rwx): ORIGIN = 0x3000, LENGTH = 0x100" > %t.inc
# RUN: ld.lld -o %t.elf --script %s %t.o -L %T
# RUN: llvm-objdump -section-headers %t.elf | FileCheck %s
# CHECK: .data         00000008 0000000000002000 DATA
# CHECK: .data2        00000008 0000000000003000 DATA

MEMORY {
  ROM (rwx): ORIGIN = 0x1000, LENGTH = 0x100
  RAM (rwx): ORIGIN = 0x2000, LENGTH = 0x100
  INCLUDE "memory-include.test.tmp.inc"
}

SECTIONS {
  .text : { *(.text*) } > ROM
  .data : { *(.data*) } > RAM
  .data2 : { QUAD(0) } > RAM2
}