[PATCH] D52259: [CUDA] Fix two failed test cases using --cuda-path-ignore-env

2018-09-24 Thread Jiading Gai via Phabricator via cfe-commits
gaijiading updated this revision to Diff 166811.
gaijiading retitled this revision from "[CUDA] Rearrange search path ordering 
to fix two test case failures" to "[CUDA] Fix two failed test cases using 
--cuda-path-ignore-env".
gaijiading edited the summary of this revision.
gaijiading added a comment.

Thanks for the comments. Revised the patch to fix them using 
--cuda-path-ignore-env.


Repository:
  rC Clang

https://reviews.llvm.org/D52259

Files:
  test/Driver/cuda-detect.cu
  test/Driver/cuda-macosx.cu


Index: test/Driver/cuda-macosx.cu
===
--- test/Driver/cuda-macosx.cu
+++ test/Driver/cuda-macosx.cu
@@ -3,6 +3,6 @@
 // REQUIRES: nvptx-registered-target
 //
 // RUN: %clang -v --target=i386-apple-macosx \
-// RUN:   --sysroot=%S/Inputs/CUDA-macosx 2>&1 | FileCheck %s
+// RUN:   --sysroot=%S/Inputs/CUDA-macosx --cuda-path-ignore-env 2>&1 | 
FileCheck %s
 
 // CHECK: Found CUDA installation: {{.*}}/Inputs/CUDA-macosx/usr/local/cuda
Index: test/Driver/cuda-detect.cu
===
--- test/Driver/cuda-detect.cu
+++ test/Driver/cuda-detect.cu
@@ -14,9 +14,9 @@
 
 
 // RUN: %clang -v --target=i386-unknown-linux \
-// RUN:   --sysroot=%S/Inputs/CUDA 2>&1 | FileCheck %s
+// RUN:   --sysroot=%S/Inputs/CUDA --cuda-path-ignore-env 2>&1 | FileCheck %s
 // RUN: %clang -v --target=i386-apple-macosx \
-// RUN:   --sysroot=%S/Inputs/CUDA 2>&1 | FileCheck %s
+// RUN:   --sysroot=%S/Inputs/CUDA --cuda-path-ignore-env 2>&1 | FileCheck %s
 
 // RUN: %clang -v --target=i386-unknown-linux \
 // RUN:   --cuda-path=%S/Inputs/CUDA/usr/local/cuda 2>&1 | FileCheck %s


Index: test/Driver/cuda-macosx.cu
===
--- test/Driver/cuda-macosx.cu
+++ test/Driver/cuda-macosx.cu
@@ -3,6 +3,6 @@
 // REQUIRES: nvptx-registered-target
 //
 // RUN: %clang -v --target=i386-apple-macosx \
-// RUN:   --sysroot=%S/Inputs/CUDA-macosx 2>&1 | FileCheck %s
+// RUN:   --sysroot=%S/Inputs/CUDA-macosx --cuda-path-ignore-env 2>&1 | FileCheck %s
 
 // CHECK: Found CUDA installation: {{.*}}/Inputs/CUDA-macosx/usr/local/cuda
Index: test/Driver/cuda-detect.cu
===
--- test/Driver/cuda-detect.cu
+++ test/Driver/cuda-detect.cu
@@ -14,9 +14,9 @@
 
 
 // RUN: %clang -v --target=i386-unknown-linux \
-// RUN:   --sysroot=%S/Inputs/CUDA 2>&1 | FileCheck %s
+// RUN:   --sysroot=%S/Inputs/CUDA --cuda-path-ignore-env 2>&1 | FileCheck %s
 // RUN: %clang -v --target=i386-apple-macosx \
-// RUN:   --sysroot=%S/Inputs/CUDA 2>&1 | FileCheck %s
+// RUN:   --sysroot=%S/Inputs/CUDA --cuda-path-ignore-env 2>&1 | FileCheck %s
 
 // RUN: %clang -v --target=i386-unknown-linux \
 // RUN:   --cuda-path=%S/Inputs/CUDA/usr/local/cuda 2>&1 | FileCheck %s
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D52259: [CUDA] Rearrange search path ordering to fix two test case failures

2018-09-19 Thread Jiading Gai via Phabricator via cfe-commits
gaijiading updated this revision to Diff 166206.
gaijiading added a comment.

Apologies for having uploaded the wrong patch in my original review request. 
Please help review this version instead. Thanks.


Repository:
  rC Clang

https://reviews.llvm.org/D52259

Files:
  lib/Driver/ToolChains/Cuda.cpp


Index: lib/Driver/ToolChains/Cuda.cpp
===
--- lib/Driver/ToolChains/Cuda.cpp
+++ lib/Driver/ToolChains/Cuda.cpp
@@ -87,6 +87,10 @@
   D.SysRoot + "/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v" +
   Ver);
   } else {
+Candidates.emplace_back(D.SysRoot + "/usr/local/cuda");
+for (const char *Ver : Versions)
+  Candidates.emplace_back(D.SysRoot + "/usr/local/cuda-" + Ver);
+
 if (!Args.hasArg(clang::driver::options::OPT_cuda_path_ignore_env)) {
   // Try to find ptxas binary. If the executable is located in a directory
   // called 'bin/', its parent directory might be a good guess for a valid
@@ -108,10 +112,6 @@
   }
 }
 
