brintos

brintos / llvm-project-archived public Read only

0
0
Text · 3.6 KiB · 6d5761f Raw
92 lines · plain
1# REQUIRES: x862# RUN: rm -rf %t && split-file %s %t3# RUN: cd %t && mkdir dir0 dir1 dir24# RUN: llvm-mc -filetype=obj -triple=x86_64 tx.s -o tx.o5# RUN: llvm-mc -filetype=obj -triple=x86_64 ty.s -o ty.o6 7# RUN: echo 'SECTIONS{.foo :{ KEEP(:*x.o(.foo)) KEEP(*y.o(.foo)) }}' > 1.t8# RUN: ld.lld -o 1 -T 1.t tx.o ty.o9# RUN: llvm-objdump -s 1 | FileCheck --check-prefix=FIRSTY %s10# FIRSTY:      Contents of section .foo:11# FIRSTY-NEXT:   01000000 00000000 11000000 0000000012 13# RUN: echo 'SECTIONS{.foo :{ KEEP(*y.o(.foo)) KEEP(*x.o(.foo)) }}' > 2.t14# RUN: ld.lld -o 2 -T 2.t tx.o ty.o15# RUN: llvm-objdump -s 2 | FileCheck --check-prefix=SECONDFIRST %s16# SECONDFIRST:      Contents of section .foo:17# SECONDFIRST-NEXT:   11000000 00000000 01000000 0000000018 19## Now the same tests but without KEEP. Checking that file name inside20## KEEP is parsed fine.21# RUN: echo 'SECTIONS{.foo :{ :*x.o(.foo) *y.o(.foo) }}' > 3.t22# RUN: ld.lld -o 3 -T 3.t tx.o ty.o23# RUN: llvm-objdump -s 3 | FileCheck --check-prefix=FIRSTY %s24 25# RUN: echo 'SECTIONS{.foo :{ *y.o(.foo) *x.o(.foo) }}' > 4.t26# RUN: ld.lld -o 4 -T 4.t tx.o ty.o27# RUN: llvm-objdump -s 4 | FileCheck --check-prefix=SECONDFIRST %s28 29# RUN: cp tx.o dir0/filename-spec1.o30# RUN: cp ty.o dir0/filename-spec2.o31 32# RUN: echo 'SECTIONS{.foo :{ "dir0/filename-spec2.o"(.foo) "dir0/filename-spec1.o"(.foo) }}' > 5.t33# RUN: ld.lld -o 5 -T 5.t dir0/filename-spec1.o dir0/filename-spec2.o34# RUN: llvm-objdump -s 5 | FileCheck --check-prefix=SECONDFIRST %s35 36# RUN: echo 'SECTIONS{.foo :{ "dir0/filename-spec1.o"(.foo) "dir0/filename-spec2.o"(.foo) }}' > 6.t37# RUN: ld.lld -o 6 -T 6.t dir0/filename-spec1.o dir0/filename-spec2.o38# RUN: llvm-objdump -s 6 | FileCheck --check-prefix=FIRSTY %s39 40# RUN: cp tx.o dir1/filename-spec1.o41# RUN: cp ty.o dir2/filename-spec2.o42# RUN: llvm-ar rc dir1/lib1.a dir1/filename-spec1.o43# RUN: llvm-ar rc dir2/lib2.a dir2/filename-spec2.o44# RUN: llvm-ar rc combined.a tx.o ty.o45 46## Verify matching of archive library names.47# RUN: echo 'SECTIONS{.foo :{ *lib2*(.foo) *lib1*(.foo) }}' > 7.t48# RUN: ld.lld -o 7 -T 7.t --whole-archive \49# RUN:   dir1/lib1.a dir2/lib2.a50# RUN: llvm-objdump -s 7 | FileCheck --check-prefix=SECONDFIRST %s51 52## Verify matching directories.53# RUN: echo 'SECTIONS{.foo :{  *dir2*(.foo) *dir1*(.foo) }}' > 8.t54# RUN: ld.lld -o 8 -T 8.t --whole-archive \55# RUN:   dir1/lib1.a dir2/lib2.a56# RUN: llvm-objdump -s 8 | FileCheck --check-prefix=SECONDFIRST %s57 58## Verify matching of archive library names in KEEP.59# RUN: echo 'SECTIONS{.foo :{ KEEP(*lib2.a:(.foo)) KEEP(*lib1*(.foo)) }}' > 9.t60# RUN: ld.lld -o 9 -T 9.t --whole-archive \61# RUN:   dir1/lib1.a dir2/lib2.a62# RUN: llvm-objdump -s 9 | FileCheck --check-prefix=SECONDFIRST %s63 64## Verify matching directories in KEEP.65# RUN: echo 'SECTIONS{.foo :{ KEEP(*dir2*(.foo)) KEEP(*dir1*(.foo)) }}' > 10.t66# RUN: ld.lld -o 10 -T 10.t --whole-archive \67# RUN:   dir1/lib1.a dir2/lib2.a68# RUN: llvm-objdump -s 10 | FileCheck --check-prefix=SECONDFIRST %s69 70## () can appear in a quoted filename pattern.71# RUN: cp dir1/lib1.a 'lib1().a'72# RUN: echo 'SECTIONS{.foo :{ KEEP(*dir2*(.foo)) KEEP("lib1().a"(.foo)) }}' > 11.t73# RUN: ld.lld -o 11 -T 11.t --whole-archive 'lib1().a' dir2/lib2.a74# RUN: llvm-objdump -s 11 | FileCheck --check-prefix=SECONDFIRST %s75 76## Verify that matching files excluded from an archive will not match files within one.77# RUN: echo 'SECTIONS{.foo :{ KEEP(:*x.o(.foo)) KEEP(*y.o(.foo)) KEEP(*x.o(.foo)) }}' > 12.t78# RUN: ld.lld -o 12 -T 12.t --whole-archive combined.a79# RUN: llvm-objdump -s 12 | FileCheck --check-prefix=SECONDFIRST %s80 81#--- tx.s82.global _start83_start:84 nop85 86.section .foo,"a"87 .quad 188 89#--- ty.s90.section .foo,"a"91  .quad 0x1192