[PATCH] D25686: [Driver] Improve support for Gentoo arm*-hardfloat-*-*eabi triples

2016-12-12 Thread Michał Górny via Phabricator via cfe-commits
mgorny abandoned this revision.
mgorny added a comment.

I give up. I'm just going to complain to Gentoo ARM people a lot and maybe 
they'll fix their triples.


https://reviews.llvm.org/D25686



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D25686: [Driver] Improve support for Gentoo arm*-hardfloat-*-*eabi triples

2016-12-12 Thread Renato Golin via Phabricator via cfe-commits
rengolin added a comment.

We already massage the triple in many cases, and what goes into IR is not 
always the same as what is used in Clang.

Examples are x86_64's "x32" extension to the ABI, ARM -> Thumb triples, adding 
compulsory dashes and unknowns (ex. x86_64--linux-gnu), etc.

You just have to find the right places.


https://reviews.llvm.org/D25686



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D25686: [Driver] Improve support for Gentoo arm*-hardfloat-*-*eabi triples

2016-12-06 Thread Michał Górny via Phabricator via cfe-commits
mgorny added a comment.

In https://reviews.llvm.org/D25686#614420, @rengolin wrote:

> I think this patch should move to canonicalise the triple as per all the 
> others, in the right place (vendor/environment).
>
> If you find `hardfloat` or on where the vendor should be, and there are no 
> other possible vendors, just append `hf` to the environment and mark the 
> vendor as `unknown`. This works already with `gnueabihf`, `eabihf` and 
> `muslabihf` (doubts about this last one).
>
> What the clang driver accepts is different than what the rest of the compiler 
> should use.


Ok but I think that then clang will not be able to find the gcc directory. Am I 
missing something obvious?


https://reviews.llvm.org/D25686



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D25686: [Driver] Improve support for Gentoo arm*-hardfloat-*-*eabi triples

2016-12-06 Thread Renato Golin via Phabricator via cfe-commits
rengolin added a comment.

I think this patch should move to canonicalise the triple as per all the 
others, in the right place (vendor/environment).

If you find `hardfloat` or on where the vendor should be, and there are no 
other possible vendors, just append `hf` to the environment and mark the vendor 
as `unknown`. This works already with `gnueabihf`, `eabihf` and `muslabihf` 
(doubts about this last one).

What the clang driver accepts is different than what the rest of the compiler 
should use.


https://reviews.llvm.org/D25686



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D25686: [Driver] Improve support for Gentoo arm*-hardfloat-*-*eabi triples

2016-12-06 Thread Michał Górny via Phabricator via cfe-commits
mgorny added a comment.

How should I proceed, then? Was something along the lines of the earlier diff a 
better idea?


https://reviews.llvm.org/D25686



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D25686: [Driver] Improve support for Gentoo arm*-hardfloat-*-*eabi triples

2016-12-05 Thread Saleem Abdulrasool via Phabricator via cfe-commits
compnerd added a comment.

Please don't canonicalize the triple that way.  The behavior of 
`armv7-unknown-linux-gnueabi` is different from `armv7-unknown-linux-gnueabihf` 
which is different from `armv7-unknown-linux-gnueabihf -mfloat-abi=hard`.  I 
agree that this is absolutely terrible and unexpected, and a disaster from a 
user's perspective, but this is the world that we live in order to maintain 
compatibility with GCC.


https://reviews.llvm.org/D25686



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D25686: [Driver] Improve support for Gentoo arm*-hardfloat-*-*eabi triples

2016-12-02 Thread Renato Golin via Phabricator via cfe-commits
rengolin added inline comments.



Comment at: test/Driver/linux-ld.c:1016
+// CHECK-LD-GENTOO-ARMHF: "-dynamic-linker" "/lib/ld-linux-armhf.so.3"
+// CHECK-LD-GENTOO-ARMHF: 
"{{.*}}/usr/lib/gcc/armv7a-hardfloat-linux-gnueabi/4.9.3/crtbegin.o"
+// CHECK-LD-GENTOO-ARMHF: 
"-L[[SYSROOT]]/usr/lib/gcc/armv7a-hardfloat-linux-gnueabi/4.9.3"