-Candidates.emplace_back(D.SysRoot + "/usr/local/cuda");
-for (const char *Ver : Versions)
-  Candidates.emplace_back(D.SysRoot + "/usr/local/cuda-" + Ver);
-
 if (Distro(D.getVFS()).IsDebian())
   // Special case for Debian to have nvidia-cuda-toolkit work
   // out of the box. More info on http://bugs.debian.org/882505


Index: lib/Driver/ToolChains/Cuda.cpp
===
--- lib/Driver/ToolChains/Cuda.cpp
+++ lib/Driver/ToolChains/Cuda.cpp
@@ -87,6 +87,10 @@
   D.SysRoot + "/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v" +
   Ver);
   } else {
+Candidates.emplace_back(D.SysRoot + "/usr/local/cuda");
+for (const char *Ver : Versions)
+  Candidates.emplace_back(D.SysRoot + "/usr/local/cuda-" + Ver);
+
 if (!Args.hasArg(clang::driver::options::OPT_cuda_path_ignore_env)) {
   // Try to find ptxas binary. If the executable is located in a directory
   // called 'bin/', its parent directory might be a good guess for a valid
@@ -108,10 +112,6 @@
   }
 }
 
-Candidates.emplace_back(D.SysRoot + "/usr/local/cuda");
-for (const char *Ver : Versions)
-  Candidates.emplace_back(D.SysRoot + "/usr/local/cuda-" + Ver);
-
 if (Distro(D.getVFS()).IsDebian())
   // Special case for Debian to have nvidia-cuda-toolkit work
   // out of the box. More info on http://bugs.debian.org/882505
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D52259: [CUDA] Rearrange search path ordering to fix two test case failures

2018-09-18 Thread Jiading Gai via Phabricator via cfe-commits
gaijiading created this revision.
gaijiading added reviewers: jlebar, Hahnfeld, dlj, tra.
gaijiading added a project: clang.
Herald added a subscriber: cfe-commits.

Before this patch, when a system has the CUDA toolkit already installed to its 
default locations in /usr/local/cuda, there will be two unexpected test case 
failures:

1. /test/Driver/cuda-detect.cu
2. /test/Driver/cuda-macosx.cu

The reason being that the overall search order was set up to always pick up the 
path with well-known tools such as ptxas in it; However, the above two test 
cases require the CUDA path to be the one that is passed to --sysroot.

Moving the sysroot path on top fixes the issue.


Repository:
  rC Clang

https://reviews.llvm.org/D52259

Files:
  unittests/Analysis/ExprMutationAnalyzerTest.cpp

Index: unittests/Analysis/ExprMutationAnalyzerTest.cpp
===
--- unittests/Analysis/ExprMutationAnalyzerTest.cpp
+++ unittests/Analysis/ExprMutationAnalyzerTest.cpp
@@ -29,6 +29,18 @@
 using ExprMatcher = internal::Matcher;
 using StmtMatcher = internal::Matcher;
 
