Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions llvm/lib/Object/COFFImportFile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,8 @@ static uint16_t getImgRelRelocation(MachineTypes Machine) {
return IMAGE_REL_ARM64_ADDR32NB;
case IMAGE_FILE_MACHINE_I386:
return IMAGE_REL_I386_DIR32NB;
case IMAGE_FILE_MACHINE_R4000:
return IMAGE_REL_MIPS_REFWORDNB;
}
}

Expand Down
3 changes: 2 additions & 1 deletion llvm/lib/ToolDrivers/llvm-dlltool/DlltoolDriver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ MachineTypes getEmulation(StringRef S) {
.Case("arm", IMAGE_FILE_MACHINE_ARMNT)
.Case("arm64", IMAGE_FILE_MACHINE_ARM64)
.Case("arm64ec", IMAGE_FILE_MACHINE_ARM64EC)
.Case("mips", IMAGE_FILE_MACHINE_R4000)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, we should cross-check this with binutils - if it should be r4000 or mips as there was a MIPS16 and a MIPSv2 machine type that PE/COFF has supported over the years.

.Default(IMAGE_FILE_MACHINE_UNKNOWN);
}

Expand Down Expand Up @@ -173,7 +174,7 @@ int llvm::dlltoolDriverMain(llvm::ArrayRef<const char *> ArgsArr) {
(!Args.hasArgNoClaim(OPT_d) && !Args.hasArgNoClaim(OPT_l))) {
Table.printHelp(outs(), "llvm-dlltool [options] file...", "llvm-dlltool",
false);
llvm::outs() << "\nTARGETS: i386, i386:x86-64, arm, arm64, arm64ec\n";
llvm::outs() << "\nTARGETS: i386, i386:x86-64, arm, arm64, arm64ec, mips\n";
return 1;
}

Expand Down
3 changes: 3 additions & 0 deletions llvm/test/tools/llvm-dlltool/machine-opt.def
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
; RUN: llvm-readobj %t.a | FileCheck --check-prefix=ARM %s
; RUN: llvm-dlltool -m arm64 -d %s -l %t.a
; RUN: llvm-readobj %t.a | FileCheck --check-prefix=ARM64 %s
; RUN: llvm-dlltool -m mips -d %s -l %t.a
; RUN: llvm-readobj %t.a | FileCheck --check-prefix=MIPS %s

LIBRARY test.dll
EXPORTS
Expand All @@ -15,3 +17,4 @@ TestFunction
; X86_64: Format: COFF-x86-64
; ARM: Format: COFF-ARM{{$}}
; ARM64: Format: COFF-ARM64
; MIPS: Format: COFF-MIPS
Loading