aboutsummaryrefslogtreecommitdiff
path: root/ld/testsuite/ld-i386/ifunc.s
blob: 3f34cfbfb5ade57cf0a511799ea1f800ab6752b5 (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
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
	.file	"ifunc.c"
#APP
	.type func, %indirect_function
	.type long_func_name, %indirect_function
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"arg is %d\n"
#NO_APP
	.text
	.p2align 4,,15
.globl bar
	.type	bar, @function
bar:
	pushl	%ebp
	movl	%esp, %ebp
	subl	$8, %esp
	movl	8(%ebp), %eax
	movl	$.LC0, (%esp)
	movl	%eax, 4(%esp)
	call	printf
	leave
	ret
	.size	bar, .-bar
	.section	.rodata.str1.1
.LC1:
	.string	"main: calling func"
	.section	.rodata.str1.4,"aMS",@progbits,1
	.align 4
.LC2:
	.string	"main: func finished, calling long_func_name"
	.section	.rodata.str1.1
.LC3:
	.string	"main: long_func_name finished"
	.text
	.p2align 4,,15
.globl main
	.type	main, @function
main:
	leal	4(%esp), %ecx
	andl	$-16, %esp
	pushl	-4(%ecx)
	pushl	%ebp
	movl	%esp, %ebp
	pushl	%ecx
	subl	$4, %esp
	movl	$.LC1, (%esp)
	call	puts
	call	func
	movl	$.LC2, (%esp)
	call	puts
	call	long_func_name
	movl	$.LC3, (%esp)
	call	puts
	addl	$4, %esp
	xorl	%eax, %eax
	popl	%ecx
	popl	%ebp
	leal	-4(%ecx), %esp
	ret
	.size	main, .-main
	.p2align 4,,15
.globl long_func_name
	.type	long_func_name, @function
long_func_name:
	pushl	%ebp
	movl	%esp, %ebp
	subl	$8, %esp
	call	rand
	movl	$func0, %edx
	testl	%eax, %eax
	jne	.L7
	movl	$func1, %edx
.L7:
	movl	%edx, %eax
	leave
	ret
	.size	long_func_name, .-long_func_name
	.p2align 4,,15
.globl func
	.type	func, @function
func:
	pushl	%ebp
	movl	%esp, %ebp
	subl	$8, %esp
	call	rand
	movl	$func0, %edx
	testl	%eax, %eax
	jne	.L12
	movl	$func1, %edx
.L12:
	movl	%edx, %eax
	leave
	ret
	.size	func, .-func
	.section	.rodata.str1.1
.LC4:
	.string	"func1\n"
	.text
	.p2align 4,,15
.globl func1
	.type	func1, @function
func1:
	pushl	%ebp
	movl	%esp, %ebp
	subl	$8, %esp
	movl	$.LC4, (%esp)
	call	puts
	leave
	ret
	.size	func1, .-func1
	.section	.rodata.str1.1
.LC5:
	.string	"func0\n"
	.text
	.p2align 4,,15
.globl func0
	.type	func0, @function
func0:
	pushl	%ebp
	movl	%esp, %ebp
	subl	$8, %esp
	movl	$.LC5, (%esp)
	call	puts
	leave
	ret
	.size	func0, .-func0
	.ident	"GCC: (GNU) 4.3.0 20080428 (Red Hat 4.3.0-8)"
	.section	.note.GNU-stack,"",@progbits