- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Passing a stack size value to a linker at compile time using -Xlinker compiler option
Link Copied
6 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
It is Not possible to pass a stack size value to a linker at compile time using -Xlinker compiler option with Intel C++ compiler v17 u2 for Linux.
For example, on Windows platforms with MinGW C++ compiler I've been using Xlinker option for more than 5 years but with Intel C++ compiler for Linux it doesn't work:
...
-Xlinker --stack=1073741824
...
You see that I pass a value 1073741824 to a linker for the stack linker option.
Something is wrong and compatibility of passing parameters to the linker on Linux is broken. I've tried many-many different combinations and they don't work as well.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Note: Please don't explain me how ulimit Linux utility works, or how it could be used instead. I need to use Xlinker option to set a stack size of an application at compile time.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Does it work with ld?
The ld on my machine doesn't accept the --stack option.
ld sptel15-606> ld t.o --stack=1073741824
ld: unrecognized option '--stack=1073741824'
ld: use the --help option for usage information
sptel15-607>
It looks like the option is passed through to the linker when you use this syntax:
sptel15-621> icc -Xlinker --stack,max-page-size=2048 t.c
ld: unrecognized option '--stack,max-page-size=2048'
ld: use the --help option for usage information
sptel15-622>
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
>>...
>>sptel15-621> icc -Xlinker --stack,max-page-size=2048 t.c
That option is not related to the problem.
I think you're confirming the problem with LD and I understand that this is not a direct problem with Intel C++ compiler.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Here are lists of all stack-related options for two versions of LD I use on two Linux systems:
[ Linux Ubuntu ]
...
ubuntu@ubuntu-vm:~$ icc -v
icc version 17.0.2 (gcc version 5.0.0 compatibility)
ubuntu@ubuntu-vm:~$ ld -v
GNU ld (GNU Binutils for Ubuntu) 2.26
ubuntu@ubuntu-vm:~$ ld --help | grep stack
-z execstack Mark executable as requiring executable stack
-z noexecstack Mark executable as not requiring executable stack
-z stacksize=SIZE Set size of stack segment
--stack Set size of the initial stack
--stack Set size of the initial stack
...
[ Linux RedHat ]
...
[guest@....-.... WorkTest]$ icc -v
icc version 16.0.3 (gcc version 4.8.5 compatibility)
[guest@....-.... WorkTest]$ ld -v
GNU ld version 2.23.52.0.1-55.el7 20130226
[guest@....-.... WorkTest]$ ld --help | grep stack
-z execstack Mark executable as requiring executable stack
-z noexecstack Mark executable as not requiring executable stack
-z stacksize=SIZE Set size of stack segment
-z execstack Mark executable as requiring executable stack
-z noexecstack Mark executable as not requiring executable stack
-z stacksize=SIZE Set size of stack segment
-z execstack Mark executable as requiring executable stack
-z noexecstack Mark executable as not requiring executable stack
-z stacksize=SIZE Set size of stack segment
-z execstack Mark executable as requiring executable stack
-z noexecstack Mark executable as not requiring executable stack
-z stacksize=SIZE Set size of stack segment
-z execstack Mark executable as requiring executable stack
-z noexecstack Mark executable as not requiring executable stack
-z stacksize=SIZE Set size of stack segment
...
I've tried many different combinations and nothing worked. Thanks for your response, Judith.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
>>...I've tried many different combinations and nothing worked...
I decided to use a workaround and I call an application from a script that first executes 'ulimit -s 268435456' Linux command.

Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page