What's inside the stack?

后端 未结 4 1102
逝去的感伤
逝去的感伤 2021-02-20 07:32

If I run a program, just like

#include 
int main(int argc, char *argv[], char *env[]) {
  printf(\"My references are at %p, %p, %p\\n\", &argc         


        
4条回答
  •  小鲜肉
    小鲜肉 (楼主)
    2021-02-20 08:06

    The details are very dependent on your environment. The operating system generally defines an ABI, but that's in fact only enforced for syscalls.

    Each language (and each compiler even if they compile the same language) in fact may do some things differently.

    However there is some sort of system-wide convention, at least in the sense of interfacing with dynamically loaded libraries.

    Yet, details vary a lot.

    A very simple "primer" could be http://kernelnewbies.org/ABI

    A very detailed and complete specification you could look at to get an idea of the level of complexity and details that are involved in defining an ABI is "System V Application Binary Interface AMD64 Architecture Processor Supplement" http://www.x86-64.org/documentation/abi.pdf

提交回复
热议问题