Skip to content

Commit

Permalink
[Triple] Make mipsel-*-windows-* use COFF files by default (llvm#107809)
Browse files Browse the repository at this point in the history
Windows NT/MIPS and Windows CE/MIPS always used COFF format.

This is an extract of PR llvm#107744.
  • Loading branch information
hpoussin authored and DanielCChen committed Oct 16, 2024
1 parent 80404a8 commit 1040507
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
6 changes: 5 additions & 1 deletion llvm/lib/TargetParser/Triple.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -925,7 +925,6 @@ static Triple::ObjectFormatType getDefaultFormat(const Triple &T) {
case Triple::mips64:
case Triple::mips64el:
case Triple::mips:
case Triple::mipsel:
case Triple::msp430:
case Triple::nvptx64:
case Triple::nvptx:
Expand All @@ -950,6 +949,11 @@ static Triple::ObjectFormatType getDefaultFormat(const Triple &T) {
case Triple::xtensa:
return Triple::ELF;

case Triple::mipsel:
if (T.isOSWindows())
return Triple::COFF;
return Triple::ELF;

case Triple::ppc64:
case Triple::ppc:
if (T.isOSAIX())
Expand Down
4 changes: 4 additions & 0 deletions llvm/unittests/TargetParser/TripleTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2468,6 +2468,10 @@ TEST(TripleTest, NormalizeWindows) {
Triple::normalize("i686-pc-windows-elf-elf"));

EXPECT_TRUE(Triple("x86_64-pc-win32").isWindowsMSVCEnvironment());

EXPECT_TRUE(Triple(Triple::normalize("mipsel-windows-msvccoff")).isOSBinFormatCOFF());
EXPECT_TRUE(Triple(Triple::normalize("mipsel-windows-msvc")).isOSBinFormatCOFF());
EXPECT_TRUE(Triple(Triple::normalize("mipsel-windows-gnu")).isOSBinFormatCOFF());
}

TEST(TripleTest, NormalizeAndroid) {
Expand Down

0 comments on commit 1040507

Please sign in to comment.