5 ms·
Do you know offhand if the guarantees made by the Linux ELF loader is documented anywhere? I did search for it myself but didn't find anything authoritative.
by Aransentin 5y ago
Do you know offhand if the guarantees made by the Linux ELF loader is documented anywhere? I did search for it myself but didn't find anything authoritative.
- moonchild 5y agoNo, but I can tell you as a point of practicum that when I forgot to align the stack, clang-generated code faulted under linux.
- mananaysiempre 5y agoThere’s a walkthrough of the relevant kernel code in the superb “How programs get run” series[1], and it seems to try for 16-byte alignment on all platforms. Normally this kind of thing would be in the relevant System V ABI Processor Supplement (officially, by way of the SVID and gABI, but everybody just refers to the psABI directly) [2], in the “Process Initialization” section (the above-mentioned §2.3), but note e.g. the story of how the GCC developers accidentally defaulted to a stricter alignment than the spec said and then decided to just run with it and rewrite the spec after the fact[3]. [1] https://lwn.net/Articles/631631/ https://lwn.net/Articles/631631/ [2] E.g. https://gitlab.com/x86-psABIs https://gitlab.com/x86-psABIs for x86 [3] https://stackoverflow.com/a/49397524 https://stackoverflow.com/a/49397524