I'm a big backed up on Clang driver reviews, but this and your other hard floating point patch are in my queue now...<div class="gmail_extra"><br><br><div class="gmail_quote">On Thu, Jul 26, 2012 at 1:33 AM, Jiangning Liu <span dir="ltr"><<a href="mailto:jiangning.liu@arm.com" target="_blank">jiangning.liu@arm.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">PING... Who can help to review this piece of code change?<br>
<br>
Thanks,<br>
-Jiangning<br>
<div><div class="h5"><br>
> -----Original Message-----<br>
> From: <a href="mailto:cfe-commits-bounces@cs.uiuc.edu">cfe-commits-bounces@cs.uiuc.edu</a> [mailto:<a href="mailto:cfe-commits-">cfe-commits-</a><br>
> <a href="mailto:bounces@cs.uiuc.edu">bounces@cs.uiuc.edu</a>] On Behalf Of Jiangning Liu<br>
> Sent: Friday, July 13, 2012 4:07 PM<br>
> To: <a href="mailto:cfe-commits@cs.uiuc.edu">cfe-commits@cs.uiuc.edu</a><br>
> Subject: [cfe-commits] [PATCH] Support ARM hard float (arm-linux-<br>
> gnueabihf) in clang driver<br>
><br>
> Hi,<br>
><br>
> Clang driver doesn't support folder structure for ARM hard float<br>
> architecture yet, so this patch intends to add this support. With this<br>
> patch, Clang driver will be able to find correct library paths for<br>
> target arm-linux-gnueabihf. A new test input folder is added for<br>
> ubuntu_12.04_LTS_multiarch_tree accordingly.<br>
><br>
> Thanks,<br>
> -Jiangning<br>
><br>
> diff --git a/lib/Driver/ToolChains.cpp b/lib/Driver/ToolChains.cpp index<br>
> b858c3e..ecaab40 100644<br>
> --- a/lib/Driver/ToolChains.cpp<br>
> +++ b/lib/Driver/ToolChains.cpp<br>
> @@ -1098,6 +1098,9 @@<br>
> Generic_GCC::GCCInstallationDetector::GCCInstallationDetector(<br>
> "arm-linux-gnueabi",<br>
> "arm-linux-androideabi"<br>
> };<br>
> + static const char *const ARMHFTriples[] = {<br>
> + "arm-linux-gnueabihf",<br>
> + };<br>
><br>
> static const char *const X86_64LibDirs[] = { "/lib64", "/lib" };<br>
> static const char *const X86_64Triples[] = { @@ -1154,8 +1157,13 @@<br>
> Generic_GCC::GCCInstallationDetector::GCCInstallationDetector(<br>
> case llvm::Triple::arm:<br>
> case llvm::Triple::thumb:<br>
> LibDirs.append(ARMLibDirs, ARMLibDirs +<br>
> llvm::array_lengthof(ARMLibDirs));<br>
> - TripleAliases.append(<br>
> - ARMTriples, ARMTriples + llvm::array_lengthof(ARMTriples));<br>
> + if (TargetTriple.getEnvironment() == llvm::Triple::GNUEABIHF) {<br>
> + TripleAliases.append(<br>
> + ARMHFTriples, ARMHFTriples +<br>
> llvm::array_lengthof(ARMHFTriples));<br>
> + } else {<br>
> + TripleAliases.append(<br>
> + ARMTriples, ARMTriples + llvm::array_lengthof(ARMTriples));<br>
> + }<br>
> break;<br>
> case llvm::Triple::x86_64:<br>
> LibDirs.append(<br>
> @@ -1907,8 +1915,13 @@ static std::string getMultiarchTriple(const<br>
> llvm::Triple TargetTriple,<br>
> // regardless of what the actual target triple is.<br>
> case llvm::Triple::arm:<br>
> case llvm::Triple::thumb:<br>
> - if (llvm::sys::fs::exists(SysRoot + "/lib/arm-linux-gnueabi"))<br>
> - return "arm-linux-gnueabi";<br>
> + if (TargetTriple.getEnvironment() == llvm::Triple::GNUEABIHF) {<br>
> + if (llvm::sys::fs::exists(SysRoot + "/lib/arm-linux-gnueabihf"))<br>
> + return "arm-linux-gnueabihf";<br>
> + } else {<br>
> + if (llvm::sys::fs::exists(SysRoot + "/lib/arm-linux-gnueabi"))<br>
> + return "arm-linux-gnueabi";<br>
> + }<br>
> return TargetTriple.str();<br>
> case llvm::Triple::x86:<br>
> if (llvm::sys::fs::exists(SysRoot + "/lib/i386-linux-gnu")) @@ -<br>
> 2154,7 +2167,12 @@ void Linux::AddClangSystemIncludeArgs(const ArgList<br>
> &DriverArgs,<br>
> "/usr/include/i486-linux-gnu"<br>
> };<br>
> const StringRef ARMMultiarchIncludeDirs[] = {<br>
> - "/usr/include/arm-linux-gnueabi"<br>
> + "/usr/include/arm-linux-gnueabi",<br>
> + "/usr/arm-linux-gnueabi/include"<br>
> + };<br>
> + const StringRef ARMHFMultiarchIncludeDirs[] = {<br>
> + "/usr/include/arm-linux-gnueabihf",<br>
> + "/usr/arm-linux-gnueabihf/include"<br>
> };<br>
> const StringRef MIPSMultiarchIncludeDirs[] = {<br>
> "/usr/include/mips-linux-gnu"<br>
> @@ -2174,7 +2192,10 @@ void Linux::AddClangSystemIncludeArgs(const<br>
> ArgList &DriverArgs,<br>
> } else if (getTriple().getArch() == llvm::Triple::x86) {<br>
> MultiarchIncludeDirs = X86MultiarchIncludeDirs;<br>
> } else if (getTriple().getArch() == llvm::Triple::arm) {<br>
> - MultiarchIncludeDirs = ARMMultiarchIncludeDirs;<br>
> + if (getTriple().getEnvironment() == llvm::Triple::GNUEABIHF)<br>
> + MultiarchIncludeDirs = ARMHFMultiarchIncludeDirs;<br>
> + else<br>
> + MultiarchIncludeDirs = ARMMultiarchIncludeDirs;<br>
> } else if (getTriple().getArch() == llvm::Triple::mips) {<br>
> MultiarchIncludeDirs = MIPSMultiarchIncludeDirs;<br>
> } else if (getTriple().getArch() == llvm::Triple::mipsel) { diff --<br>
> git a/lib/Driver/Tools.cpp b/lib/Driver/Tools.cpp old mode 100644 new<br>
> mode 100755 index 66d792f..7a365c0<br>
> --- a/lib/Driver/Tools.cpp<br>
> +++ b/lib/Driver/Tools.cpp<br>
> @@ -629,16 +629,11 @@ static StringRef getARMFloatABI(const Driver &D,<br>
> break;<br>
> }<br>
><br>
> - case llvm::Triple::Linux: {<br>
> - if (Triple.getEnvironment() == llvm::Triple::GNUEABI) {<br>
> - FloatABI = "softfp";<br>
> - break;<br>
> - }<br>
> - }<br>
> - // fall through<br>
> -<br>
> default:<br>
> switch(Triple.getEnvironment()) {<br>
> + case llvm::Triple::GNUEABIHF:<br>
> + FloatABI = "hard";<br>
> + break;<br>
> case llvm::Triple::GNUEABI:<br>
> FloatABI = "softfp";<br>
> break;<br>
> @@ -685,6 +680,7 @@ void Clang::AddARMTargetArgs(const ArgList &Args,<br>
> switch(Triple.getEnvironment()) {<br>
> case llvm::Triple::ANDROIDEABI:<br>
> case llvm::Triple::GNUEABI:<br>
> + case llvm::Triple::GNUEABIHF:<br>
> ABIName = "aapcs-linux";<br>
> break;<br>
> case llvm::Triple::EABI:<br>
> diff --git<br>
> a/test/Driver/Inputs/ubuntu_12.04_LTS_multiarch_tree/lib/.keep<br>
> b/test/Driver/Inputs/ubuntu_12.04_LTS_multiarch_tree/lib/.keep<br>
> new file mode 100644<br>
> index 0000000..e69de29<br>
> diff --git<br>
> a/test/Driver/Inputs/ubuntu_12.04_LTS_multiarch_tree/usr/include/.keep<br>
> b/test/Driver/Inputs/ubuntu_12.04_LTS_multiarch_tree/usr/include/.keep<br>
> new file mode 100644<br>
> index 0000000..e69de29<br>
> diff --git<br>
> a/test/Driver/Inputs/ubuntu_12.04_LTS_multiarch_tree/usr/lib/.keep<br>
> b/test/Driver/Inputs/ubuntu_12.04_LTS_multiarch_tree/usr/lib/.keep<br>
> new file mode 100644<br>
> index 0000000..e69de29<br>
> diff --git<br>
> a/test/Driver/Inputs/ubuntu_12.04_LTS_multiarch_tree/usr/lib/arm-linux-<br>
> gnuea<br>
> bi/crt1.o<br>
> b/test/Driver/Inputs/ubuntu_12.04_LTS_multiarch_tree/usr/lib/arm-linux-<br>
> gnuea<br>
> bi/crt1.o<br>
> new file mode 100644<br>
> index 0000000..e69de29<br>
> diff --git<br>
> a/test/Driver/Inputs/ubuntu_12.04_LTS_multiarch_tree/usr/lib/arm-linux-<br>
> gnuea<br>
> bi/crti.o<br>
> b/test/Driver/Inputs/ubuntu_12.04_LTS_multiarch_tree/usr/lib/arm-linux-<br>
> gnuea<br>
> bi/crti.o<br>
> new file mode 100644<br>
> index 0000000..e69de29<br>
> diff --git<br>
> a/test/Driver/Inputs/ubuntu_12.04_LTS_multiarch_tree/usr/lib/arm-linux-<br>
> gnuea<br>
> bi/crtn.o<br>
> b/test/Driver/Inputs/ubuntu_12.04_LTS_multiarch_tree/usr/lib/arm-linux-<br>
> gnuea<br>
> bi/crtn.o<br>
> new file mode 100644<br>
> index 0000000..e69de29<br>
> diff --git<br>
> a/test/Driver/Inputs/ubuntu_12.04_LTS_multiarch_tree/usr/lib/arm-linux-<br>
> gnuea<br>
> bihf/crt1.o<br>
> b/test/Driver/Inputs/ubuntu_12.04_LTS_multiarch_tree/usr/lib/arm-linux-<br>
> gnuea<br>
> bihf/crt1.o<br>
> new file mode 100644<br>
> index 0000000..e69de29<br>
> diff --git<br>
> a/test/Driver/Inputs/ubuntu_12.04_LTS_multiarch_tree/usr/lib/arm-linux-<br>
> gnuea<br>
> bihf/crti.o<br>
> b/test/Driver/Inputs/ubuntu_12.04_LTS_multiarch_tree/usr/lib/arm-linux-<br>
> gnuea<br>
> bihf/crti.o<br>
> new file mode 100644<br>
> index 0000000..e69de29<br>
> diff --git<br>
> a/test/Driver/Inputs/ubuntu_12.04_LTS_multiarch_tree/usr/lib/arm-linux-<br>
> gnuea<br>
> bihf/crtn.o<br>
> b/test/Driver/Inputs/ubuntu_12.04_LTS_multiarch_tree/usr/lib/arm-linux-<br>
> gnuea<br>
> bihf/crtn.o<br>
> new file mode 100644<br>
> index 0000000..e69de29<br>
> diff --git<br>
> a/test/Driver/Inputs/ubuntu_12.04_LTS_multiarch_tree/usr/lib/gcc/arm-<br>
> linux-g<br>
> nueabi/4.6.1/crtbegin.o<br>
> b/test/Driver/Inputs/ubuntu_12.04_LTS_multiarch_tree/usr/lib/gcc/arm-<br>
> linux-g<br>
> nueabi/4.6.1/crtbegin.o<br>
> new file mode 100644<br>
> index 0000000..e69de29<br>
> diff --git<br>
> a/test/Driver/Inputs/ubuntu_12.04_LTS_multiarch_tree/usr/lib/gcc/arm-<br>
> linux-g<br>
> nueabi/4.6.1/crtend.o<br>
> b/test/Driver/Inputs/ubuntu_12.04_LTS_multiarch_tree/usr/lib/gcc/arm-<br>
> linux-g<br>
> nueabi/4.6.1/crtend.o<br>
> new file mode 100644<br>
> index 0000000..e69de29<br>
> diff --git<br>
> a/test/Driver/Inputs/ubuntu_12.04_LTS_multiarch_tree/usr/lib/gcc/arm-<br>
> linux-g<br>
> nueabihf/4.6.3/crtbegin.o<br>
> b/test/Driver/Inputs/ubuntu_12.04_LTS_multiarch_tree/usr/lib/gcc/arm-<br>
> linux-g<br>
> nueabihf/4.6.3/crtbegin.o<br>
> new file mode 100644<br>
> index 0000000..e69de29<br>
> diff --git<br>
> a/test/Driver/Inputs/ubuntu_12.04_LTS_multiarch_tree/usr/lib/gcc/arm-<br>
> linux-g<br>
> nueabihf/4.6.3/crtend.o<br>
> b/test/Driver/Inputs/ubuntu_12.04_LTS_multiarch_tree/usr/lib/gcc/arm-<br>
> linux-g<br>
> nueabihf/4.6.3/crtend.o<br>
> new file mode 100644<br>
> index 0000000..e69de29<br>
> diff --git a/test/Driver/linux-ld.c b/test/Driver/linux-ld.c index<br>
> a9decfd..89f3bc3 100644<br>
> --- a/test/Driver/linux-ld.c<br>
> +++ b/test/Driver/linux-ld.c<br>
> @@ -174,6 +174,39 @@<br>
> // CHECK-UBUNTU-11-04: "-L[[SYSROOT]]/lib"<br>
> // CHECK-UBUNTU-11-04: "-L[[SYSROOT]]/usr/lib"<br>
> //<br>
> +// Check multi arch support on Ubuntu 12.04 LTS.<br>
> +// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \<br>
> +// RUN: -target arm-unknown-linux-gnueabihf \<br>
> +// RUN: --sysroot=%S/Inputs/ubuntu_12.04_LTS_multiarch_tree \<br>
> +// RUN: | FileCheck --check-prefix=CHECK-UBUNTU-12-04-ARM-HF %s<br>
> +// CHECK-UBUNTU-12-04-ARM-HF: "{{.*}}ld{{(.exe)?}}"<br>
> "--sysroot=[[SYSROOT:[^"]+]]"<br>
> +// CHECK-UBUNTU-12-04-ARM-HF:<br>
> "{{.*}}/usr/lib/gcc/arm-linux-gnueabihf/4.6.3/../../../arm-linux-<br>
> gnueabihf/c<br>
> rt1.o"<br>
> +// CHECK-UBUNTU-12-04-ARM-HF:<br>
> "{{.*}}/usr/lib/gcc/arm-linux-gnueabihf/4.6.3/../../../arm-linux-<br>
> gnueabihf/c<br>
> rti.o"<br>
> +// CHECK-UBUNTU-12-04-ARM-HF:<br>
> "{{.*}}/usr/lib/gcc/arm-linux-gnueabihf/4.6.3/crtbegin.o"<br>
> +// CHECK-UBUNTU-12-04-ARM-HF:<br>
> "-L[[SYSROOT]]/usr/lib/gcc/arm-linux-gnueabihf/4.6.3"<br>
> +// CHECK-UBUNTU-12-04-ARM-HF:<br>
> "-L[[SYSROOT]]/usr/lib/gcc/arm-linux-gnueabihf/4.6.3/../../../arm-linux-<br>
> gnue<br>
> abihf"<br>
> +// CHECK-UBUNTU-12-04-ARM-HF: "-L[[SYSROOT]]/lib/arm-linux-gnueabihf"<br>
> +// CHECK-UBUNTU-12-04-ARM-HF: "-L[[SYSROOT]]/usr/lib/arm-linux-<br>
> gnueabihf"<br>
> +// CHECK-UBUNTU-12-04-ARM-HF:<br>
> "-L[[SYSROOT]]/usr/lib/gcc/arm-linux-gnueabihf/4.6.3/../../.."<br>
> +// CHECK-UBUNTU-12-04-ARM-HF:<br>
> "{{.*}}/usr/lib/gcc/arm-linux-gnueabihf/4.6.3/crtend.o"<br>
> +// CHECK-UBUNTU-12-04-ARM-HF:<br>
> "{{.*}}/usr/lib/gcc/arm-linux-gnueabihf/4.6.3/../../../arm-linux-<br>
> gnueabihf/c<br>
> rtn.o"<br>
> +//<br>
> +// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \<br>
> +// RUN: -target arm-unknown-linux-gnueabi \<br>
> +// RUN: --sysroot=%S/Inputs/ubuntu_12.04_LTS_multiarch_tree \<br>
> +// RUN: | FileCheck --check-prefix=CHECK-UBUNTU-12-04-ARM %s<br>
> +// CHECK-UBUNTU-12-04-ARM: "{{.*}}ld{{(.exe)?}}"<br>
> "--sysroot=[[SYSROOT:[^"]+]]"<br>
> +// CHECK-UBUNTU-12-04-ARM:<br>
> "{{.*}}/usr/lib/gcc/arm-linux-gnueabi/4.6.1/../../../arm-linux-<br>
> gnueabi/crt1.<br>
> o"<br>
> +// CHECK-UBUNTU-12-04-ARM:<br>
> "{{.*}}/usr/lib/gcc/arm-linux-gnueabi/4.6.1/../../../arm-linux-<br>
> gnueabi/crti.<br>
> o"<br>
> +// CHECK-UBUNTU-12-04-ARM:<br>
> "{{.*}}/usr/lib/gcc/arm-linux-gnueabi/4.6.1/crtbegin.o"<br>
> +// CHECK-UBUNTU-12-04-ARM:<br>
> "-L[[SYSROOT]]/usr/lib/gcc/arm-linux-gnueabi/4.6.1"<br>
> +// CHECK-UBUNTU-12-04-ARM:<br>
> "-L[[SYSROOT]]/usr/lib/gcc/arm-linux-gnueabi/4.6.1/../../../arm-linux-<br>
> gnueab<br>
> i"<br>
> +// CHECK-UBUNTU-12-04-ARM: "-L[[SYSROOT]]/lib/arm-linux-gnueabi"<br>
> +// CHECK-UBUNTU-12-04-ARM: "-L[[SYSROOT]]/usr/lib/arm-linux-gnueabi"<br>
> +// CHECK-UBUNTU-12-04-ARM:<br>
> "-L[[SYSROOT]]/usr/lib/gcc/arm-linux-gnueabi/4.6.1/../../.."<br>
> +// CHECK-UBUNTU-12-04-ARM:<br>
> "{{.*}}/usr/lib/gcc/arm-linux-gnueabi/4.6.1/crtend.o"<br>
> +// CHECK-UBUNTU-12-04-ARM:<br>
> "{{.*}}/usr/lib/gcc/arm-linux-gnueabi/4.6.1/../../../arm-linux-<br>
> gnueabi/crtn.<br>
> o"<br>
> +//<br>
> // Test the setup that shipped in SUSE 10.3 on ppc64.<br>
> // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \<br>
> // RUN: -target powerpc64-suse-linux \<br>
<br>
<br>
<br>
</div></div>_______________________________________________<br>
cfe-commits mailing list<br>
<a href="mailto:cfe-commits@cs.uiuc.edu">cfe-commits@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits</a><br>
</blockquote></div><br></div>