mgorny wrote:
> rengolin wrote:
> > mgorny wrote:
> > > rengolin wrote:
> > > > where is 4.9.3 coming from?
> > > It's the version used in the input tree, i.e. the two added files above.
> > Right, I mean is this "4.9.3" there because the driver "found" it there, or 
> > is it generated by the compiler version you have on your machine, and 
> > that's why you created the directory with "4.9.3" in it?
> > 
> > I'm worried that if it's the latter, the test will fail on any machine that 
> > doesn't have that compiler version. But I really don't know how it works, 
> > so it was an honest question. :)
> It's there because Driver founds it in Input directory structure. I don't 
> have that version installed locally, if that's what worries you. You could 
> say it's intentionally different from my install but I've simply copied the 
> version used by other Gentoo tests.
That answers my question, thanks! :)


https://reviews.llvm.org/D25686



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D25686: [Driver] Improve support for Gentoo arm*-hardfloat-*-*eabi triples

2016-12-02 Thread Michał Górny via Phabricator via cfe-commits
mgorny added inline comments.



Comment at: test/Driver/linux-ld.c:1016
+// CHECK-LD-GENTOO-ARMHF: "-dynamic-linker" "/lib/ld-linux-armhf.so.3"
+// CHECK-LD-GENTOO-ARMHF: 
"{{.*}}/usr/lib/gcc/armv7a-hardfloat-linux-gnueabi/4.9.3/crtbegin.o"
+// CHECK-LD-GENTOO-ARMHF: 
"-L[[SYSROOT]]/usr/lib/gcc/armv7a-hardfloat-linux-gnueabi/4.9.3"

rengolin wrote:
> mgorny wrote:
> > rengolin wrote:
> > > where is 4.9.3 coming from?
> > It's the version used in the input tree, i.e. the two added files above.
> Right, I mean is this "4.9.3" there because the driver "found" it there, or 
> is it generated by the compiler version you have on your machine, and that's 
> why you created the directory with "4.9.3" in it?
> 
> I'm worried that if it's the latter, the test will fail on any machine that 
> doesn't have that compiler version. But I really don't know how it works, so 
> it was an honest question. :)
It's there because Driver founds it in Input directory structure. I don't have 
that version installed locally, if that's what worries you. You could say it's 
intentionally different from my install but I've simply copied the version used 
by other Gentoo tests.


https://reviews.llvm.org/D25686



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D25686: [Driver] Improve support for Gentoo arm*-hardfloat-*-*eabi triples

2016-12-02 Thread Renato Golin via Phabricator via cfe-commits
rengolin added inline comments.



Comment at: lib/Driver/ToolChains.cpp:1674
   TripleAliases.append(begin(ARMHFTriples), end(ARMHFTriples));
+} else if (TargetTriple.getEnvironment() == llvm::Triple::MuslEABIHF) {
+  TripleAliases.append(begin(ARMHFMuslTriples), end(ARMHFMuslTriples));

mgorny wrote:
> rengolin wrote:
> > You're not testing this...
> Well, I presumed I don't have to test every single possible triple. But sure, 
> I can add a test for that.
You should test every new thing that you add.



Comment at: test/Driver/linux-ld.c:1016
+// CHECK-LD-GENTOO-ARMHF: "-dynamic-linker" "/lib/ld-linux-armhf.so.3"
+// CHECK-LD-GENTOO-ARMHF: 
"{{.*}}/usr/lib/gcc/armv7a-hardfloat-linux-gnueabi/4.9.3/crtbegin.o"
+// CHECK-LD-GENTOO-ARMHF: 
"-L[[SYSROOT]]/usr/lib/gcc/armv7a-hardfloat-linux-gnueabi/4.9.3"

mgorny wrote:
> rengolin wrote:
> > where is 4.9.3 coming from?
> It's the version used in the input tree, i.e. the two added files above.
Right, I mean is this "4.9.3" there because the driver "found" it there, or is 
it generated by the compiler version you have on your machine, and that's why 
you created the directory with "4.9.3" in it?

I'm worried that if it's the latter, the test will fail on any machine that 
doesn't have that compiler version. But I really don't know how it works, so it 
was an honest question. :)


https://reviews.llvm.org/D25686



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D25686: [Driver] Improve support for Gentoo arm*-hardfloat-*-*eabi triples

2016-12-02 Thread Michał Górny via Phabricator via cfe-commits
mgorny added inline comments.



Comment at: lib/Driver/ToolChains.cpp:1674
   TripleAliases.append(begin(ARMHFTriples), end(ARMHFTriples));
