Go to:
Gentoo Home
Documentation
Forums
Lists
Bugs
Planet
Store
Wiki
Get Gentoo!
Gentoo's Bugzilla – Attachment 454920 Details for
Bug 595834
sys-devel/clang: arm keywording (was: does not detect arm hardfloat)
Home
|
New
–
[Ex]
|
Browse
|
Search
|
Privacy Policy
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
llvm: 0001-Triple-Support-parsing-Gentoo-ARM-triples-with-hardf.patch
0001-Triple-Support-parsing-Gentoo-ARM-triples-with-hardf.patch (text/plain), 5.69 KB, created by
Michał Górny
on 2016-12-02 17:59:25 UTC
(
hide
)
Description:
llvm: 0001-Triple-Support-parsing-Gentoo-ARM-triples-with-hardf.patch
Filename:
MIME Type:
Creator:
Michał Górny
Created:
2016-12-02 17:59:25 UTC
Size:
5.69 KB
patch
obsolete
>From 2348b830e2574ede87d8462a2c67b4c05812a84a Mon Sep 17 00:00:00 2001 >From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <mgorny@gentoo.org> >Date: Fri, 2 Dec 2016 14:41:12 +0100 >Subject: [PATCH] Triple: Support parsing Gentoo ARM triples, with hardfloat in > vendor > >Support parsing the Gentoo triples of the from arm*-hardfloat-*-*eabi >where the vendor field is used to indicate hardfloat ABI. The triples >are mapped to a correct *-*eabihf variants. >--- > include/llvm/ADT/Triple.h | 5 ++++- > lib/Support/Triple.cpp | 37 +++++++++++++++++++++++++++++++------ > unittests/ADT/TripleTest.cpp | 13 +++++++++++++ > 3 files changed, 48 insertions(+), 7 deletions(-) > >diff --git a/include/llvm/ADT/Triple.h b/include/llvm/ADT/Triple.h >index d4130e1e85a..dc59aeeb19a 100644 >--- a/include/llvm/ADT/Triple.h >+++ b/include/llvm/ADT/Triple.h >@@ -139,7 +139,10 @@ public: > Myriad, > AMD, > Mesa, >- LastVendorType = Mesa >+ // special values used on Gentoo to indicate ARM softfloat/hardfloat >+ SoftFloat, >+ HardFloat, >+ LastVendorType = HardFloat > }; > enum OSType { > UnknownOS, >diff --git a/lib/Support/Triple.cpp b/lib/Support/Triple.cpp >index 6783b40a125..5a6574d5fbb 100644 >--- a/lib/Support/Triple.cpp >+++ b/lib/Support/Triple.cpp >@@ -161,6 +161,8 @@ StringRef Triple::getVendorTypeName(VendorType Kind) { > case Myriad: return "myriad"; > case AMD: return "amd"; > case Mesa: return "mesa"; >+ case SoftFloat: return "softfloat"; >+ case HardFloat: return "hardfloat"; > } > > llvm_unreachable("Invalid VendorType!"); >@@ -443,6 +445,8 @@ static Triple::VendorType parseVendor(StringRef VendorName) { > .Case("myriad", Triple::Myriad) > .Case("amd", Triple::AMD) > .Case("mesa", Triple::Mesa) >+ .Case("softfloat", Triple::SoftFloat) >+ .Case("hardfloat", Triple::HardFloat) > .Default(Triple::UnknownVendor); > } > >@@ -482,8 +486,9 @@ static Triple::OSType parseOS(StringRef OSName) { > .Default(Triple::UnknownOS); > } > >-static Triple::EnvironmentType parseEnvironment(StringRef EnvironmentName) { >- return StringSwitch<Triple::EnvironmentType>(EnvironmentName) >+static Triple::EnvironmentType parseEnvironment(StringRef EnvironmentName, >+ Triple::VendorType Vendor) { >+ auto ET = StringSwitch<Triple::EnvironmentType>(EnvironmentName) > .StartsWith("eabihf", Triple::EABIHF) > .StartsWith("eabi", Triple::EABI) > .StartsWith("gnuabi64", Triple::GNUABI64) >@@ -503,6 +508,26 @@ static Triple::EnvironmentType parseEnvironment(StringRef EnvironmentName) { > .StartsWith("coreclr", Triple::CoreCLR) > .StartsWith("opencl", Triple::OpenCL) > .Default(Triple::UnknownEnvironment); >+ >+ // Gentoo abuses the vendor field for softfloat/hardfloat ARM >+ // e.g. arm-softfloat-linux-gnueabi, arm-hardfloat-linux-gnueabi >+ if (Vendor == Triple::HardFloat) { >+ switch (ET) { >+ case Triple::EABI: >+ ET = Triple::EABIHF; >+ break; >+ case Triple::GNUEABI: >+ ET = Triple::GNUEABIHF; >+ break; >+ case Triple::MuslEABI: >+ ET = Triple::MuslEABIHF; >+ break; >+ default: >+ break; >+ } >+ } >+ >+ return ET; > } > > static Triple::ObjectFormatType parseFormat(StringRef EnvironmentName) { >@@ -670,7 +695,7 @@ Triple::Triple(const Twine &Str) > if (Components.size() > 2) { > OS = parseOS(Components[2]); > if (Components.size() > 3) { >- Environment = parseEnvironment(Components[3]); >+ Environment = parseEnvironment(Components[3], Vendor); > ObjectFormat = parseFormat(Components[3]); > } > } >@@ -709,7 +734,7 @@ Triple::Triple(const Twine &ArchStr, const Twine &VendorStr, const Twine &OSStr, > SubArch(parseSubArch(ArchStr.str())), > Vendor(parseVendor(VendorStr.str())), > OS(parseOS(OSStr.str())), >- Environment(parseEnvironment(EnvironmentStr.str())), >+ Environment(parseEnvironment(EnvironmentStr.str(), Vendor)), > ObjectFormat(parseFormat(EnvironmentStr.str())) { > if (ObjectFormat == Triple::UnknownObjectFormat) > ObjectFormat = getDefaultFormat(*this); >@@ -742,7 +767,7 @@ std::string Triple::normalize(StringRef Str) { > } > EnvironmentType Environment = UnknownEnvironment; > if (Components.size() > 3) >- Environment = parseEnvironment(Components[3]); >+ Environment = parseEnvironment(Components[3], Vendor); > ObjectFormatType ObjectFormat = UnknownObjectFormat; > if (Components.size() > 4) > ObjectFormat = parseFormat(Components[4]); >@@ -787,7 +812,7 @@ std::string Triple::normalize(StringRef Str) { > Valid = OS != UnknownOS || IsCygwin || IsMinGW32; > break; > case 3: >- Environment = parseEnvironment(Comp); >+ Environment = parseEnvironment(Comp, Vendor); > Valid = Environment != UnknownEnvironment; > if (!Valid) { > ObjectFormat = parseFormat(Comp); >diff --git a/unittests/ADT/TripleTest.cpp b/unittests/ADT/TripleTest.cpp >index c80477f6ddc..ebc42e1f456 100644 >--- a/unittests/ADT/TripleTest.cpp >+++ b/unittests/ADT/TripleTest.cpp >@@ -284,6 +284,19 @@ TEST(TripleTest, ParsedIDs) { > EXPECT_EQ(Triple::FreeBSD, T.getOS()); > EXPECT_EQ(Triple::UnknownEnvironment, T.getEnvironment()); > >+ // Triples used for Gentoo ARM targets >+ T = Triple("armv5tel-softfloat-linux-gnueabi"); >+ EXPECT_EQ(Triple::arm, T.getArch()); >+ EXPECT_EQ(Triple::SoftFloat, T.getVendor()); >+ EXPECT_EQ(Triple::Linux, T.getOS()); >+ EXPECT_EQ(Triple::GNUEABI, T.getEnvironment()); >+ >+ T = Triple("armv7a-hardfloat-linux-gnueabi"); >+ EXPECT_EQ(Triple::arm, T.getArch()); >+ EXPECT_EQ(Triple::HardFloat, T.getVendor()); >+ EXPECT_EQ(Triple::Linux, T.getOS()); >+ EXPECT_EQ(Triple::GNUEABIHF, T.getEnvironment()); >+ > T = Triple("huh"); > EXPECT_EQ(Triple::UnknownArch, T.getArch()); > } >-- >2.11.0 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 595834
:
449958
|
450002
|
450004
|
450580
| 454920 |
454922