gcc -mpreferred-stack-boundary 选项 [英] gcc -mpreferred-stack-boundary option

查看:17
本文介绍了gcc -mpreferred-stack-boundary 选项的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道在 GNU 编译器编译过程中 -mpreferred-stack-boundary 选项有什么用.我已经检查了文档,但我失去了解释.谁能解释一下.

I want to know what's the use of -mpreferred-stack-boundary option during compilation in GNU compiler. I've checked the documentation but the explanation is lost on me. Could someone please explain it.

推荐答案

我想知道在 GNU 调试器中编译期间 -mpreferred-stack-boundary 选项的用途.

I want to know what's the use of -mpreferred-stack-boundary option during compilation in GNU debugger.

该选项与调试器完全无关.

它会影响二进制文件中生成的代码.默认情况下,GCC 将安排事情,以便每个函数在进入时立即将其堆栈指针对齐在 16 字节边界上(如果您有局部变量并启用 sse2 指令,这可能很重要).

It affects generated code in your binary. By default, GCC will arrange things so that every function, immediately upon entry, has its stack pointer aligned on 16-byte boundary (this may be important if you have local variables, and enable sse2 instructions).

如果您将默认设置更改为例如-mpreferred-stack-boundary=2,则 GCC 将在 4 字节边界上对齐堆栈指针.这将减少您的例程的堆栈需求,但如果您的代码(或您调用的代码)确实使用 sse2 则会崩溃,因此通常不安全.

If you change the default to e.g. -mpreferred-stack-boundary=2, then GCC will align stack pointer on 4-byte boundary. This will reduce stack requirements of your routines, but will crash if your code (or code you call) does use sse2, so is generally not safe.

这篇关于gcc -mpreferred-stack-boundary 选项的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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