Why is the stack segment not explicit in ELF files?
1
vote
1
answer
150
views
Everything mapped in memory is explicit in ELF files *except* the stack segment. The stack segment is mapped automatically.
Why is the stack segment not like other segments, with explicit settings in ELF files?
Some programs might want a specific stack size that does not necessarily match the limit set by
ulimit -s
. So they can't use the automatically allocated stack. The program should know better than the user how much stack memory it actually needs.
Some programs might not need a stack at all. For example garbage collected languages may want to allocate their stack frames on the heap.
Wouldn't it be simpler and better for the stack segment to be explicit?
The stack could either be a segment in the ELF file (perhaps with an "automatically growable" bit set), or it could be mmap
ed by the process itself at startup.
Asked by Tomek Czajka
(121 rep)
Dec 16, 2024, 01:16 PM
Last activity: Dec 18, 2024, 12:41 PM
Last activity: Dec 18, 2024, 12:41 PM