|
1 | 1 | # REQUIRES: x86
|
2 | 2 | # RUN: rm -rf %t; split-file %s %t
|
3 | 3 | # RUN: llvm-mc -filetype=obj -triple=x86_64-apple-darwin %t/archive-foo.s -o %t/archive-foo.o
|
| 4 | +# RUN: llvm-mc -filetype=obj -triple=x86_64-apple-darwin %t/archive-baz.s -o %t/archive-baz.o |
4 | 5 | # RUN: llvm-ar rcs %t/foo.a %t/archive-foo.o
|
| 6 | +# RUN: llvm-ar rcs %t/baz.a %t/archive-baz.o |
5 | 7 | # RUN: llvm-mc -filetype=obj -triple=x86_64-apple-darwin %t/foo.s -o %t/foo.o
|
6 | 8 | # RUN: llvm-mc -filetype=obj -triple=x86_64-apple-darwin %t/test.s -o %t/test.o
|
7 | 9 |
|
8 |
| -# RUN: %lld -force_load %t/foo.a %t/foo.o %t/test.o -o %t/test-force-load-first |
| 10 | +# RUN: %lld -lSystem -force_load %t/foo.a %t/foo.o %t/test.o -o %t/test-force-load-first |
9 | 11 | # FORCE-LOAD-FIRST: __TEXT,archive _foo
|
10 | 12 | # RUN: llvm-objdump --syms %t/test-force-load-first | FileCheck %s --check-prefix=FORCE-LOAD-FIRST
|
11 | 13 |
|
12 |
| -# RUN: %lld %t/foo.o -force_load %t/foo.a %t/test.o -o %t/test-force-load-second |
| 14 | +# RUN: %lld %t/foo.o -lSystem -force_load %t/foo.a %t/test.o -o %t/test-force-load-second |
13 | 15 | # RUN: llvm-objdump --syms %t/test-force-load-second | FileCheck %s --check-prefix=FORCE-LOAD-SECOND
|
14 | 16 | # FORCE-LOAD-SECOND: __TEXT,obj _foo
|
15 | 17 |
|
| 18 | +## Force-loading the same path twice is fine |
| 19 | +# RUN: %lld -lSystem %t/foo.o -force_load %t/foo.a -force_load %t/foo.a %t/test.o -o /dev/null |
| 20 | + |
| 21 | +## Note that we do not call realpath() before dedup'ing the force-load |
| 22 | +## arguments, so this is an error. |
| 23 | +# RUN: cd %t; not %lld -lSystem %t/foo.o -force_load %t/foo.a -force_load foo.a \ |
| 24 | +# RUN: %t/test.o -o /dev/null 2>&1 |
| 25 | + |
| 26 | +# DUP: error: duplicate symbol: _bar |
| 27 | + |
| 28 | +## Force-loading two different paths w/o conflicting symbols is fine |
| 29 | +# RUN: %lld -lSystem -force_load %t/foo.a -force_load %t/baz.a %t/test.o -o %t/test-two-force-loads |
| 30 | +# RUN: llvm-objdump --syms %t/test-two-force-loads | FileCheck %s --check-prefix=TWICE |
| 31 | +# TWICE-DAG: __TEXT,archive _foo |
| 32 | +# TWICE-DAG: __TEXT,archive _bar |
| 33 | +# TWICE-DAG: __TEXT,archive _baz |
| 34 | + |
16 | 35 | #--- archive-foo.s
|
17 | 36 | .section __TEXT,archive
|
18 |
| -.globl _foo |
| 37 | +.globl _foo, _bar |
19 | 38 | .weak_definition _foo
|
20 | 39 | _foo:
|
| 40 | +_bar: |
| 41 | + |
| 42 | +#--- archive-baz.s |
| 43 | +.section __TEXT,archive |
| 44 | +.globl _baz |
| 45 | +_baz: |
21 | 46 |
|
22 | 47 | #--- foo.s
|
23 | 48 | .section __TEXT,obj
|
|
0 commit comments