Files
clang-p2996/lld/test/ELF/linkerscript/section-include.test
Rui Ueyama 2e9d40d5f4 [lld] Add more complete support for the INCLUDE command.
Patch by Ian Tessier.

This change adds INCLUDE support to the MEMORY and SECTION commands, and
to output sections, as per:

https://sourceware.org/binutils/docs/ld/File-Commands.html#File-Commands

Differential Revision: https://reviews.llvm.org/D52951

llvm-svn: 344368
2018-10-12 17:07:32 +00:00

33 lines
1.1 KiB
Plaintext

# 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: echo "" > %t.inc
# RUN: ld.lld -o %t.elf --script %s %t.o -L %T
# RUN: llvm-objdump -section-headers %t.elf | FileCheck %s --check-prefix=CHECK1
# CHECK1: .data 00000008 0000000000002000 DATA
# CHECK1-NEXT: .data3 00000008 0000000000002008 DATA
## Non-empty include file.
# RUN: echo ".data2 : { QUAD(0) } > RAM" > %t.inc
# RUN: ld.lld -o %t.elf --script %s %t.o -L %T
# RUN: llvm-objdump -section-headers %t.elf | FileCheck %s --check-prefix=CHECK2
# CHECK2: .data 00000008 0000000000002000 DATA
# CHECK2-NEXT: .data2 00000008 0000000000002008 DATA
# CHECK2-NEXT: .data3 00000008 0000000000002010 DATA
MEMORY {
ROM (rwx): ORIGIN = 0x1000, LENGTH = 0x100
RAM (rwx): ORIGIN = 0x2000, LENGTH = 0x100
}
SECTIONS {
.text : { *(.text*) } > ROM
.data : { *(.data*) } > RAM
INCLUDE "section-include.test.tmp.inc"
.data3 : { QUAD(0) } > RAM
}