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;
2121
2222// Returns /machine's value.
2323COFF::MachineTypes llvm::getMachineType (StringRef S) {
24+ // Flags must be a superset of Microsoft lib.exe /machine flags.
2425 return StringSwitch<COFF::MachineTypes>(S.lower ())
2526 .Cases (" x64" , " amd64" , COFF::IMAGE_FILE_MACHINE_AMD64)
2627 .Cases (" x86" , " i386" , COFF::IMAGE_FILE_MACHINE_I386)
2728 .Case (" arm" , COFF::IMAGE_FILE_MACHINE_ARMNT)
2829 .Case (" arm64" , COFF::IMAGE_FILE_MACHINE_ARM64)
2930 .Case (" arm64ec" , COFF::IMAGE_FILE_MACHINE_ARM64EC)
3031 .Case (" arm64x" , COFF::IMAGE_FILE_MACHINE_ARM64X)
32+ .Case (" mips" , COFF::IMAGE_FILE_MACHINE_R4000)
3133 .Default (COFF::IMAGE_FILE_MACHINE_UNKNOWN);
3234}
3335
Original file line number Diff line number Diff line change @@ -171,6 +171,7 @@ static Expected<COFF::MachineTypes> getCOFFFileMachine(MemoryBufferRef MB) {
171171 uint16_t Machine = (*Obj)->getMachine ();
172172 if (Machine != COFF::IMAGE_FILE_MACHINE_I386 &&
173173 Machine != COFF::IMAGE_FILE_MACHINE_AMD64 &&
174+ Machine != COFF::IMAGE_FILE_MACHINE_R4000 &&
174175 Machine != COFF::IMAGE_FILE_MACHINE_ARMNT && !COFF::isAnyArm64 (Machine)) {
175176 return createStringError (inconvertibleErrorCode (),
176177 " unknown machine: " + std::to_string (Machine));
@@ -195,6 +196,8 @@ static Expected<COFF::MachineTypes> getBitcodeFileMachine(MemoryBufferRef MB) {
195196 case Triple::aarch64:
196197 return T.isWindowsArm64EC () ? COFF::IMAGE_FILE_MACHINE_ARM64EC
197198 : COFF::IMAGE_FILE_MACHINE_ARM64;
199+ case Triple::mipsel:
200+ return COFF::IMAGE_FILE_MACHINE_R4000;
198201 default :
199202 return createStringError (inconvertibleErrorCode (),
200203 " 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