x86_64 calling conventions and stack frames

前端 未结 4 1028
轻奢々
轻奢々 2021-02-07 17:36

I am trying to make sense out of the executable code that GCC (4.4.3) is generating for an x86_64 machine running under Ubuntu Linux. In particular, I don\'t understand how the

4条回答
  •  攒了一身酷
    2021-02-07 17:58

    Assuming that I am linking with glibc (which I am doing), it looks as if I can solve this problem for practical purposes with the glibc global symbol __libc_stack_end:

    extern void * __libc_stack_end;
    
    void myfunction(void) {
      /* ... */
      off_t stack_hi = (off_t)__libc_stack_end;
      /* ... */
    }
    

提交回复
热议问题