[PATCH] D25686: [Driver] Support "hardfloat" vendor triples used by Gentoo
Michał Górny via cfe-commits
cfe-commits at lists.llvm.org
Mon Oct 17 11:09:27 PDT 2016
mgorny created this revision.
mgorny added reviewers: bob.wilson, rengolin, rafael, ddunbar.
mgorny added subscribers: cfe-commits, zlei.
Herald added a subscriber: aemerson.
Support the arm-hardfloat-*-*eabi triples used by Gentoo to signify
hardfloat variants of ARM *EABI. Add tests for correct determination of
float ABIs for various triples.
https://reviews.llvm.org/D25686
Files:
lib/Driver/Tools.cpp
test/Driver/arm-float-abi.c
Index: test/Driver/arm-float-abi.c
===================================================================
--- test/Driver/arm-float-abi.c
+++ test/Driver/arm-float-abi.c
@@ -4,3 +4,16 @@
// ARMV7-ERROR: unsupported option '-mfloat-abi=hard' for target 'thumbv7'
// NOERROR-NOT: unsupported option
+
+// Check for correct -mfloat-abi= values for various -targets.
+// RUN: %clang %s -target armv7-pc-linux-gnueabi -### 2>&1 \
+// RUN: | FileCheck -check-prefix=SOFTFLOAT %s
+// RUN: %clang %s -target armv7-pc-linux-gnueabihf -### 2>&1 \
+// RUN: | FileCheck -check-prefix=HARDFLOAT %s
+
+// Gentoo uses 'hardfloat' in vendor field.
+// RUN: %clang %s -target armv7-hardfloat-linux-gnueabi -### 2>&1 \
+// RUN: | FileCheck -check-prefix=HARDFLOAT %s
+
+// SOFTFLOAT: "-mfloat-abi" "soft"
+// HARDFLOAT: "-mfloat-abi" "hard"
Index: lib/Driver/Tools.cpp
===================================================================
--- lib/Driver/Tools.cpp
+++ lib/Driver/Tools.cpp
@@ -838,8 +838,12 @@
case llvm::Triple::GNUEABI:
case llvm::Triple::MuslEABI:
case llvm::Triple::EABI:
- // EABI is always AAPCS, and if it was not marked 'hard', it's softfp
- ABI = FloatABI::SoftFP;
+ // Gentoo puts "hardfloat" in vendor field instead of using *hf
+ // environment variant.
+ if (Triple.getVendorName() == "hardfloat")
+ ABI = FloatABI::Hard;
+ else // EABI is always AAPCS, and if it was not marked 'hard', it's softfp
+ ABI = FloatABI::SoftFP;
break;
case llvm::Triple::Android:
ABI = (SubArch == 7) ? FloatABI::SoftFP : FloatABI::Soft;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D25686.74872.patch
Type: text/x-patch
Size: 1640 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20161017/a1902bab/attachment.bin>
More information about the cfe-commits
mailing list