[Mono-list] rotor/mono incompatibility

Paolo Molaro lupus@ximian.com
Fri, 5 Apr 2002 12:05:52 +0200


On 04/04/02 Toby DiPasquale wrote:
> alpha:~> clix thread_example.exe 
> 
> 1: Rva = 8192
> 2: FileLength = 1860
> 3: NumberOfSections = 1
> 4: PointerToRawData = 512
> 5: SizeOfRawData = 1536
> EXE is not Managed
> alpha:~> head -6 rotor-output-head 
> 
> 1: Rva = 8200
> 2: FileLength = 2560
> 3: NumberOfSections = 2
> 4: PointerToRawData = 512
> 5: SizeOfRawData = 1536
> alpha:~> 
> 
> The first is the MCS-generated PE file, and the second is the text file
> containing the redirected output of the execution of clix on the
> Rotor-generated PE file (both made from the same C# source code).

Ok, we don't null-pad the section data. I'll cook up a patch for this
problem now. In the meantime, you can try appending a few bytes from
/dev/zero to the file and check if you get any other errors.

> One thing I did notice is that Rotor goes into this section over and over
> again throughout the execution of the Rotor-generated PE file for
> seemingly no reason (that I can see, yet, that is). I would think
> it only needs to hit this section once, judging by the name of the
> function (which I will save you from knowing). Another interesting

Well, I guess they couldn't make a version of the CLR on BSD faster than
the windows one, so they slowed it down somewhat :-) (note for the joke
impaired: I'm just making fun of it, no conspiracy theories, please).

> thing that I have no explanation for is that the MCS-generated code has a
> value of 1 for NumberOfSections, but the Rotor-generated PE file always
> has a value of 2 for that same field. That routine is entered 530 times in

I guess their second section is a .rsrc one? We don't write one, yet,
but simple programs don't need it.

> P.S. It would be very helpful if you could just point me straight to the
> section of code in Mono that is responsible for generating the PE
> header, so I wouldn't have to spend a lot of time looking for it :) This
> way, I can reference sections of Mono's code and the things it needs,
> rather than beating around the bush, trying not to mention too much of
> Rotor's internals. Thanks again!!

You can check mono/mono/metadata/reflection.c: the function
mono_image_get_header () creates the PE/COFF header.

Thanks for your help!

lupus

-- 
-----------------------------------------------------------------
lupus@debian.org                                     debian/rules
lupus@ximian.com                             Monkeys do it better