Skip to content

Commit

Permalink
ADT: handle special case of ARM environment for SUSE
Browse files Browse the repository at this point in the history
SUSE treats "gnueabi" as "gnueabihf" so make sure that we normalise the
environment.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@304670 91177308-0d34-0410-b5e6-96231b3b80d8
  • Loading branch information
compnerd committed Jun 3, 2017
1 parent 2a4cf84 commit 61a5551
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/Support/Triple.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -877,6 +877,10 @@ std::string Triple::normalize(StringRef Str) {
}
}

// SUSE uses "gnueabi" to mean "gnueabihf"
if (Vendor == Triple::SUSE && Environment == llvm::Triple::GNUEABI)
Components[3] = "gnueabihf";

if (OS == Triple::Win32) {
Components.resize(4);
Components[2] = "windows";
Expand Down
5 changes: 5 additions & 0 deletions unittests/ADT/TripleTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1090,11 +1090,16 @@ TEST(TripleTest, NormalizeARM) {
EXPECT_EQ("armv6eb--netbsd-eabihf", Triple::normalize("armv6eb-netbsd-eabihf"));
EXPECT_EQ("armv7eb--netbsd-eabihf", Triple::normalize("armv7eb-netbsd-eabihf"));

EXPECT_EQ("armv7-suse-linux-gnueabihf",
Triple::normalize("armv7-suse-linux-gnueabi"));

Triple T;
T = Triple("armv6--netbsd-eabi");
EXPECT_EQ(Triple::arm, T.getArch());
T = Triple("armv6eb--netbsd-eabi");
EXPECT_EQ(Triple::armeb, T.getArch());
T = Triple("armv7-suse-linux-gnueabihf");
EXPECT_EQ(Triple::GNUEABIHF, T.getEnvironment());
}

TEST(TripleTest, ParseARMArch) {
Expand Down

0 comments on commit 61a5551

Please sign in to comment.