For x86_64, gcc 7.2 under Amazon Linux AMI sets its path 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, plus a test case to cover this.

The patch fixes the following bug reported in bugzilla:

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

Reviewers: echristo

Differential Revision: https://reviews.llvm.org/D46230

llvm-svn: 337811
This commit is contained in:
Jiading Gai 2018-07-24 06:07:22 +00:00
parent 52854504cc
commit 4a2879bd5a
8 changed files with 24 additions and 1 deletions

View File

@ -1834,7 +1834,8 @@ void Generic_GCC::GCCInstallationDetector::AddDefaultGCCPrefixes(
"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[] = {

View File

@ -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"
//