[LLVMdev] [patch] Support PE/COFF in COFFObjectFile, fix some bugs object file readers

Graydon Hoare graydon at pobox.com
Thu Mar 31 13:41:30 PDT 2011


Hi,

The attached patch does a few separate things. I can split them up if 
you like but it's pretty small.

   - Adds support for sniffing PE/COFF files on win32 (.exe and .dll)
     which are COFF files that have an MS-DOS compatibility stub on
     the front of them.

   - Fixes a bug in the COFFObjectFile's support for the Microsoft COFF
     extension for long symbol names, wherein it was attempting to parse
     the leading '/' in an extended symbol name reference as part of the
     integer offset.

   - Fixes bugs in COFFObjectFile and ELFObjectFile wherein section
     and symbol iterators were being returned with uninitialized bytes;
     the type DataRefImpl is a union between 2 32-bit words (d.a and d.b)
     and a single intptr_t word (p). Only p was being initialized, so in
     32-bit builds the result would be iterators with random upper 32-bit
     words in their DataRefImpls. This caused random failures when
     seeking around in object files.

Let me know if any of this is questionable or you've suggestions on 
style, as I may submit subsequent bugs along these lines; we're using 
the LLVM object-file reading facilities in rustc, so will be fixing any 
bugs we encounter as we go.

Thanks,

-Graydon
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pecoff.patch
Type: text/x-patch
Size: 4718 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20110331/be4614ae/attachment.bin>


More information about the llvm-dev mailing list