xref: /llvm-project/lld/test/MachO/filelist.s (revision 364ee4ee36942e76861e1e7ec9ff8d46ca76e647)
1# REQUIRES: x86
2
3## This test verifies that the paths in -filelist get processed in command-line
4## order.
5
6# RUN: rm -rf %t; split-file %s %t && cd %t
7# RUN: llvm-mc -filetype=obj -triple=x86_64-apple-darwin %t/first.s -o %t/first.o
8# RUN: llvm-mc -filetype=obj -triple=x86_64-apple-darwin %t/second.s -o %t/second.o
9# RUN: llvm-mc -filetype=obj -triple=x86_64-apple-darwin %t/test.s -o %t/test.o
10
11# FIRST: __TEXT,first _foo
12# SECOND: __TEXT,second _foo
13
14# RUN: echo "%t/first.o" > filelist
15# RUN: echo "%t/second.o" >> filelist
16# RUN: %lld -filelist filelist %t/test.o -o %t/test
17# RUN: llvm-objdump --syms %t/test | FileCheck %s --check-prefix=FIRST
18
19# RUN: echo "%t/second.o" > filelist
20# RUN: echo "%t/first.o" >> filelist
21# RUN: %lld -filelist filelist %t/test.o -o %t/test
22# RUN: llvm-objdump --syms %t/test | FileCheck %s --check-prefix=SECOND
23
24# RUN: echo "%t/first.o" > filelist
25# RUN: %lld -filelist filelist %t/second.o %t/test.o -o %t/test
26# RUN: llvm-objdump --syms %t/test | FileCheck %s --check-prefix=FIRST
27# RUN: %lld %t/second.o -filelist filelist %t/test.o -o %t/test
28# RUN: llvm-objdump --syms %t/test | FileCheck %s --check-prefix=SECOND
29
30# RUN: echo "%t/first.o" > filelist-1
31# RUN: echo "%t/second.o" > filelist-2
32# RUN: %lld -filelist filelist-1 -filelist filelist-2 %t/test.o -o %t/test
33# RUN: llvm-objdump --syms %t/test | FileCheck %s --check-prefix=FIRST
34# RUN: %lld -filelist filelist-2 -filelist filelist-1 %t/test.o -o %t/test
35# RUN: llvm-objdump --syms %t/test | FileCheck %s --check-prefix=SECOND
36
37#--- first.s
38.globl _foo
39.weak_definition _foo
40.section __TEXT,first
41_foo:
42
43#--- second.s
44.globl _foo
45.weak_definition _foo
46.section __TEXT,second
47_foo:
48
49#--- test.s
50.globl _main
51_main:
52  ret
53