Skip to content

Commit

Permalink
Add SUSE vendor
Browse files Browse the repository at this point in the history
Summary: SUSE's ARM triples end with -gnueabi even though they are hard-float. This requires special handling of SUSE ARM triples. Hence we need a way to differentiate the SUSE as vendor. This CL adds that.

Reviewers: chandlerc, compnerd, echristo, rengolin

Reviewed By: rengolin

Subscribers: aemerson, rengolin, llvm-commits

Differential Revision: https://reviews.llvm.org/D32426

llvm-svn: 301174
  • Loading branch information
ismail committed Apr 24, 2017
1 parent a37c0d9 commit 6dda317
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
3 changes: 2 additions & 1 deletion llvm/include/llvm/ADT/Triple.h
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,8 @@ class Triple {
Myriad,
AMD,
Mesa,
LastVendorType = Mesa
SUSE,
LastVendorType = SUSE
};
enum OSType {
UnknownOS,
Expand Down
2 changes: 2 additions & 0 deletions llvm/lib/Support/Triple.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,7 @@ StringRef Triple::getVendorTypeName(VendorType Kind) {
case Myriad: return "myriad";
case AMD: return "amd";
case Mesa: return "mesa";
case SUSE: return "suse";
}

llvm_unreachable("Invalid VendorType!");
Expand Down Expand Up @@ -443,6 +444,7 @@ static Triple::VendorType parseVendor(StringRef VendorName) {
.Case("myriad", Triple::Myriad)
.Case("amd", Triple::AMD)
.Case("mesa", Triple::Mesa)
.Case("suse", Triple::SUSE)
.Default(Triple::UnknownVendor);
}

Expand Down
6 changes: 6 additions & 0 deletions llvm/unittests/ADT/TripleTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,12 @@ TEST(TripleTest, ParsedIDs) {
EXPECT_EQ(Triple::FreeBSD, T.getOS());
EXPECT_EQ(Triple::UnknownEnvironment, T.getEnvironment());

T = Triple("armv7hl-suse-linux-gnueabi");
EXPECT_EQ(Triple::arm, T.getArch());
EXPECT_EQ(Triple::SUSE, T.getVendor());
EXPECT_EQ(Triple::Linux, T.getOS());
EXPECT_EQ(Triple::GNUEABI, T.getEnvironment());

T = Triple("huh");
EXPECT_EQ(Triple::UnknownArch, T.getArch());
}
Expand Down

0 comments on commit 6dda317

Please sign in to comment.