File tree Expand file tree Collapse file tree 7 files changed +34
-12
lines changed Expand file tree Collapse file tree 7 files changed +34
-12
lines changed Original file line number Diff line number Diff line change @@ -65,6 +65,8 @@ class COFFImportFile : public SymbolicFile {
65
65
66
66
uint16_t getMachine () const { return getCOFFImportHeader ()->Machine ; }
67
67
68
+ StringRef getFileFormatName () const ;
69
+
68
70
private:
69
71
bool isData () const {
70
72
return getCOFFImportHeader ()->getType () == COFF::IMPORT_DATA;
Original file line number Diff line number Diff line change @@ -33,6 +33,25 @@ using namespace llvm;
33
33
namespace llvm {
34
34
namespace object {
35
35
36
+ StringRef COFFImportFile::getFileFormatName () const {
37
+ switch (getMachine ()) {
38
+ case COFF::IMAGE_FILE_MACHINE_I386:
39
+ return " COFF-import-file-i386" ;
40
+ case COFF::IMAGE_FILE_MACHINE_AMD64:
41
+ return " COFF-import-file-x86-64" ;
42
+ case COFF::IMAGE_FILE_MACHINE_ARMNT:
43
+ return " COFF-import-file-ARM" ;
44
+ case COFF::IMAGE_FILE_MACHINE_ARM64:
45
+ return " COFF-import-file-ARM64" ;
46
+ case COFF::IMAGE_FILE_MACHINE_ARM64EC:
47
+ return " COFF-import-file-ARM64EC" ;
48
+ case COFF::IMAGE_FILE_MACHINE_ARM64X:
49
+ return " COFF-import-file-ARM64X" ;
50
+ default :
51
+ return " COFF-import-file-<unknown arch>" ;
52
+ }
53
+ }
54
+
36
55
static uint16_t getImgRelRelocation (MachineTypes Machine) {
37
56
switch (Machine) {
38
57
default :
Original file line number Diff line number Diff line change 1
1
; RUN: llvm-dlltool -m i386:x86-64 --input-def %s --output-lib %t.a
2
- ; RUN: llvm-readobj %t.a | FileCheck %s
2
+ ; RUN: llvm-readobj %t.a | FileCheck %s --check-prefixes=CHECK,CHECK-X64
3
3
; RUN: llvm-nm --print-armap %t.a | FileCheck --check-prefix=SYMTAB %s
4
4
; RUN: llvm-dlltool -m arm64 --input-def %s --output-lib %t.a
5
- ; RUN: llvm-readobj %t.a | FileCheck %s
5
+ ; RUN: llvm-readobj %t.a | FileCheck %s --check-prefixes=CHECK,CHECK-ARM64
6
6
; RUN: llvm-nm --print-armap %t.a | FileCheck --check-prefix=SYMTAB %s
7
7
8
8
LIBRARY test.dll
@@ -13,7 +13,8 @@ TestFunction3 ; This is a comment
13
13
AnotherFunction
14
14
15
15
; CHECK: File: test.dll
16
- ; CHECK: Format: COFF-import-file
16
+ ; CHECK-X64: Format: COFF-import-file-x86-64
17
+ ; CHECK-ARM64: Format: COFF-import-file-ARM64
17
18
; CHECK: Type: code
18
19
; CHECK: Name type: name
19
20
; CHECK-NEXT: Symbol: __imp_TestFunction1
Original file line number Diff line number Diff line change @@ -26,19 +26,19 @@ READOBJ-NEXT: Arch: aarch64
26
26
READOBJ-NEXT: AddressSize: 64bit
27
27
READOBJ-EMPTY:
28
28
READOBJ-NEXT: File: test.lib(test.dll)
29
- READOBJ-NEXT: Format: COFF-ARM64
29
+ READOBJ-NEXT: Format: COFF-ARM64EC
30
30
READOBJ-NEXT: Arch: aarch64
31
31
READOBJ-NEXT: AddressSize: 64bit
32
32
READOBJ-EMPTY:
33
33
READOBJ-NEXT: File: test.dll
34
- READOBJ-NEXT: Format: COFF-import-file
34
+ READOBJ-NEXT: Format: COFF-import-file-ARM64EC
35
35
READOBJ-NEXT: Type: code
36
36
READOBJ-NEXT: Name type: name
37
37
READOBJ-NEXT: Symbol: __imp_funcexp
38
38
READOBJ-NEXT: Symbol: funcexp
39
39
READOBJ-EMPTY:
40
40
READOBJ-NEXT: File: test.dll
41
- READOBJ-NEXT: Format: COFF-import-file
41
+ READOBJ-NEXT: Format: COFF-import-file-ARM64EC
42
42
READOBJ-NEXT: Type: data
43
43
READOBJ-NEXT: Name type: name
44
44
READOBJ-NEXT: Symbol: __imp_dataexp
Original file line number Diff line number Diff line change 1
1
RUN: llvm-readobj --coff-exports %p/Inputs/library.lib | FileCheck %s
2
2
3
3
CHECK: File: library.dll
4
- CHECK: Format: COFF-import-file
4
+ CHECK: Format: COFF-import-file-i386
5
5
CHECK: Type: const
6
6
CHECK: Name type: undecorate
7
7
CHECK: Symbol: __imp__constant
8
8
9
9
CHECK: File: library.dll
10
- CHECK: Format: COFF-import-file
10
+ CHECK: Format: COFF-import-file-i386
11
11
CHECK: Type: data
12
12
CHECK: Name type: noprefix
13
13
CHECK: Symbol: __imp__data
14
14
15
15
CHECK: File: library.dll
16
- CHECK: Format: COFF-import-file
16
+ CHECK: Format: COFF-import-file-i386
17
17
CHECK: Type: code
18
18
CHECK: Name type: name
19
19
CHECK: Symbol: __imp__function
20
20
21
21
CHECK: File: library.dll
22
- CHECK: Format: COFF-import-file
22
+ CHECK: Format: COFF-import-file-i386
23
23
CHECK: Type: code
24
24
CHECK: Name type: ordinal
25
25
CHECK: Symbol: __imp__ordinal
Original file line number Diff line number Diff line change @@ -320,7 +320,7 @@ symbols:
320
320
# RUN: llvm-readobj -h %p/Inputs/magic.coff-importlib \
321
321
# RUN: | FileCheck %s --strict-whitespace --match-full-lines --check-prefix IMPORTLIB
322
322
323
- # IMPORTLIB:Format: COFF-import-file
323
+ # IMPORTLIB:Format: COFF-import-file-i386
324
324
# IMPORTLIB-NEXT:Type: code
325
325
# IMPORTLIB-NEXT:Name type: noprefix
326
326
# IMPORTLIB-NEXT:Symbol: __imp__func
Original file line number Diff line number Diff line change @@ -23,7 +23,7 @@ namespace llvm {
23
23
void dumpCOFFImportFile (const COFFImportFile *File, ScopedPrinter &Writer) {
24
24
Writer.startLine () << ' \n ' ;
25
25
Writer.printString (" File" , File->getFileName ());
26
- Writer.printString (" Format" , " COFF-import-file " );
26
+ Writer.printString (" Format" , File-> getFileFormatName () );
27
27
28
28
const coff_import_header *H = File->getCOFFImportHeader ();
29
29
switch (H->getType ()) {
You can’t perform that action at this time.
0 commit comments