mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-16 12:24:03 +00:00
llvm-readobj: Add support for dumping the DOS header in PE files
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@221333 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -1020,12 +1020,13 @@ file_magic identify_magic(StringRef Magic) {
|
||||
return file_magic::coff_object;
|
||||
break;
|
||||
|
||||
case 0x4d: // Possible MS-DOS stub on Windows PE file
|
||||
if (Magic[1] == 0x5a) {
|
||||
case 'M': // Possible MS-DOS stub on Windows PE file
|
||||
if (Magic[1] == 'Z') {
|
||||
uint32_t off =
|
||||
*reinterpret_cast<const support::ulittle32_t*>(Magic.data() + 0x3c);
|
||||
// PE/COFF file, either EXE or DLL.
|
||||
if (off < Magic.size() && memcmp(Magic.data() + off, "PE\0\0",4) == 0)
|
||||
if (off < Magic.size() &&
|
||||
memcmp(Magic.data()+off, COFF::PEMagic, sizeof(COFF::PEMagic)) == 0)
|
||||
return file_magic::pecoff_executable;
|
||||
}
|
||||
break;
|
||||
|
Reference in New Issue
Block a user