aboutsummaryrefslogtreecommitdiff
path: root/lld/test/ELF/linkerscript/output-section-include.test
blob: c4d502c307d3e86239273173dc4402ba28cd90b3 (plain)
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
# 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

## Empty include file.
# RUN: rm -rf %t.dir && mkdir -p %t.dir
# RUN: echo "" > %t.dir/inc.script
# RUN: ld.lld -o %t.elf --script %s %t.o -L %t.dir
# RUN: llvm-objdump --section-headers %t.elf | FileCheck %s --check-prefix=CHECK1
# CHECK1: .data         00000008 0000000000002000 DATA

## Non-empty include file.
# RUN: echo "QUAD(0)" > %t.dir/inc.script
# RUN: ld.lld -o %t.elf --script %s %t.o -L %t.dir
# RUN: llvm-objdump --section-headers %t.elf | FileCheck %s --check-prefix=CHECK2
# CHECK2: .data         00000010 0000000000002000 DATA

MEMORY {
  ROM (rwx): ORIGIN = 0x1000, LENGTH = 0x100
  RAM (rwx): ORIGIN = 0x2000, LENGTH = 0x100
}

SECTIONS {
  .text : { *(.text*) } > ROM
  .data : {
    *(.data*)
    INCLUDE "inc.script"
  } > RAM
}