aboutsummaryrefslogtreecommitdiff
path: root/test/ELF/gc-sections.s
blob: 0ae6fa4f06de2a679805f656083af3c5b72b0b4e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
# REQUIRES: x86

# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t
# RUN: ld.lld %t -o %t2
# RUN: llvm-readobj -sections -symbols %t2 | FileCheck -check-prefix=NOGC %s
# RUN: ld.lld --gc-sections %t -o %t2
# RUN: llvm-readobj -sections -symbols %t2 | FileCheck -check-prefix=GC1 %s
# RUN: ld.lld --export-dynamic --gc-sections %t -o %t2
# RUN: llvm-readobj -sections -symbols %t2 | FileCheck -check-prefix=GC2 %s

# NOGC: Name: .eh_frame
# NOGC: Name: .text
# NOGC: Name: .init
# NOGC: Name: .fini
# NOGC: Name: .ctors
# NOGC: Name: .dtors
# NOGC: Name: .debug_pubtypes
# NOGC: Name: .comment
# NOGC: Name: a
# NOGC: Name: b
# NOGC: Name: c
# NOGC: Name: x
# NOGC: Name: y
# NOGC: Name: d

# GC1:     Name: .eh_frame
# GC1:     Name: .text
# GC1:     Name: .init
# GC1:     Name: .fini
# GC1:     Name: .ctors
# GC1:     Name: .dtors
# GC1:     Name: .debug_pubtypes
# GC1:     Name: .comment
# GC1:     Name: a
# GC1:     Name: b
# GC1:     Name: c
# GC1-NOT: Name: x
# GC1-NOT: Name: y
# GC1-NOT: Name: d

# GC2:     Name: .eh_frame
# GC2:     Name: .text
# GC2:     Name: .init
# GC2:     Name: .fini
# GC2:     Name: .ctors
# GC2:     Name: .dtors
# GC2:     Name: .debug_pubtypes
# GC2:     Name: .comment
# GC2:     Name: a
# GC2:     Name: b
# GC2:     Name: c
# GC2-NOT: Name: x
# GC2-NOT: Name: y
# GC2:     Name: d

.globl _start, d
.protected a, b, c, x, y
_start:
  call a

.section .text.a,"ax",@progbits
a:
  call _start
  call b

.section .text.b,"ax",@progbits
b:
  call c

.section .text.c,"ax",@progbits
c:
  nop

.section .text.d,"ax",@progbits
d:
  nop

.section .text.x,"ax",@progbits
x:
  call y

.section .text.y,"ax",@progbits
y:
  call x

.section .ctors,"aw",@progbits
  .quad 0

.section .dtors,"aw",@progbits
  .quad 0

.section .init,"aw",@init_array
  .quad 0

.section .fini,"aw",@fini_array
  .quad 0

.section .preinit_array,"aw",@preinit_array
  .quad 0

.section .eh_frame,"a",@unwind
  .quad 0

.section .debug_pubtypes,"",@progbits
  .quad 0

.section .comment,"MS",@progbits,8
  .quad 0