How to increase the gcc executable stack size?

守給你的承諾、 提交于 2019-11-29 06:28:53
LiraNuna

On Linux, you can expand the stack size in /etc/security/limits.conf.

You can check your current stack size by using

$ ulimit -s
8192

Then expand the stack to be double than that:

youruser    soft    stack    16384

And then relog.

This will increase stack size for all executable you're running, not just GCC's.

I use that in my compiler script:

CFLAGS += -Wl,--stack,10485760

The stack size can be configured during linking. You should look at details regarding the linker scripts. That will only change the stack size for your single programme.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!