x64 上的调用约定 [英] Calling convention on x64

查看:50
本文介绍了x64 上的调用约定的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在好几个地方看到微软对 x64 平台的调用约定被缩小到只有一个:调用者清理堆栈(cdecl),参数以组合方式传递堆栈和寄存器(我不会在这里详细介绍).我假设如果这是操作系统的调用约定,那么可能所有其他针对 Windows 的编译器(例如 mingw-w64)也遵循它.

I saw in several places that Microsoft calling conventions for x64 platforms were narrowed down to just one: Caller cleans stack (cdecl), and parameters are passed in a combination of stack and registers (I am not going into the exact details here). I assume that if this is the calling convention of the OS, then probably all other compilers targeting Windows (e.g. mingw-w64) follow it, too.

此调用约定在其他主要平台(x64 Linux 等)上是否也适用?或者 Linux 是否仍然使用多种调用约定,甚至只是一种但不同的调用约定?GCCClang 是否允许在 x64 Linux 上使用多种调用约定?

Is this calling convention true also on other major platforms (x64 Linux, etc.)? Or does Linux still use multiple calling conventions, or even just one but a different one? Do GCC or Clang allow for multiple calling conventions on x64 Linux?

推荐答案

我刚刚找到答案 此处此处.基本上,Windows 以一种方式做,其他人以另一种方式做,但每个平台只以一种方式做(而不是每个平台以多种方式使用 x86)

I just found the answer here and here. Basically, Windows does it one way, everyone else does it another way, but each platform only does it one way (as opposed to multiple ways per-platform with x86)

这篇关于x64 上的调用约定的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