On Thu, 12 Dec 2024, Martin Storsjö wrote:

On Thu, 12 Dec 2024, Johannes Khoshnazar-Thoma wrote:

Hi Martin, Hi List,

/home/johannes/mingw-build-binutils/sysroot/bin/x86_64-w64-mingw32-objdump: ntoskrnl.exe: file format not recognized
[...]

while most sections work:

ntoskrnl.exe:     file format pe-x86-64
[...]
ntoskrnl.exe:     file format pei-x86-64
[...]

(Those aren't "sections", those are archive members, i.e. inividual files.)

You didn't really specify what command you tried to execute here, and for what purpose - so you're really having me guess the intent here.

I didn't have a copy of wdmsec.lib handy myself, but now I do. I tried "x86_64-w64-mingw32-objdump -h wdmsec.lib" and found such errors.

Extracting the static archive to look at it closer, where multiple archive members have the exact same file name, is a bit tricky, but I have a hacked llvm-ar that extracts them with unique names.

It seems like binutils does recognize some of the short import library files, but not others.

See https://martin.st/temp/ntoskrnl.exe-779 and https://martin.st/temp/ntoskrnl.exe-780 for two such extracted files.

$ llvm-readobj ntoskrnl.exe-779 ntoskrnl.exe-780

File: ntoskrnl.exe-779
Format: COFF-import-file-x86-64
Type: code
Name type: name
Export name: IoFastQueryNetworkAttributes
Symbol: __imp_IoFastQueryNetworkAttributes
Symbol: IoFastQueryNetworkAttributes

File: ntoskrnl.exe-780
Format: COFF-import-file-x86-64
Type: const
Name type: name
Export name: IoFileObjectType
Symbol: __imp_IoFileObjectType
Symbol: IoFileObjectType

Two generally quite similar import objects.

$ x86_64-w64-mingw32-objdump -h ntoskrnl.exe-779 ntoskrnl.exe-780

ntoskrnl.exe-779:     file format pei-x86-64

Sections:
Idx Name          Size      VMA               LMA               File off Algn
0 .idata$4 00000008 0000000000000000 0000000000000000 00000000 2**2
                 CONTENTS, ALLOC, LOAD, RELOC
1 .idata$5 00000008 0000000000000000 0000000000000000 00000000 2**2
                 CONTENTS, ALLOC, LOAD, RELOC
2 .idata$6 00000020 0000000000000000 0000000000000000 00000000 2**2
                 CONTENTS, ALLOC, LOAD
3 .text 00000008 0000000000000000 0000000000000000 00000000 2**2
                 CONTENTS, ALLOC, LOAD, RELOC, CODE
x86_64-w64-mingw32-objdump: ntoskrnl.exe-780: file format not recognized


So apparently binutils doesn't recognize all of them; perhaps the variant "Type: const" isn't recognized? I guess it'd be possible to improve this aspect in binutils too.

https://sourceware.org/git/?p=binutils-gdb.git;a=commitdiff;h=c2fe3b5642e94b6fc2f2a19e54b7d9f447c8a151 is pushed now, which should silence the warnings from tools about those import objects.

// Martin

_______________________________________________
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

Reply via email to