+std::unique_ptr
+buildASTFromCodeWithArgs(const Twine ,
+ const std::vector ) {
+  auto AST = tooling::buildASTFromCodeWithArgs(Code, Args);
+  EXPECT_FALSE(AST->getDiagnostics().hasErrorOccurred());
+  return AST;
+}
+
+std::unique_ptr buildASTFromCode(const Twine ) {
+  return buildASTFromCodeWithArgs(Code, {});
+}
+
 ExprMatcher declRefTo(StringRef Name) {
   return declRefExpr(to(namedDecl(hasName(Name;
 }
@@ -83,12 +95,12 @@
 "template T&& "
 "forward(typename remove_reference::type& t) noexcept { return t; }"
 "template T&& "
-"forward(typename remove_reference::type&&) noexcept { return t; } }";
+"forward(typename remove_reference::type&& t) noexcept { return t; } }";
 
 } // namespace
 
 TEST(ExprMutationAnalyzerTest, Trivial) {
-  const auto AST = tooling::buildASTFromCode("void f() { int x; x; }");
+  const auto AST = buildASTFromCode("void f() { int x; x; }");
   const auto Results =
   match(withEnclosingCompound(declRefTo("x")), AST->getASTContext());
   EXPECT_FALSE(isMutated(Results, AST.get()));
@@ -98,8 +110,7 @@
 
 TEST_P(AssignmentTest, AssignmentModifies) {
   const std::string ModExpr = "x " + GetParam() + " 10";
-  const auto AST =
-  tooling::buildASTFromCode("void f() { int x; " + ModExpr + "; }");
+  const auto AST = buildASTFromCode("void f() { int x; " + ModExpr + "; }");
   const auto Results =
   match(withEnclosingCompound(declRefTo("x")), AST->getASTContext());
   EXPECT_THAT(mutatedBy(Results, AST.get()), ElementsAre(ModExpr));
@@ -113,8 +124,7 @@
 
 TEST_P(IncDecTest, IncDecModifies) {
   const std::string ModExpr = GetParam();
-  const auto AST =
-  tooling::buildASTFromCode("void f() { int x; " + ModExpr + "; }");
+  const auto AST = buildASTFromCode("void f() { int x; " + ModExpr + "; }");
   const auto Results =
   match(withEnclosingCompound(declRefTo("x")), AST->getASTContext());
   EXPECT_THAT(mutatedBy(Results, AST.get()), ElementsAre(ModExpr));
@@ -124,476 +134,447 @@
 Values("++x", "--x", "x++", "x--"), );
 
 TEST(ExprMutationAnalyzerTest, NonConstMemberFunc) {
-  const auto AST = tooling::buildASTFromCode(
+  const auto AST = buildASTFromCode(
   "void f() { struct Foo { void mf(); }; Foo x; x.mf(); }");
   const auto Results =
   match(withEnclosingCompound(declRefTo("x")), AST->getASTContext());
   EXPECT_THAT(mutatedBy(Results, AST.get()), ElementsAre("x.mf()"));
 }
 
 TEST(ExprMutationAnalyzerTest, AssumedNonConstMemberFunc) {
-  auto AST = tooling::buildASTFromCodeWithArgs(
+  auto AST = buildASTFromCodeWithArgs(
   "struct X { template  void mf(); };"
   "template  void f() { X x; x.mf(); }",
   {"-fno-delayed-template-parsing"});
   auto Results =
   match(withEnclosingCompound(declRefTo("x")), AST->getASTContext());
   EXPECT_THAT(mutatedBy(Results, AST.get()), ElementsAre("x.mf()"));
 
-  AST = tooling::buildASTFromCodeWithArgs(
-  "template  void f() { T x; x.mf(); }",
-  {"-fno-delayed-template-parsing"});
+  AST = buildASTFromCodeWithArgs("template  void f() { T x; x.mf(); }",
+ {"-fno-delayed-template-parsing"});
   Results = match(withEnclosingCompound(declRefTo("x")), AST->getASTContext());
   EXPECT_THAT(mutatedBy(Results, AST.get()), ElementsAre("x.mf()"));
 
-  AST = tooling::buildASTFromCodeWithArgs(
+  AST = buildASTFromCodeWithArgs(
   "template  struct X;"
   "template  void f() { X x; x.mf(); }",
   {"-fno-delayed-template-parsing"});
   Results = match(withEnclosingCompound(declRefTo("x")), AST->getASTContext());
   EXPECT_THAT(mutatedBy(Results, AST.get()), ElementsAre("x.mf()"));
 }
 
 TEST(ExprMutationAnalyzerTest, ConstMemberFunc) {
-  const auto AST = tooling::buildASTFromCode(
+  const auto AST = buildASTFromCode(
   "void f() { struct Foo { void mf() const; }; 

[PATCH] D46230: For x86_64, gcc 7.2 under Amazon Linux AMI sets its paths to x86_64-amazon-linux

2018-07-24 Thread Jiading Gai via Phabricator via cfe-commits
gaijiading added a comment.

Hi Roman,

The cause of it was that, during committing the patch (r337811), svn skipped 
over an empty directory that was required for my test case. I've submitted a 
fix in a follow-up commit (r337813). Thanks.

In https://reviews.llvm.org/D46230#1173063, @lebedev.ri wrote:

> The test fails here:
>
>   FAIL: Clang :: Driver/linux-ld.c (4670 of 12944)
>    TEST 'Clang :: Driver/linux-ld.c' FAILED 
> 
>   Script:
>   --
>   : 'RUN: at line 4';   /build/llvm-build-GCC-release/bin/clang 
> -no-canonical-prefixes /build/clang/test/Driver/linux-ld.c -### -o 
> /build/llvm-build-GCC-release/tools/clang/test/Driver/Output/linux-ld.c.tmp.o 
> 2>&1  --target=i386-unknown-linux  --gcc-toolchain=""  
> --sysroot=/build/clang/test/Driver/Inputs/basic_linux_tree| 
> /build/llvm-build-GCC-release/bin/FileCheck --check-prefix=CHECK-LD-32 
> /build/clang/test/Driver/linux-ld.c
>   : 'RUN: at line 18';   /build/llvm-build-GCC-release/bin/clang 
> -no-canonical-prefixes /build/clang/test/Driver/linux-ld.c -### -o 
> /build/llvm-build-GCC-release/tools/clang/test/Driver/Output/linux-ld.c.tmp.o 
> 2>&1  --target=x86_64-unknown-linux -rtlib=platform  
> --gcc-toolchain=""  
> --sysroot=/build/clang/test/Driver/Inputs/basic_linux_tree| 
> /build/llvm-build-GCC-release/bin/FileCheck --check-prefix=CHECK-LD-64 
> /build/clang/test/Driver/linux-ld.c
>   : 'RUN: at line 38';   /build/llvm-build-GCC-release/bin/clang 
> -no-canonical-prefixes /build/clang/test/Driver/linux-ld.c -### -o 
> /build/llvm-build-GCC-release/tools/clang/test/Driver/Output/linux-ld.c.tmp.o 
> 2>&1  --target=x86_64-unknown-linux-gnux32 -rtlib=platform  
> --gcc-toolchain=""  
> --sysroot=/build/clang/test/Driver/Inputs/basic_linux_tree| 
> /build/llvm-build-GCC-release/bin/FileCheck --check-prefix=CHECK-LD-X32 
> /build/clang/test/Driver/linux-ld.c
>   : 'RUN: at line 52';   /build/llvm-build-GCC-release/bin/clang 
> -no-canonical-prefixes /build/clang/test/Driver/linux-ld.c -### -o 
> /build/llvm-build-GCC-release/tools/clang/test/Driver/Output/linux-ld.c.tmp.o 
> 2>&1  --target=x86_64-unknown-linux  --gcc-toolchain=""  
> --sysroot=/build/clang/test/Driver/Inputs/basic_linux_tree  
> --rtlib=compiler-rt| /build/llvm-build-GCC-release/bin/FileCheck 
> --check-prefix=CHECK-LD-RT /build/clang/test/Driver/linux-ld.c
>   : 'RUN: at line 73';   /build/llvm-build-GCC-release/bin/clang 
> -no-canonical-prefixes /build/clang/test/Driver/linux-ld.c -### -o 
> /build/llvm-build-GCC-release/tools/clang/test/Driver/Output/linux-ld.c.tmp.o 
> 2>&1  --target=i686-unknown-linux  --gcc-toolchain=""  
> --sysroot=/build/clang/test/Driver/Inputs/basic_linux_tree  
> --rtlib=compiler-rt| /build/llvm-build-GCC-release/bin/FileCheck 
> --check-prefix=CHECK-LD-RT-I686 /build/clang/test/Driver/linux-ld.c
>   : 'RUN: at line 94';   /build/llvm-build-GCC-release/bin/clang 
> -no-canonical-prefixes /build/clang/test/Driver/linux-ld.c -### -o 
> /build/llvm-build-GCC-release/tools/clang/test/Driver/Output/linux-ld.c.tmp.o 
> 2>&1  --target=arm-linux-androideabi  --gcc-toolchain=""  
> --sysroot=/build/clang/test/Driver/Inputs/basic_android_tree/sysroot  
> --rtlib=compiler-rt| /build/llvm-build-GCC-release/bin/FileCheck 
> --check-prefix=CHECK-LD-RT-ANDROID /build/clang/test/Driver/linux-ld.c
>   : 'RUN: at line 109';   /build/llvm-build-GCC-release/bin/clang 
> -no-canonical-prefixes /build/clang/test/Driver/linux-ld.c -### -o 
> /build/llvm-build-GCC-release/tools/clang/test/Driver/Output/linux-ld.c.tmp.o 
> 2>&1  --target=x86_64-unknown-linux -rtlib=platform  
> --gcc-toolchain=""  
> --sysroot=/build/clang/test/Driver/Inputs/basic_linux_tree  
> --rtlib=libgcc| /build/llvm-build-GCC-release/bin/FileCheck 
> --check-prefix=CHECK-LD-GCC /build/clang/test/Driver/linux-ld.c
>   : 'RUN: at line 130';   /build/llvm-build-GCC-release/bin/clang 
> -no-canonical-prefixes /build/clang/test/Driver/linux-ld.c -### -o 
> /build/llvm-build-GCC-release/tools/clang/test/Driver/Output/linux-ld.c.tmp.o 
> 2>&1  --target=x86_64-unknown-linux -rtlib=platform  -static-libgcc   
>--gcc-toolchain=""  
> --sysroot=/build/clang/test/Driver/Inputs/basic_linux_tree| 
> /build/llvm-build-GCC-release/bin/FileCheck 
> --check-prefix=CHECK-LD-64-STATIC-LIBGCC /build/clang/test/Driver/linux-ld.c
>   : 'RUN: at line 151';   /build/llvm-build-GCC-release/bin/clang 
> -no-canonical-prefixes /build/clang/test/Driver/linux-ld.c -### -o 
> /build/llvm-build-GCC-release/tools/clang/test/Driver/Output/linux-ld.c.tmp.o 
> 2>&1  --target=x86_64-unknown-linux -rtlib=platform  -static  
> --gcc-toolchain=""  
> --sysroot=/build/clang/test/Driver/Inputs/basic_linux_tree| 
> /build/llvm-build-GCC-release/bin/FileCheck --check-prefix=CHECK-LD-64-STATIC 
> /build/clang/test/Driver/linux-ld.c

[PATCH] D46230: For x86_64, gcc 7.2 under Amazon Linux AMI sets its paths to x86_64-amazon-linux

2018-07-19 Thread Jiading Gai via Phabricator via cfe-commits
gaijiading added a comment.

In https://reviews.llvm.org/D46230#1167023, @echristo wrote:

> In https://reviews.llvm.org/D46230#1166958, @gaijiading wrote:
>
> > In https://reviews.llvm.org/D46230#1166919, @echristo wrote:
> >
> > > LGTM.
> > >
> > > -eric
> >
> >
> > Hi Eric, I do not have commit access to trunk. Could you commit the change 
> > for me? Thanks.
>
>
> The binaries make that hard, can you email me a tarball please?


Just got the commit access from Chris. I will learn to commit the patch myself. 
Thanks a lot.


Repository:
  rC Clang

https://reviews.llvm.org/D46230



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


[PATCH] D46230: For x86_64, gcc 7.2 under Amazon Linux AMI sets its paths to x86_64-amazon-linux

2018-07-18 Thread Jiading Gai via Phabricator via cfe-commits
gaijiading added a comment.

In https://reviews.llvm.org/D46230#1167023, @echristo wrote:

> In https://reviews.llvm.org/D46230#1166958, @gaijiading wrote:
>
> > In https://reviews.llvm.org/D46230#1166919, @echristo wrote:
> >
> > > LGTM.
> > >
> > > -eric
> >
> >
> > Hi Eric, I do not have commit access to trunk. Could you commit the change 
> > for me? Thanks.
>
>
> The binaries make that hard, can you email me a tarball please?


Sure, I can do that. Please let me know what’s the email address I should send 
this to. Thanks.


Repository:
  rC Clang

https://reviews.llvm.org/D46230



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


[PATCH] D46230: For x86_64, gcc 7.2 under Amazon Linux AMI sets its paths to x86_64-amazon-linux

2018-07-18 Thread Jiading Gai via Phabricator via cfe-commits
gaijiading added a comment.

In https://reviews.llvm.org/D46230#1166919, @echristo wrote:

> LGTM.
>
> -eric


Hi Eric, I do not have commit access to trunk. Could you commit the change for 
me? Thanks.


Repository:
  rC Clang

https://reviews.llvm.org/D46230



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


[PATCH] D46230: For x86_64, gcc 7.2 under Amazon Linux AMI sets its paths to x86_64-amazon-linux

2018-07-18 Thread Jiading Gai via Phabricator via cfe-commits
gaijiading added a comment.

Thanks very much for the comments and the review.


Repository:
  rC Clang

https://reviews.llvm.org/D46230



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


[PATCH] D46230: For x86_64, gcc 7.2 under Amazon Linux AMI sets its paths to x86_64-amazon-linux

2018-07-18 Thread Jiading Gai via Phabricator via cfe-commits
gaijiading updated this revision to Diff 156117.
gaijiading added a comment.

Include the full context in the update diff.


Repository:
  rC Clang

https://reviews.llvm.org/D46230

Files:
  lib/Driver/ToolChains/Gnu.cpp
  test/Driver/Inputs/ami_linux_tree/usr/lib/gcc/x86_64-amazon-linux/7/crtbegin.o
  
test/Driver/Inputs/ami_linux_tree/usr/lib/gcc/x86_64-amazon-linux/7/crtbeginT.o
  test/Driver/Inputs/ami_linux_tree/usr/lib/gcc/x86_64-amazon-linux/7/crtend.o
  test/Driver/Inputs/ami_linux_tree/usr/lib64/crt1.o
  test/Driver/Inputs/ami_linux_tree/usr/lib64/crti.o
  test/Driver/Inputs/ami_linux_tree/usr/lib64/crtn.o
  test/Driver/linux-ld.c


Index: test/Driver/linux-ld.c
===
--- test/Driver/linux-ld.c
+++ test/Driver/linux-ld.c
@@ -1792,3 +1792,25 @@
 // CHECK-LD-RHLE7-DTS: Selected GCC installation: 
[[GCC_INSTALL:[[SYSROOT]]/lib/gcc/x86_64-redhat-linux/7]]
 // CHECK-LD-RHEL7-DTS-NOT: /usr/bin/ld
 // CHECK-LD-RHLE7-DTS: [[GCC_INSTALL]/../../../bin/ld
+
+// Check whether gcc7 install works fine on Amazon Linux AMI
+// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
+// RUN: --target=x86_64-amazon-linux -rtlib=libgcc \
+// RUN: --gcc-toolchain="" \
+// RUN: --sysroot=%S/Inputs/ami_linux_tree \
+// RUN:   | FileCheck --check-prefix=CHECK-LD-AMI %s
+// CHECK-LD-AMI-NOT: warning:
+// CHECK-LD-AMI: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
+// CHECK-LD-AMI: "--eh-frame-hdr"
+// CHECK-LD-AMI: "-m" "elf_x86_64"
+// CHECK-LD-AMI: "-dynamic-linker"
+// CHECK-LD-AMI: "{{.*}}/usr/lib/gcc/x86_64-amazon-linux/7{{/|}}crtbegin.o"
+// CHECK-LD-AMI: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-amazon-linux/7"
+// CHECK-LD-AMI: 
"-L[[SYSROOT]]/usr/lib/gcc/x86_64-amazon-linux/7/../../../../lib64"
+// CHECK-LD-AMI: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-amazon-linux/7/../../.."
+// CHECK-LD-AMI: "-L[[SYSROOT]]/lib"
+// CHECK-LD-AMI: "-L[[SYSROOT]]/usr/lib"
+// CHECK-LD-AMI: "-lgcc" "--as-needed" "-lgcc_s" "--no-as-needed"
+// CHECK-LD-AMI: "-lc"
+// CHECK-LD-AMI: "-lgcc" "--as-needed" "-lgcc_s" "--no-as-needed"
+//
Index: lib/Driver/ToolChains/Gnu.cpp
===
--- lib/Driver/ToolChains/Gnu.cpp
+++ lib/Driver/ToolChains/Gnu.cpp
@@ -1838,7 +1838,8 @@
   "x86_64-pc-linux-gnu","x86_64-redhat-linux6E",
   "x86_64-redhat-linux","x86_64-suse-linux",
   "x86_64-manbo-linux-gnu", "x86_64-linux-gnu",
-  "x86_64-slackware-linux", "x86_64-unknown-linux"};
+  "x86_64-slackware-linux", "x86_64-unknown-linux",
+  "x86_64-amazon-linux"};
   static const char *const X32LibDirs[] = {"/libx32"};
   static const char *const X86LibDirs[] = {"/lib32", "/lib"};
   static const char *const X86Triples[] = {


Index: test/Driver/linux-ld.c
===
--- test/Driver/linux-ld.c
+++ test/Driver/linux-ld.c
@@ -1792,3 +1792,25 @@
 // CHECK-LD-RHLE7-DTS: Selected GCC installation: [[GCC_INSTALL:[[SYSROOT]]/lib/gcc/x86_64-redhat-linux/7]]
 // CHECK-LD-RHEL7-DTS-NOT: /usr/bin/ld
 // CHECK-LD-RHLE7-DTS: [[GCC_INSTALL]/../../../bin/ld
+
+// Check whether gcc7 install works fine on Amazon Linux AMI
+// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
+// RUN: --target=x86_64-amazon-linux -rtlib=libgcc \
+// RUN: --gcc-toolchain="" \
+// RUN: --sysroot=%S/Inputs/ami_linux_tree \
+// RUN:   | FileCheck --check-prefix=CHECK-LD-AMI %s
+// CHECK-LD-AMI-NOT: warning:
+// CHECK-LD-AMI: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
+// CHECK-LD-AMI: "--eh-frame-hdr"
+// CHECK-LD-AMI: "-m" "elf_x86_64"
+// CHECK-LD-AMI: "-dynamic-linker"
+// CHECK-LD-AMI: "{{.*}}/usr/lib/gcc/x86_64-amazon-linux/7{{/|}}crtbegin.o"
+// CHECK-LD-AMI: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-amazon-linux/7"
+// CHECK-LD-AMI: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-amazon-linux/7/../../../../lib64"
+// CHECK-LD-AMI: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-amazon-linux/7/../../.."
+// CHECK-LD-AMI: "-L[[SYSROOT]]/lib"
+// CHECK-LD-AMI: "-L[[SYSROOT]]/usr/lib"
+// CHECK-LD-AMI: "-lgcc" "--as-needed" "-lgcc_s" "--no-as-needed"
+// CHECK-LD-AMI: "-lc"
+// CHECK-LD-AMI: "-lgcc" "--as-needed" "-lgcc_s" "--no-as-needed"
+//
Index: lib/Driver/ToolChains/Gnu.cpp
===
--- lib/Driver/ToolChains/Gnu.cpp
+++ lib/Driver/ToolChains/Gnu.cpp
@@ -1838,7 +1838,8 @@
   "x86_64-pc-linux-gnu","x86_64-redhat-linux6E",
   "x86_64-redhat-linux","x86_64-suse-linux",
   "x86_64-manbo-linux-gnu", "x86_64-linux-gnu",
-  "x86_64-slackware-linux", "x86_64-unknown-linux"};
+  "x86_64-slackware-linux", "x86_64-unknown-linux",
+  "x86_64-amazon-linux"};
   static const char *const X32LibDirs[] = {"/libx32"};
   static const char *const X86LibDirs[] = {"/lib32", "/lib"};
   static const char *const X86Triples[] = {
___
cfe-commits mailing list

[PATCH] D46230: For x86_64, gcc 7.2 under Amazon Linux AMI sets its paths to x86_64-amazon-linux

2018-07-18 Thread Jiading Gai via Phabricator via cfe-commits
gaijiading updated this revision to Diff 156018.
gaijiading removed reviewers: mcrosier, fedor.sergeev.
gaijiading added a comment.

Add a test case to cover this.


Repository:
  rC Clang

https://reviews.llvm.org/D46230

Files:
  lib/Driver/ToolChains/Gnu.cpp
  test/Driver/Inputs/ami_linux_tree/usr/lib/gcc/x86_64-amazon-linux/7/crtbegin.o
  
test/Driver/Inputs/ami_linux_tree/usr/lib/gcc/x86_64-amazon-linux/7/crtbeginT.o
  test/Driver/Inputs/ami_linux_tree/usr/lib/gcc/x86_64-amazon-linux/7/crtend.o
  test/Driver/Inputs/ami_linux_tree/usr/lib64/crt1.o
  test/Driver/Inputs/ami_linux_tree/usr/lib64/crti.o
  test/Driver/Inputs/ami_linux_tree/usr/lib64/crtn.o
  test/Driver/linux-ld.c


Index: test/Driver/linux-ld.c
===
--- test/Driver/linux-ld.c
+++ test/Driver/linux-ld.c
@@ -1792,3 +1792,25 @@
 // CHECK-LD-RHLE7-DTS: Selected GCC installation: 
[[GCC_INSTALL:[[SYSROOT]]/lib/gcc/x86_64-redhat-linux/7]]
 // CHECK-LD-RHEL7-DTS-NOT: /usr/bin/ld
 // CHECK-LD-RHLE7-DTS: [[GCC_INSTALL]/../../../bin/ld
+
+// Check whether gcc7 install works fine on Amazon Linux AMI
+// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
+// RUN: --target=x86_64-amazon-linux -rtlib=libgcc \
+// RUN: --gcc-toolchain="" \
+// RUN: --sysroot=%S/Inputs/ami_linux_tree \
+// RUN:   | FileCheck --check-prefix=CHECK-LD-AMI %s
+// CHECK-LD-AMI-NOT: warning:
+// CHECK-LD-AMI: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
+// CHECK-LD-AMI: "--eh-frame-hdr"
+// CHECK-LD-AMI: "-m" "elf_x86_64"
+// CHECK-LD-AMI: "-dynamic-linker"
+// CHECK-LD-AMI: "{{.*}}/usr/lib/gcc/x86_64-amazon-linux/7{{/|}}crtbegin.o"
+// CHECK-LD-AMI: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-amazon-linux/7"
+// CHECK-LD-AMI: 
"-L[[SYSROOT]]/usr/lib/gcc/x86_64-amazon-linux/7/../../../../lib64"
+// CHECK-LD-AMI: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-amazon-linux/7/../../.."
+// CHECK-LD-AMI: "-L[[SYSROOT]]/lib"
+// CHECK-LD-AMI: "-L[[SYSROOT]]/usr/lib"
+// CHECK-LD-AMI: "-lgcc" "--as-needed" "-lgcc_s" "--no-as-needed"
+// CHECK-LD-AMI: "-lc"
+// CHECK-LD-AMI: "-lgcc" "--as-needed" "-lgcc_s" "--no-as-needed"
+//
Index: lib/Driver/ToolChains/Gnu.cpp
===
--- lib/Driver/ToolChains/Gnu.cpp
+++ lib/Driver/ToolChains/Gnu.cpp
@@ -1838,7 +1838,8 @@
   "x86_64-pc-linux-gnu","x86_64-redhat-linux6E",
   "x86_64-redhat-linux","x86_64-suse-linux",
   "x86_64-manbo-linux-gnu", "x86_64-linux-gnu",
-  "x86_64-slackware-linux", "x86_64-unknown-linux"};
+  "x86_64-slackware-linux", "x86_64-unknown-linux",
+  "x86_64-amazon-linux"};
   static const char *const X32LibDirs[] = {"/libx32"};
   static const char *const X86LibDirs[] = {"/lib32", "/lib"};
   static const char *const X86Triples[] = {


Index: test/Driver/linux-ld.c
===
--- test/Driver/linux-ld.c
+++ test/Driver/linux-ld.c
@@ -1792,3 +1792,25 @@
 // CHECK-LD-RHLE7-DTS: Selected GCC installation: [[GCC_INSTALL:[[SYSROOT]]/lib/gcc/x86_64-redhat-linux/7]]
 // CHECK-LD-RHEL7-DTS-NOT: /usr/bin/ld
 // CHECK-LD-RHLE7-DTS: [[GCC_INSTALL]/../../../bin/ld
+
+// Check whether gcc7 install works fine on Amazon Linux AMI
+// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
+// RUN: --target=x86_64-amazon-linux -rtlib=libgcc \
+// RUN: --gcc-toolchain="" \
+// RUN: --sysroot=%S/Inputs/ami_linux_tree \
+// RUN:   | FileCheck --check-prefix=CHECK-LD-AMI %s
+// CHECK-LD-AMI-NOT: warning:
+// CHECK-LD-AMI: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
+// CHECK-LD-AMI: "--eh-frame-hdr"
+// CHECK-LD-AMI: "-m" "elf_x86_64"
+// CHECK-LD-AMI: "-dynamic-linker"
+// CHECK-LD-AMI: "{{.*}}/usr/lib/gcc/x86_64-amazon-linux/7{{/|}}crtbegin.o"
+// CHECK-LD-AMI: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-amazon-linux/7"
+// CHECK-LD-AMI: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-amazon-linux/7/../../../../lib64"
+// CHECK-LD-AMI: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-amazon-linux/7/../../.."
+// CHECK-LD-AMI: "-L[[SYSROOT]]/lib"
+// CHECK-LD-AMI: "-L[[SYSROOT]]/usr/lib"
+// CHECK-LD-AMI: "-lgcc" "--as-needed" "-lgcc_s" "--no-as-needed"
+// CHECK-LD-AMI: "-lc"
+// CHECK-LD-AMI: "-lgcc" "--as-needed" "-lgcc_s" "--no-as-needed"
+//
Index: lib/Driver/ToolChains/Gnu.cpp
===
--- lib/Driver/ToolChains/Gnu.cpp
+++ lib/Driver/ToolChains/Gnu.cpp
@@ -1838,7 +1838,8 @@
   "x86_64-pc-linux-gnu","x86_64-redhat-linux6E",
   "x86_64-redhat-linux","x86_64-suse-linux",
   "x86_64-manbo-linux-gnu", "x86_64-linux-gnu",
-  "x86_64-slackware-linux", "x86_64-unknown-linux"};
+  "x86_64-slackware-linux", "x86_64-unknown-linux",
+  "x86_64-amazon-linux"};
   static const char *const X32LibDirs[] = {"/libx32"};
   static const char *const X86LibDirs[] = {"/lib32", "/lib"};
   static const char *const X86Triples[] = {

[PATCH] D46230: For x86_64, gcc 7.2 under Amazon Linux AMI sets its paths to x86_64-amazon-linux

2018-05-22 Thread Jiading Gai via Phabricator via cfe-commits
gaijiading added a comment.

In https://reviews.llvm.org/D46230#1106086, @echristo wrote:

> Well, that's ridiculous. We should really fix this a better way in the future.
>
> That said, would you add a testcase for this please so we don't regress if we 
> fix it? :)
>
> -eric


Thanks Eric for the feedback. Sure, I will add a test case for this patch.


Repository:
  rC Clang

https://reviews.llvm.org/D46230



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


[PATCH] D46230: For x86_64, gcc 7.2 under Amazon Linux AMI sets its paths to x86_64-amazon-linux

2018-04-28 Thread Jiading Gai via Phabricator via cfe-commits
gaijiading created this revision.
gaijiading added a reviewer: rsmith.
gaijiading added a project: clang.
Herald added a subscriber: cfe-commits.

For x86_64, gcc 7.2 under Amazon Linux AMI sets its paths to x86_64-amazon-linux

gcc 7.2 under Amazon Linux AMI sets its paths to x86_64-amazon-linux. Adding 
this triple to the list of search.

The patch fixes the following bug in bugzilla:

https://bugs.llvm.org/show_bug.cgi?id=35992


Repository:
  rC Clang

https://reviews.llvm.org/D46230

Files:
  lib/Driver/ToolChains/Gnu.cpp


Index: lib/Driver/ToolChains/Gnu.cpp
===
--- lib/Driver/ToolChains/Gnu.cpp
+++ lib/Driver/ToolChains/Gnu.cpp
@@ -1839,7 +1839,8 @@
   "x86_64-pc-linux-gnu","x86_64-redhat-linux6E",
   "x86_64-redhat-linux","x86_64-suse-linux",
   "x86_64-manbo-linux-gnu", "x86_64-linux-gnu",
-  "x86_64-slackware-linux", "x86_64-unknown-linux"};
+  "x86_64-slackware-linux", "x86_64-unknown-linux",
+  "x86_64-amazon-linux"};
   static const char *const X32LibDirs[] = {"/libx32"};
   static const char *const X86LibDirs[] = {"/lib32", "/lib"};
   static const char *const X86Triples[] = {


Index: lib/Driver/ToolChains/Gnu.cpp
===
--- lib/Driver/ToolChains/Gnu.cpp
+++ lib/Driver/ToolChains/Gnu.cpp
@@ -1839,7 +1839,8 @@
   "x86_64-pc-linux-gnu","x86_64-redhat-linux6E",
   "x86_64-redhat-linux","x86_64-suse-linux",
   "x86_64-manbo-linux-gnu", "x86_64-linux-gnu",
-  "x86_64-slackware-linux", "x86_64-unknown-linux"};
+  "x86_64-slackware-linux", "x86_64-unknown-linux",
+  "x86_64-amazon-linux"};
   static const char *const X32LibDirs[] = {"/libx32"};
   static const char *const X86LibDirs[] = {"/lib32", "/lib"};
   static const char *const X86Triples[] = {
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits