xref: /llvm-project/lld/test/ELF/linkerscript/no-filename-spec.s (revision 177fd72f5f223810f647d104749b40abdb9e3d6d)
1# REQUIRES: x86
2# RUN: rm -rf %t && split-file %s %t
3# RUN: echo '.section .bar, "a"; .quad 1;' | \
4# RUN:   llvm-mc -filetype=obj -triple=x86_64-pc-linux - -o %tfile1.o
5# RUN: echo '.section .zed, "a"; .quad 2;' | \
6# RUN:   llvm-mc -filetype=obj -triple=x86_64-pc-linux - -o %tfile2.o
7
8## We have a file name and no input sections description. In that case, all
9## sections from the file specified should be included. Check that.
10# RUN: ld.lld -o %t/a -T %t/a.t %tfile1.o %tfile2.o
11# RUN: llvm-objdump -s %t/a | FileCheck %s
12
13# CHECK:      Contents of section .foo:
14# CHECK-NEXT:  01000000 00000000 02000000 00000000
15
16# RUN: not ld.lld -o /dev/null -T %t/b.t %tfile1.o 2>&1 | FileCheck %s --check-prefix=ERR
17# RUN: not ld.lld -o /dev/null -T %t/c.t %tfile1.o 2>&1 | FileCheck %s --check-prefix=ERR
18# RUN: not ld.lld -o /dev/null -T %t/d.t %tfile1.o 2>&1 | FileCheck %s --check-prefix=ERR
19
20# ERR: error: {{.*}}.t:1: expected filename pattern
21
22#--- a.t
23SECTIONS {
24 .foo : { *file1.o *file2.o }
25}
26
27#--- b.t
28SECTIONS { .foo : { (*foo) } }
29
30#--- c.t
31SECTIONS { .foo : { (*(foo)) } }
32
33#--- d.t
34SECTIONS { .foo : { )(*foo) } }
35