xref: /llvm-project/lld/test/ELF/linkerscript/target.s (revision 4cb05dc3cbf39b1729f06dd9251012665fad00d0)
1# REQUIRES: x86
2
3# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t.o
4# RUN: echo "TARGET(binary) INPUT(\"%t.o\") TARGET(elf64-x86-64) INPUT(\"%t.o\")" > %t.script
5# RUN: ld.lld --script %t.script -o %t.exe
6# RUN: llvm-readelf -s %t.exe | FileCheck %s
7# RUN: echo 'TARGET("elf64-x86-64") INPUT("%t.o") TARGET("binary") INPUT("%t.o")' > %t.script
8# RUN: ld.lld -T %t.script -o %t
9# RUN: llvm-readelf -s %t | FileCheck %s
10
11# CHECK-DAG: [[#]] _binary_
12# CHECK-DAG: [[#]] foobar
13
14# RUN: echo "TARGET(foo)" > %t2.script
15# RUN: not ld.lld --script %t2.script -o /dev/null 2>&1 | FileCheck -check-prefix=ERR %s
16
17# ERR: unknown target: foo
18
19.global foobar
20foobar:
21  nop
22