Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / lld / test / MachO / abs-duplicate.s
bloba02324c2e50635819f592f83394e91e1c5b9326c
1 # REQUIRES: x86
2 # RUN: rm -rf %t; split-file %s %t
3 # RUN: llvm-mc -filetype=obj -triple=x86_64-apple-darwin %t/test.s -o %t/test.o
4 # RUN: llvm-mc -filetype=obj -triple=x86_64-apple-darwin %t/weakfoo.s -o %t/weakfoo.o
5 # RUN: not %lld -lSystem %t/test.o %t/weakfoo.o -o /dev/null 2>&1 | FileCheck %s
7 # CHECK: error: duplicate symbol: _weakfoo
8 # CHECK-NEXT: >>> defined in {{.*}}/test.o
9 # CHECK-NEXT: >>> defined in {{.*}}/weakfoo.o
11 ## Duplicate absolute symbols that will be dead stripped later should not fail.
12 # RUN: %lld -lSystem -dead_strip --dead-strip-duplicates -map %t/stripped-duplicate-map \
13 # RUN: %t/test.o %t/weakfoo.o -o %t/test
14 # RUN: llvm-objdump --syms %t/test | FileCheck %s --check-prefix=DUP
15 # DUP-LABEL: SYMBOL TABLE:
16 # DUP-NEXT: g F __TEXT,__text _main
17 # DUP-NEXT: g F __TEXT,__text __mh_execute_header
18 # DUP-NEXT: *UND* dyld_stub_binder
20 ## Dead stripped non-section symbols don't show up in map files because there's no input section.
21 ## Check that _weakfoo doesn't show up. This matches ld64.
22 # RUN: FileCheck --check-prefix=DUPMAP %s < %t/stripped-duplicate-map
23 # DUPMAP: _main
24 # DUPMAP-LABEL: Dead Stripped Symbols
25 # DUPMAP-NOT: _weakfoo
27 #--- weakfoo.s
28 .globl _weakfoo
29 ## The weak attribute is ignored for absolute symbols, so we will have a
30 ## duplicate symbol error for _weakfoo.
31 .weak_definition _weakfoo
32 _weakfoo = 0x1234
34 #--- test.s
35 .globl _main, _weakfoo
36 .weak_definition _weakfoo
37 _weakfoo = 0x5678
39 .text
40 _main:
41 ret