llvm-project
60 строк · 1.4 Кб
1# REQUIRES: x86
2
3# RUN: llvm-mc -triple=x86_64-windows-msvc %s -filetype=obj -o %t.obj
4# RUN: lld-link -lldmap:%t.map -out:%t.exe -opt:ref -entry:main %t.obj -verbose 2>&1 | FileCheck %s
5# RUN: FileCheck %s --check-prefix=MAP --input-file=%t.map
6
7# CHECK: Discarded unused1
8# CHECK-NEXT: Discarded unused2
9# CHECK-NOT: Discarded
10
11# MAP: In Symbol
12# MAP: gc-dwarf.s.tmp.obj:(.text)
13# MAP: {{ main$}}
14# MAP: gc-dwarf.s.tmp.obj:(.text)
15# MAP: {{ used$}}
16
17.def @feat.00; .scl 3; .type 0; .endef
18.globl @feat.00
19.set @feat.00, 0
20
21.def main; .scl 2; .type 32; .endef
22.section .text,"xr",one_only,main
23.globl main
24main:
25callq used
26xorl %eax, %eax
27retq
28
29.def used; .scl 2; .type 32; .endef
30.section .text,"xr",one_only,used
31.globl used
32used:
33retq
34
35
36.def unused1; .scl 2; .type 32; .endef
37.section .text,"xr",one_only,unused1
38.globl unused1
39unused1:
40retq
41
42.def unused2; .scl 2; .type 32; .endef
43.section .text,"xr",one_only,unused2
44.globl unused2
45unused2:
46retq
47
48# This isn't valid DWARF, but LLD doesn't care. Make up some data that
49# references the functions above.
50.section .debug_info,"r"
51.long main@IMGREL
52.long unused1@IMGREL
53.long unused2@IMGREL
54
55# Similarly, .eh_frame unwind info should not keep functions alive. Again, this
56# is not valid unwind info, but it doesn't matter for testing purposes.
57.section .eh_frame,"r"
58.long main@IMGREL
59.long unused1@IMGREL
60.long unused2@IMGREL
61