• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# REQUIRES: x86
2
3# RUN: echo '.section .text,"ax"; .global _start; nop' > %t.s
4# RUN: echo '.section .data,"aw"; .quad 0' >> %t.s
5# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %t.s -o %t.o
6
7## Empty include file.
8# RUN: rm -rf %t.dir && mkdir -p %t.dir
9# RUN: echo "" > %t.dir/inc.script
10# RUN: ld.lld -o %t.elf --script %s %t.o -L %t.dir
11# RUN: llvm-objdump --section-headers %t.elf | FileCheck %s --check-prefix=CHECK1
12# CHECK1: .data         00000008 0000000000002000 DATA
13
14## Non-empty include file.
15# RUN: echo "QUAD(0)" > %t.dir/inc.script
16# RUN: ld.lld -o %t.elf --script %s %t.o -L %t.dir
17# RUN: llvm-objdump --section-headers %t.elf | FileCheck %s --check-prefix=CHECK2
18# CHECK2: .data         00000010 0000000000002000 DATA
19
20MEMORY {
21  ROM (rwx): ORIGIN = 0x1000, LENGTH = 0x100
22  RAM (rwx): ORIGIN = 0x2000, LENGTH = 0x100
23}
24
25SECTIONS {
26  .text : { *(.text*) } > ROM
27  .data : {
28    *(.data*)
29    INCLUDE "inc.script"
30  } > RAM
31}
32