[Mono-devel-list] patch for bugs in ilasm
radical at gmail.com
Thu Apr 7 10:49:09 EDT 2005
Attached is a patch for bugs in ilasm.
As almost all the fixes are on the same file (PEAPI.cs), so it wont be
possible to seperate them out.
Also attached are test cases for reproducing the bugs fixed. These were
discovered and fixed while trying to roundtripping on
Microsoft.VisualBasic.dll (monodis ms.vb.dll > vb.il; ilasm /dll vb.il;
After this patch, PEVerify gives zero errors on the final .dll.
The major chunk is for fixing the handling of ValueTypes in ilasm.
"ref <valuetype>" .. not encoded correctly. Change required in
ClassRefInst.ctor, typeIndex(base) changed to a ValueType. (see patch)
1. for array of ValueTypes
2. ClassRef to ValueType or Enum, gets encoded as a
valuetype. It should be encoded as a ClassRef to System.ValueType or
System.Enum. Only types derived from these are valuetypes.
IL allows method params to have same name. ilasm(mono) uses a hashtable to
store named params.. changed that.
Type not set for a ByteArrConst (eg. when .param = bytearray (...) )
ByteArray is set to a string by default.
For a float method param
.param  = float64(0x3FB999999999999A)
ILParser converts (0x3f...) to an int64 and then later tries to convert it
into a float, instead of using the in64's exact bit image to build the float.
For Nested classes, the entry in the TypeDef table for the nested class
should have namespace="", as it is built from the NestedClass &
EnclosingClass in the NestedClass table.
An enum declared in IL with no explicit "extends System.Enum" gets
incorrectly encoded as deriving from System.ValueType.
Fixed in the patch.
For testing the .cs testcases, do
monodis case.exe > case.il
PEVerify.exe case.exe -> This will show the errors..
For the .il files just ilasm and peverify them
The files are attached in bugzilla :
Eagerly awaiting feedback..
Mono hacking : http://mono-nosip.blogspot.com
Personal : http://www.corewars.org/radical
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 17893 bytes
Desc: not available
Url : http://lists.ximian.com/pipermail/mono-devel-list/attachments/20050407/ffaee44a/attachment.bin
More information about the Mono-devel-list