1

Due to the 16 bytes alignment by default, does this imply the assertion in my question ?

Peter Cordes
  • 328,167
  • 45
  • 605
  • 847
Aaa Bbb
  • 627
  • 4
  • 12
  • 4
    In short, the answer is yes, assuming you are using the [SysV ABI](https://stackoverflow.com/questions/18133812/where-is-the-x86-64-system-v-abi-documented?noredirect=1&lq=1). Section 3.2.2: "The end of the input argument area shall be aligned on a 16 byte boundary. In other words, the value (%rsp + 8) is always a multiple of 16 when control is transferred to the function entry point.". That is, `rsp+8` should be a multiple of 16 *before* the call, and the call pushes 8 bytes, so at the entry point `rsp` itself is a multiple of 16. – Nate Eldredge Dec 02 '21 at 08:23
  • 1
    Yes, whether the function is reached by tailcall jmp or by an actual call, or anything else, it has to be *as if* it was reached by a call that was done with an aligned RSP. – Peter Cordes Dec 02 '21 at 08:31
  • 1
    It would defeat the purpose of [Why does the x86-64 / AMD64 System V ABI mandate a 16 byte stack alignment?](https://stackoverflow.com/q/49391001) if you were allowed to enter functions without RSP % 16 == 8. – Peter Cordes Dec 02 '21 at 08:45

0 Answers0