Skip to content

Commit 95160b6

Browse files
committed
Add riscv to COFFObjectFile
1 parent fffebf3 commit 95160b6

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

llvm/lib/Object/COFFObjectFile.cpp

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1115,11 +1115,14 @@ dynamic_reloc_iterator COFFObjectFile::dynamic_reloc_end() const {
11151115
}
11161116

11171117
uint8_t COFFObjectFile::getBytesInAddress() const {
1118-
return getArch() == Triple::x86_64 || getArch() == Triple::aarch64 ? 8 : 4;
1118+
return getArch() == Triple::x86_64 || getArch() == Triple::aarch64 ||
1119+
getArch() == Triple::riscv64
1120+
? 8
1121+
: 4;
11191122
}
11201123

11211124
StringRef COFFObjectFile::getFileFormatName() const {
1122-
switch(getMachine()) {
1125+
switch (getMachine()) {
11231126
case COFF::IMAGE_FILE_MACHINE_I386:
11241127
return "COFF-i386";
11251128
case COFF::IMAGE_FILE_MACHINE_AMD64:
@@ -1134,6 +1137,10 @@ StringRef COFFObjectFile::getFileFormatName() const {
11341137
return "COFF-ARM64X";
11351138
case COFF::IMAGE_FILE_MACHINE_R4000:
11361139
return "COFF-MIPS";
1140+
case COFF::IMAGE_FILE_MACHINE_RISCV32:
1141+
return "COFF-RISCV32";
1142+
case COFF::IMAGE_FILE_MACHINE_RISCV64:
1143+
return "COFF-RISCV64";
11371144
default:
11381145
return "COFF-<unknown arch>";
11391146
}

0 commit comments

Comments
 (0)