On Wed, 28 Dec 2005 20:38, Alexandre Julliard wrote:
It's relative to the start of the NT header, and it gets relocated at load time when we map the NT header to its proper place, at the start of the .text section.
OK. We still have the problem that on a SPARC there is no way at the time of assembling the file to generate data that involves taking the difference between symbols that are in two different segments. The real "_end" symbol exists, and is of course in the BSS segment. Obviously it would be somewhat pointless for the NT header to be in the BSS segment, so having the SizeOfImage element contain the difference between _end and the start of the NT header would appear to be impossible (absent making our own modified versions of the GNU linker and assembler), at least at any time before completion of the link phase. This leaves AFAICS three obvious alternatives:
1. Modify the executable after the link phase; 2. Put what we can into SizeOfImage (which could only be one part of the calculation - presumably "_end") and adjust at load time; or 3. Don't rely on the assembler to put anything meaningful in there and calculate the whole thing at load time.