+} else if (TargetTriple.getEnvironment() == llvm::Triple::MuslEABIHF) {
+  TripleAliases.append(begin(ARMHFMuslTriples), end(ARMHFMuslTriples));

rengolin wrote:
> You're not testing this...
Well, I presumed I don't have to test every single possible triple. But sure, I 
can add a test for that.



Comment at: test/Driver/linux-ld.c:1016
+// CHECK-LD-GENTOO-ARMHF: "-dynamic-linker" "/lib/ld-linux-armhf.so.3"
+// CHECK-LD-GENTOO-ARMHF: 
"{{.*}}/usr/lib/gcc/armv7a-hardfloat-linux-gnueabi/4.9.3/crtbegin.o"
+// CHECK-LD-GENTOO-ARMHF: 
"-L[[SYSROOT]]/usr/lib/gcc/armv7a-hardfloat-linux-gnueabi/4.9.3"

rengolin wrote:
> where is 4.9.3 coming from?
It's the version used in the input tree, i.e. the two added files above.


https://reviews.llvm.org/D25686



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D25686: [Driver] Improve support for Gentoo arm*-hardfloat-*-*eabi triples

2016-12-02 Thread Renato Golin via Phabricator via cfe-commits
rengolin added a reviewer: compnerd.
rengolin added inline comments.



Comment at: lib/Driver/ToolChains.cpp:1674
   TripleAliases.append(begin(ARMHFTriples), end(ARMHFTriples));
+} else if (TargetTriple.getEnvironment() == llvm::Triple::MuslEABIHF) {
+  TripleAliases.append(begin(ARMHFMuslTriples), end(ARMHFMuslTriples));

You're not testing this...



Comment at: test/Driver/linux-ld.c:1016
+// CHECK-LD-GENTOO-ARMHF: "-dynamic-linker" "/lib/ld-linux-armhf.so.3"
+// CHECK-LD-GENTOO-ARMHF: 
"{{.*}}/usr/lib/gcc/armv7a-hardfloat-linux-gnueabi/4.9.3/crtbegin.o"
+// CHECK-LD-GENTOO-ARMHF: 
"-L[[SYSROOT]]/usr/lib/gcc/armv7a-hardfloat-linux-gnueabi/4.9.3"

where is 4.9.3 coming from?


https://reviews.llvm.org/D25686



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D25686: [Driver] Improve support for Gentoo arm*-hardfloat-*-*eabi triples

2016-12-02 Thread Michał Górny via Phabricator via cfe-commits
mgorny retitled this revision from "[Driver] Support "hardfloat" vendor triples 
used by Gentoo" to "[Driver] Improve support for Gentoo arm*-hardfloat-*-*eabi 
triples".
mgorny updated the summary for this revision.
mgorny added a reviewer: atanasyan.
mgorny updated this revision to Diff 80118.

https://reviews.llvm.org/D25686

Files:
  lib/Driver/ToolChains.cpp
  
test/Driver/Inputs/gentoo_linux_gcc_armhf_tree/usr/armv7a-hardfloat-linux-gnueabi/lib/.keep
  test/Driver/Inputs/gentoo_linux_gcc_armhf_tree/usr/include/.keep
  
test/Driver/Inputs/gentoo_linux_gcc_armhf_tree/usr/lib/gcc/armv7a-hardfloat-linux-gnueabi/4.9.3/crtbegin.o
  
test/Driver/Inputs/gentoo_linux_gcc_armhf_tree/usr/lib/gcc/armv7a-hardfloat-linux-gnueabi/4.9.3/include/g++-v4.9.3/.keep
  test/Driver/linux-ld.c


Index: test/Driver/linux-ld.c
===
--- test/Driver/linux-ld.c
+++ test/Driver/linux-ld.c
@@ -1002,6 +1002,32 @@
 // CHECK-DEBIAN-SPARC64: 
"[[SYSROOT]]/usr/lib/gcc/sparc64-linux-gnu/4.9{{/|}}crtend.o"
 // CHECK-DEBIAN-SPARC64: 
"[[SYSROOT]]/usr/lib/gcc/sparc64-linux-gnu/4.9/../../../sparc64-linux-gnu{{/|}}crtn.o"
 //
+// Check Gentoo Linux with GCC installed using arm*-hardfloat-linux-gnu* 
triples.
+// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
+// RUN: --target=armv7a-hardfloat-linux-gnueabi --rtlib=platform \
+// RUN: --gcc-toolchain="" \
+// RUN: --sysroot=%S/Inputs/gentoo_linux_gcc_armhf_tree \
+// RUN:   | FileCheck --check-prefix=CHECK-LD-GENTOO-ARMHF %s
+// CHECK-LD-GENTOO-ARMHF-NOT: warning:
+// CHECK-LD-GENTOO-ARMHF: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
+// CHECK-LD-GENTOO-ARMHF: "--eh-frame-hdr"
+// CHECK-LD-GENTOO-ARMHF: "-m" "armelf_linux_eabi"
+// CHECK-LD-GENTOO-ARMHF: "-dynamic-linker" "/lib/ld-linux-armhf.so.3"
+// CHECK-LD-GENTOO-ARMHF: 
"{{.*}}/usr/lib/gcc/armv7a-hardfloat-linux-gnueabi/4.9.3/crtbegin.o"
+// CHECK-LD-GENTOO-ARMHF: 
"-L[[SYSROOT]]/usr/lib/gcc/armv7a-hardfloat-linux-gnueabi/4.9.3"
+// CHECK-LD-GENTOO-ARMHF: 
"-L[[SYSROOT]]/usr/lib/gcc/armv7a-hardfloat-linux-gnueabi/4.9.3/../../../../armv7a-hardfloat-linux-gnueabi/lib"
+// CHECK-LD-GENTOO-ARMHF: 
"-L[[SYSROOT]]/usr/lib/gcc/armv7a-hardfloat-linux-gnueabi/4.9.3/../../.."
+// CHECK-LD-GENTOO-ARMHF: "-lgcc" "--as-needed" "-lgcc_s" "--no-as-needed"
+// CHECK-LD-GENTOO-ARMHF: "-lc"
+// CHECK-LD-GENTOO-ARMHF: "-lgcc" "--as-needed" "-lgcc_s" "--no-as-needed"
+//
+// Check whether the standard ARM triples can find Gentoo gcc.
+// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
+// RUN: --target=armv7a-unknown-linux-gnueabihf --rtlib=platform \
+// RUN: --gcc-toolchain="" \
+// RUN: --sysroot=%S/Inputs/gentoo_linux_gcc_armhf_tree \
+// RUN:   | FileCheck --check-prefix=CHECK-LD-GENTOO-ARMHF %s
+//
 // Test linker invocation on Android.
 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
 // RUN: --target=arm-linux-androideabi -rtlib=platform \
Index: lib/Driver/ToolChains.cpp
===
--- lib/Driver/ToolChains.cpp
+++ lib/Driver/ToolChains.cpp
@@ -1557,14 +1557,21 @@
   static const char *const ARMLibDirs[] = {"/lib"};
   static const char *const ARMTriples[] = {"arm-linux-gnueabi",
"arm-linux-androideabi"};
+  // arm*-hardfloat-* triples are used by Gentoo
   static const char *const ARMHFTriples[] = {"arm-linux-gnueabihf",
+ "armv6j-hardfloat-linux-gnueabi",
+ "armv7a-hardfloat-linux-gnueabi",
  "armv7hl-redhat-linux-gnueabi"};
   static const char *const ARMebLibDirs[] = {"/lib"};
   static const char *const ARMebTriples[] = {"armeb-linux-gnueabi",
  "armeb-linux-androideabi"};
   static const char *const ARMebHFTriples[] = {
   "armeb-linux-gnueabihf", "armebv7hl-redhat-linux-gnueabi"};
 
+  static const char *const ARMHFMuslTriples[] = {
+  "armv6j-hardfloat-linux-musleabi",
+  "armv7a-hardfloat-linux-musleabi"};
+
   static const char *const X86_64LibDirs[] = {"/lib64", "/lib"};
   static const char *const X86_64Triples[] = {
   "x86_64-linux-gnu",   "x86_64-unknown-linux-gnu",
@@ -1664,6 +1671,8 @@
 LibDirs.append(begin(ARMLibDirs), end(ARMLibDirs));
 if (TargetTriple.getEnvironment() == llvm::Triple::GNUEABIHF) {
   TripleAliases.append(begin(ARMHFTriples), end(ARMHFTriples));
+} else if (TargetTriple.getEnvironment() == llvm::Triple::MuslEABIHF) {
+  TripleAliases.append(begin(ARMHFMuslTriples), end(ARMHFMuslTriples));
 } else {
   TripleAliases.append(begin(ARMTriples), end(ARMTriples));
 }


Index: test/Driver/linux-ld.c
===
--- test/Driver/linux-ld.c
+++ test/Driver/linux-ld.c
@@ -1002,6 +1002,32 @@
 //