File tree Expand file tree Collapse file tree 5 files changed +44
-0
lines changed Expand file tree Collapse file tree 5 files changed +44
-0
lines changed Original file line number Diff line number Diff line change @@ -21,13 +21,15 @@ using namespace llvm;
21
21
22
22
// Returns /machine's value.
23
23
COFF::MachineTypes llvm::getMachineType (StringRef S) {
24
+ // Flags must be a superset of Microsoft lib.exe /machine flags.
24
25
return StringSwitch<COFF::MachineTypes>(S.lower ())
25
26
.Cases (" x64" , " amd64" , COFF::IMAGE_FILE_MACHINE_AMD64)
26
27
.Cases (" x86" , " i386" , COFF::IMAGE_FILE_MACHINE_I386)
27
28
.Case (" arm" , COFF::IMAGE_FILE_MACHINE_ARMNT)
28
29
.Case (" arm64" , COFF::IMAGE_FILE_MACHINE_ARM64)
29
30
.Case (" arm64ec" , COFF::IMAGE_FILE_MACHINE_ARM64EC)
30
31
.Case (" arm64x" , COFF::IMAGE_FILE_MACHINE_ARM64X)
32
+ .Case (" mips" , COFF::IMAGE_FILE_MACHINE_R4000)
31
33
.Default (COFF::IMAGE_FILE_MACHINE_UNKNOWN);
32
34
}
33
35
Original file line number Diff line number Diff line change @@ -171,6 +171,7 @@ static Expected<COFF::MachineTypes> getCOFFFileMachine(MemoryBufferRef MB) {
171
171
uint16_t Machine = (*Obj)->getMachine ();
172
172
if (Machine != COFF::IMAGE_FILE_MACHINE_I386 &&
173
173
Machine != COFF::IMAGE_FILE_MACHINE_AMD64 &&
174
+ Machine != COFF::IMAGE_FILE_MACHINE_R4000 &&
174
175
Machine != COFF::IMAGE_FILE_MACHINE_ARMNT && !COFF::isAnyArm64 (Machine)) {
175
176
return createStringError (inconvertibleErrorCode (),
176
177
" unknown machine: " + std::to_string (Machine));
@@ -195,6 +196,8 @@ static Expected<COFF::MachineTypes> getBitcodeFileMachine(MemoryBufferRef MB) {
195
196
case Triple::aarch64:
196
197
return T.isWindowsArm64EC () ? COFF::IMAGE_FILE_MACHINE_ARM64EC
197
198
: COFF::IMAGE_FILE_MACHINE_ARM64;
199
+ case Triple::mipsel:
200
+ return COFF::IMAGE_FILE_MACHINE_R4000;
198
201
default :
199
202
return createStringError (inconvertibleErrorCode (),
200
203
" unknown arch in target triple: " + *TripleStr);
Original file line number Diff line number Diff line change
1
+ target triple = "mipsel-windows-coff"
2
+
3
+ ; Function Attrs: noinline nounwind optnone
4
+ define dso_local void @"?f@@YAXXZ" () #0 {
5
+ entry:
6
+ ret void
7
+ }
Original file line number Diff line number Diff line change
1
+ RUN: rm -rf %t && mkdir -p %t
2
+
3
+ RUN: llc -mtriple=i386-windows-coff -filetype=obj -o %t/i386.obj %S/Inputs/i386.ll
4
+ RUN: llvm-as %S/Inputs/i386.ll -o %t/i386.bc
5
+ RUN: llvm-lib %t/i386.obj %t/i386.bc /out:%t/i386.lib
6
+ RUN: llvm-objdump -h %t/i386.lib | FileCheck %s --check-prefix=I386
7
+ I386: file format coff-i386
8
+
9
+ RUN: llc -mtriple=x86_64-windows-coff -filetype=obj -o %t/x86_64.obj %S/Inputs/x86_64.ll
10
+ RUN: llvm-as %S/Inputs/x86_64.ll -o %t/x86_64.bc
11
+ RUN: llvm-lib %t/x86_64.obj %t/x86_64.bc /out:%t/x86_64.lib
12
+ RUN: llvm-objdump -h %t/x86_64.lib | FileCheck %s --check-prefix=X86_64
13
+ X86_64: file format coff-x86-64
14
+
15
+ RUN: llc -mtriple=mipsel-windows-coff -filetype=obj -o %t/mips.obj %S/Inputs/mips.ll
16
+ RUN: llvm-as %S/Inputs/mips.ll -o %t/mips.bc
17
+ RUN: llvm-lib %t/mips.obj %t/mips.bc /out:%t/mips.lib
18
+ RUN: llvm-objdump -h %t/mips.lib | FileCheck %s --check-prefix=MIPS
19
+ MIPS: file format coff-mips
Original file line number Diff line number Diff line change
1
+ RUN: rm -f %t.lib
2
+
3
+ RUN: llvm-lib /out:%t.lib /machine:i386 2>&1 | FileCheck --check-prefix=EMPTYWARN %s
4
+ RUN: llvm-lib /out:%t.lib /machine:amd64 2>&1 | FileCheck --check-prefix=EMPTYWARN %s
5
+
6
+ RUN: llvm-lib /out:%t.lib /machine:mips 2>&1 | FileCheck --check-prefix=EMPTYWARN %s
7
+
8
+ RUN: llvm-lib /out:%t.lib /machine:arm 2>&1 | FileCheck --check-prefix=EMPTYWARN %s
9
+ RUN: llvm-lib /out:%t.lib /machine:arm64 2>&1 | FileCheck --check-prefix=EMPTYWARN %s
10
+ RUN: llvm-lib /out:%t.lib /machine:arm64x 2>&1 | FileCheck --check-prefix=EMPTYWARN %s
11
+
12
+ EMPTYWARN: warning: no input files, not writing output file
13
+
You can’t perform that action at this time.
0 commit comments