Thoughts for chapter 2: stuff that often confuses me: PLT, GOT, FDE/CIE.
Thoughts for chapter 2: stuff that often confuses me: PLT, GOT, FDE/CIE.
http://eli.thegreenplace.net/2011/08/25/load-time-relocation...
http://eli.thegreenplace.net/2011/11/03/position-independent...
1. Space for NULL should be big enough for at least a medium-sized structure, otherwise (*NULL)->field = blah will overwrite your code. 2. Because of (1), Linux (for example) doesn't even allow processes to map the first page or so of memory. 3. On many platforms the PC needs to be aligned to a word boundary.
One more question, though: how much space should be safe to leave for NULL? Is 128MB enough? Why not only as much as required?
I suppose it doesn't really matter anyway since the entry point location is virtual at this point anyway.
Linux allows you to configure the limit at /proc/sys/vm/mmap_min_addr.
I think it's specified by itanium C++ ABI (which sounds archaic but actually many other processors use the same one).
I don't recall if these things are ELF features or if the ELF only knows about the "eh_frame" section. It's interesting and kinda sorta related low-level stuff IMO.