Re:Show HN: A minimal C runtime for Linux i386 and x86_64 in...
by oso2k on Monday February 02, 2015 @02:03PM
(#8986038)
I think I've fixed it [0]. Ran into the issue where gcc was kindly re-aligning the stack to 16-bytes on i386 for no good reason (stack was already aligned?!?!). But that's fixed. Just hope gcc on i386 doesn't stop doing `sub ESP, 0x1C` upon entry to _start.
[0] https://github.com/lpsantil/rt0/blob/master/lib/00_start.c
try this with your code, pass 8 arguments to your test. the environment will point to the last element in argv and then terminate, completely missing the actual environment. again, that's only the behavior on x86, on x86_64, passing any argument will cause a segfault.