How to fix SizeOfImage when loading a builtin dll ?
Eric Pouech
eric.pouech at wanadoo.fr
Wed May 29 15:40:03 CDT 2002
> I thought about modifying winebuild to add
>
> char _end[];
> nt_headers->OptionalHeader.SizeOfImage = pe_header - _end;
>
> in the library initialisation function. This is small, fast and probably
> more accurate.
>
> Does anyone have any comment about that ?
don't you mean extern char _end[] instead ?
there's nothing currently which ensures that pe_header is at the start
of the code (it relies on the fact it's the first on gcc/ld link option,
and that ld allocates slots for compilation units in the order they are
expressed) => this may become a porting issue
I'm not sure either that _end is completly portable?
using this technique (with _start, _etext, _edata, _bss_start, _end) we
could also compute the "real" size of code, data, and bss which should
be of some interest (even if data would be a bit more difficult, since
we need to take care of the rsrc part)
beware also that those fields must be aligned on the section boundary
(see SectionAlignment in optional header)
A+
More information about the wine-devel
mailing list