[all-commits] [llvm/llvm-project] 5f1e50: [llvm-objdump] -p: Dump PE header for PE/COFF

Fangrui Song via All-commits all-commits at lists.llvm.org
Tue Nov 9 10:08:54 PST 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 5f1e509579e49e97c4ad7deb0dd3069393ccd461
      https://github.com/llvm/llvm-project/commit/5f1e509579e49e97c4ad7deb0dd3069393ccd461
  Author: Fangrui Song <i at maskray.me>
  Date:   2021-11-09 (Tue, 09 Nov 2021)

  Changed paths:
    A llvm/test/tools/llvm-objdump/COFF/private-headers-old.test
    R llvm/test/tools/llvm-objdump/COFF/private-headers.test
    A llvm/test/tools/llvm-objdump/COFF/private-headers.yaml
    M llvm/tools/llvm-objdump/COFFDump.cpp
    M llvm/tools/llvm-objdump/COFFDump.h
    M llvm/tools/llvm-objdump/llvm-objdump.cpp

  Log Message:
  -----------
  [llvm-objdump] -p: Dump PE header for PE/COFF

For a trivial DLL built with `clang --target=x86_64-windows -O2 -c a.c; lld-link -subsystem:console -dll a.o -out:a.dll`,
`objdump -p` vs `llvm-objdump -p`:

```
-a.dll:     file format pei-x86-64
-
+a.dll: file format coff-x86-64
 Characteristics 0x2022
        executable
        large address aware
@@ -57,4 +56,4 @@
 Entry d 0000000000000000 00000000 Delay Import Directory
 Entry e 0000000000000000 00000000 CLR Runtime Header
 Entry f 0000000000000000 00000000 Reserved
-
+Export Table:
```

For a Linux image (`vmlinuz-5.10.76-gentoo-r1`) built with `CONFIG_EFI_STUB=y`

```
-vmlinuz-5.10.76-gentoo-r1:     file format pei-x86-64
-
-Characteristics 0x20e
+vmlinuz-5.10.76-gentoo-r1:     file format coff-x86-64
+Characteristics 0x206
        executable
        line numbers stripped
-       symbols stripped
        debugging information removed

 Time/Date              Wed Dec 31 16:00:00 1969
@@ -55,10 +53,4 @@
 Entry d 0000000000000000 00000000 Delay Import Directory
 Entry e 0000000000000000 00000000 CLR Runtime Header
 Entry f 0000000000000000 00000000 Reserved
-
-
-PE File Base Relocations (interpreted .reloc section contents)
-
-Virtual Address: 000037ca Chunk size 10 (0xa) Number of fixups 1
-       reloc    0 offset    0 [37ca] ABSOLUTE
-
+Export Table:
```

`symbols stripped` looks like a GNU objdump problem.

Reviewed By: jhenderson, alexander-shaposhnikov

Differential Revision: https://reviews.llvm.org/D113356




More information about the All-commits mailing list