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

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

问题描述

我想知道GNU编译器编译过程中 -mpreferred-stack-boundary 选项的用处。我查过了文档,但是我的解释没有了。有人可以解释它。

解决方案


我想知道使用-mpreferred-stack GNU调试器中编译期间的边界选项。


该选项对调试器没有任何作用。

它会影响二进制代码。默认情况下,GCC会安排一些东西,以便每个函数在进入时立即使其堆栈指针在16字节边界上对齐(如果你有局部变量,这可能很重要,并且启用 sse2 指示)。



如果将默认值更改为eg -mpreferred-stack-boundary = 2 ,那么GCC会在4字节边界上对齐堆栈指针。这将减少你的例程的堆栈需求,但是如果你的代码(或者你调用的代码)使用 sse2 ,它会崩溃,所以通常是不安全的。


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.

解决方案

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

The option has absolutely nothing to do with the debugger.

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).

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天全站免登陆