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
|
/**
* This file has no copyright assigned and is placed in the Public Domain.
* This file is part of the mingw-w64 runtime package.
* No warranty is given; refer to the file DISCLAIMER.PD within this package.
*/
#include <_mingw_mac.h>
.file "mcountFunc.S"
.text
#ifdef _WIN64
.align 8
#else
.align 4
#endif
/* gcc always assumes the mcount public symbol has a single leading underscore
for our target. See gcc/config/i386.h; it isn't overridden in
config/i386/cygming.h or any other places for mingw */
.globl _mcount
.def _mcount; .scl 2; .type 32; .endef
_mcount:
#ifndef _WIN64
push %ebp
mov %esp, %ebp
push %eax
push %ecx
push %edx
movl 4(%ebp),%edx
movl (%ebp),%eax
movl 4(%eax),%eax
push %edx
push %eax
call __MINGW_USYMBOL(_mcount_private)
add $8, %esp
pop %edx
pop %ecx
pop %eax
leave
ret
#else
push %rbp
mov %rsp, %rbp
push %rax
push %rcx
push %rdx
push %r8
push %r9
push %r10
push %r11
movq 8(%rbp),%rdx
movq (%rbp),%rax
movq 8(%rax),%rcx
sub $40, %rsp
call __MINGW_USYMBOL(_mcount_private)
add $40, %rsp
pop %r11
pop %r10
pop %r9
pop %r8
pop %rdx
pop %rcx
pop %rax
leave
ret
#endif
/* gcc always assumes the mcount public symbol has a single leading underscore
for our target. See gcc/config/i386.h; it isn't overridden in
config/i386/cygming.h or any other places for mingw. This is the entry
for new prologue mechanism required for x64 seh calling convention. */
.globl __fentry__
.def _mcount_top; .scl 2; .type 32; .endef
__fentry__:
#ifndef _WIN64
push %ebp
mov %esp, %ebp
push %eax
push %ecx
push %edx
movl 4(%ebp),%edx
movl 8(%ebp),%eax
push %edx
push %eax
call __MINGW_USYMBOL(_mcount_private)
add $8, %esp
pop %edx
pop %ecx
pop %eax
leave
ret
#else
push %rbp
mov %rsp, %rbp
push %rax
push %rcx
push %rdx
push %r8
push %r9
push %r10
push %r11
movq 8(%rbp),%rdx
movq 16(%rbp),%rcx
sub $40, %rsp
call __MINGW_USYMBOL(_mcount_private)
add $40, %rsp
pop %r11
pop %r10
pop %r9
pop %r8
pop %rdx
pop %rcx
pop %rax
leave
ret
#endif
|