1/** 2 * This file has no copyright assigned and is placed in the Public Domain. 3 * This file is part of the mingw-w64 runtime package. 4 * No warranty is given; refer to the file DISCLAIMER.PD within this package. 5 */ 6#include <_mingw_mac.h> 7 8 .file "mcountFunc.S" 9 .text 10#ifdef _WIN64 11 .align 8 12#else 13 .align 4 14#endif 15 16/* gcc always assumes the mcount public symbol has a single leading underscore 17 for our target. See gcc/config/i386.h; it isn't overridden in 18 config/i386/cygming.h or any other places for mingw */ 19.globl _mcount 20 .def _mcount; .scl 2; .type 32; .endef 21_mcount: 22#ifndef _WIN64 23 push %ebp 24 mov %esp, %ebp 25 push %eax 26 push %ecx 27 push %edx 28 movl 4(%ebp),%edx 29 movl (%ebp),%eax 30 movl 4(%eax),%eax 31 push %edx 32 push %eax 33 call __MINGW_USYMBOL(_mcount_private) 34 add $8, %esp 35 pop %edx 36 pop %ecx 37 pop %eax 38 leave 39 ret 40#else 41 push %rbp 42 mov %rsp, %rbp 43 push %rax 44 push %rcx 45 push %rdx 46 push %r8 47 push %r9 48 push %r10 49 push %r11 50 movq 8(%rbp),%rdx 51 movq (%rbp),%rax 52 movq 8(%rax),%rcx 53 sub $40, %rsp 54 call __MINGW_USYMBOL(_mcount_private) 55 add $40, %rsp 56 pop %r11 57 pop %r10 58 pop %r9 59 pop %r8 60 pop %rdx 61 pop %rcx 62 pop %rax 63 leave 64 ret 65#endif 66 67/* gcc always assumes the mcount public symbol has a single leading underscore 68 for our target. See gcc/config/i386.h; it isn't overridden in 69 config/i386/cygming.h or any other places for mingw. This is the entry 70 for new prologue mechanism required for x64 seh calling convention. */ 71.globl __fentry__ 72 .def _mcount_top; .scl 2; .type 32; .endef 73__fentry__: 74#ifndef _WIN64 75 push %ebp 76 mov %esp, %ebp 77 push %eax 78 push %ecx 79 push %edx 80 movl 4(%ebp),%edx 81 movl 8(%ebp),%eax 82 push %edx 83 push %eax 84 call __MINGW_USYMBOL(_mcount_private) 85 add $8, %esp 86 pop %edx 87 pop %ecx 88 pop %eax 89 leave 90 ret 91#else 92 push %rbp 93 mov %rsp, %rbp 94 push %rax 95 push %rcx 96 push %rdx 97 push %r8 98 push %r9 99 push %r10 100 push %r11 101 movq 8(%rbp),%rdx 102 movq 16(%rbp),%rcx 103 sub $40, %rsp 104 call __MINGW_USYMBOL(_mcount_private) 105 add $40, %rsp 106 pop %r11 107 pop %r10 108 pop %r9 109 pop %r8 110 pop %rdx 111 pop %rcx 112 pop %rax 113 leave 114 ret 115#endif 116