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

Eric Christopher echristo at apple.com
Sun Apr 3 15:58:16 PDT 2011


On Mar 31, 2011, at 1:41 PM, Graydon Hoare wrote:

> 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.

Committed thusly:

[issola:~/sources/llvm] echristo% svn ci
Sending        lib/Object/COFFObjectFile.cpp
Sending        lib/Object/ELFObjectFile.cpp
Sending        lib/Support/Path.cpp
Transmitting file data ...
Committed revision 128799.


-eric



More information about the llvm-dev mailing list