This is the mail archive of the mailing list for the binutils project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RFC: Add initial support for .NET Core dlls to objdump


Recent versions of .NET Core ship with some dll (PE/COFF) files that
can't be parsed by objdump:

    $ objdump -x /usr/lib64/dotnet/shared/Microsoft.NETCore.App/2.1.11/System.dll 
    objdump: /usr/lib64/dotnet/shared/Microsoft.NETCore.App/2.1.11/System.dll: file format not recognized

It seems like these files have a slightly different value for the
IMAGE_FILE_HEADER.Machine field than normal dlls. In particular, the "normal"
architecture-based magic value is XOR'ed with an OS-specific value to get the
final magic value. [1] 

Allowing the new magic values lets objdump get started:

    $ ~/local/binutils/bin/objdump -x dotnet/shared/Microsoft.NETCore.App/2.1.11/System.Runtime.dll
    dotnet/shared/Microsoft.NETCore.App/2.1.11/System.Runtime.dll:   file format pei-x86-64
    architecture: i386:x86-64, flags 0x0000012f:

    Characteristics 0x2022
        large address aware

    Time/Date               Wed Jun  5 14:49:41 2019
    Magic                   020b    (PE32+)

Some open questions:

0. Should this "non-stanard" magic field in the dll be exposed somewhere
   in the objdump UI?

1. Should I add tests for these? If so, any pointers on how to do that?

2. I added the new flags for architecture/OS combination for the binaries I
   could find. Should I try and find out what the magic flags for other
   architecture/OS combinations (bsds? arm64?) are? Even if I don't have
   access to binary dlls that demonstrate this?

3. Since this touches shared code, do I need to have this patch reviewed
   elsewhere too?

This is my first patch for binutils, so I would appreciate it someone can tell
me about any other mistakes I am making (or about to make) :)


PGP Key: B157A9F0 (
Fingerprint = 9DB5 2F0B FD3E C239 E108  E7BD DF99 7AF8 B157 A9F0

Attachment: 0001-Handle-some-pe-files-generated-by-.NET.patch
Description: Text document

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]