就是进入_start后rsp是对齐的

Is after entering _start rsp is aligned

当程序在程序开始时进入 _start 例程时,堆栈指针是在 16 字节边界对齐还是应该手动对齐到该边界?我的意思是它在 _start 中的序言 (push rbp; mov rbp, rsp) 之前对齐了吗? 我知道在程序开始的 x64 上 RSP 对齐到 8 个字节, 但现在知道它是否在 16 字节边界上对齐。对于某些任务,我可能需要对齐才能正确执行需要在 16 字节边界上对齐的 SSE 指令。

x86-64 ABI 明确表示(3.4.1 初始堆栈和寄存器状态):

%rsp The stack pointer holds the address of the byte with lowest address which is part of the stack. It is guaranteed to be 16-byte aligned at process entry.

由于 _start 是进入进程时调用的第一个符号,因此当 OS 在您的程序中调用 _start 时,您可以完全确定它是 16 字节对齐的可执行文件。