From 3aa2940270d25954be3353c347c60d094caa6218 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= Date: Wed, 12 Oct 2016 08:41:58 +0200 Subject: [PATCH] [Triple] Handle Gentoo arm-hardfloat-*-*eabi triples Unlike other Linux distributions, Gentoo abuses the vendor field of the arm triples to specify softfloat or hardfloat. Add a special case logic for triple parsing that accounts for this and changes the environment from *EABI to *EABIHF appropriately. --- lib/Support/Triple.cpp | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/lib/Support/Triple.cpp b/lib/Support/Triple.cpp index 19d278d..ea8a181 100644 --- a/lib/Support/Triple.cpp +++ b/lib/Support/Triple.cpp @@ -874,6 +874,27 @@ std::string Triple::normalize(StringRef Str) { } } + // Gentoo abuses the vendor field for softfloat/hardfloat ARM + // e.g. arm-softfloat-linux-gnueabi, arm-hardfloat-linux-gnueabi + if (Arch == Triple::arm && Components[1] == "hardfloat") { + switch (Environment) { + case Triple::EABI: + Environment = Triple::EABIHF; + Components[3] = Triple::getEnvironmentTypeName(Environment); + break; + case Triple::GNUEABI: + Environment = Triple::GNUEABIHF; + Components[3] = Triple::getEnvironmentTypeName(Environment); + break; + case Triple::MuslEABI: + Environment = Triple::MuslEABIHF; + Components[3] = Triple::getEnvironmentTypeName(Environment); + break; + default: + break; + } + } + // Stick the corrected components back together to form the normalized string. std::string Normalized; for (unsigned i = 0, e = Components.size(); i != e; ++i) { -- 2.10.1