Home | History | Annotate | Download | only in Driver
      1 // General tests that ld invocations on Linux targets sane. Note that we use
      2 // sysroot to make these tests independent of the host system.
      3 //
      4 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
      5 // RUN:     -target i386-unknown-linux \
      6 // RUN:     --sysroot=%S/Inputs/basic_linux_tree \
      7 // RUN:   | FileCheck --check-prefix=CHECK-LD-32 %s
      8 // CHECK-LD-32: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
      9 // CHECK-LD-32: "{{.*}}/usr/lib/gcc/i386-unknown-linux/4.6.0/crtbegin.o"
     10 // CHECK-LD-32: "-L[[SYSROOT]]/usr/lib/gcc/i386-unknown-linux/4.6.0"
     11 // CHECK-LD-32: "-L[[SYSROOT]]/usr/lib/gcc/i386-unknown-linux/4.6.0/../../../../i386-unknown-linux/lib"
     12 // CHECK-LD-32: "-L[[SYSROOT]]/usr/lib/gcc/i386-unknown-linux/4.6.0/../../.."
     13 // CHECK-LD-32: "-L[[SYSROOT]]/lib"
     14 // CHECK-LD-32: "-L[[SYSROOT]]/usr/lib"
     15 //
     16 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
     17 // RUN:     -target x86_64-unknown-linux \
     18 // RUN:     --sysroot=%S/Inputs/basic_linux_tree \
     19 // RUN:   | FileCheck --check-prefix=CHECK-LD-64 %s
     20 // CHECK-LD-64: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
     21 // CHECK-LD-64: "{{.*}}/usr/lib/gcc/x86_64-unknown-linux/4.6.0/crtbegin.o"
     22 // CHECK-LD-64: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-unknown-linux/4.6.0"
     23 // CHECK-LD-64: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-unknown-linux/4.6.0/../../../../x86_64-unknown-linux/lib"
     24 // CHECK-LD-64: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-unknown-linux/4.6.0/../../.."
     25 // CHECK-LD-64: "-L[[SYSROOT]]/lib"
     26 // CHECK-LD-64: "-L[[SYSROOT]]/usr/lib"
     27 //
     28 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
     29 // RUN:     -target i386-unknown-linux -m32 \
     30 // RUN:     --sysroot=%S/Inputs/multilib_32bit_linux_tree \
     31 // RUN:   | FileCheck --check-prefix=CHECK-32-TO-32 %s
     32 // CHECK-32-TO-32: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
     33 // CHECK-32-TO-32: "{{.*}}/usr/lib/gcc/i386-unknown-linux/4.6.0/crtbegin.o"
     34 // CHECK-32-TO-32: "-L[[SYSROOT]]/usr/lib/gcc/i386-unknown-linux/4.6.0"
     35 // CHECK-32-TO-32: "-L[[SYSROOT]]/usr/lib/gcc/i386-unknown-linux/4.6.0/../../../../i386-unknown-linux/lib/../lib32"
     36 // CHECK-32-TO-32: "-L[[SYSROOT]]/usr/lib/gcc/i386-unknown-linux/4.6.0/../../../../lib32"
     37 // CHECK-32-TO-32: "-L[[SYSROOT]]/lib/../lib32"
     38 // CHECK-32-TO-32: "-L[[SYSROOT]]/usr/lib/../lib32"
     39 // CHECK-32-TO-32: "-L[[SYSROOT]]/usr/lib/gcc/i386-unknown-linux/4.6.0/../../../../i386-unknown-linux/lib"
     40 // CHECK-32-TO-32: "-L[[SYSROOT]]/usr/lib/gcc/i386-unknown-linux/4.6.0/../../.."
     41 // CHECK-32-TO-32: "-L[[SYSROOT]]/lib"
     42 // CHECK-32-TO-32: "-L[[SYSROOT]]/usr/lib"
     43 //
     44 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
     45 // RUN:     -target i386-unknown-linux -m64 \
     46 // RUN:     --sysroot=%S/Inputs/multilib_32bit_linux_tree \
     47 // RUN:   | FileCheck --check-prefix=CHECK-32-TO-64 %s
     48 // CHECK-32-TO-64: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
     49 // CHECK-32-TO-64: "{{.*}}/usr/lib/gcc/i386-unknown-linux/4.6.0/64/crtbegin.o"
     50 // CHECK-32-TO-64: "-L[[SYSROOT]]/usr/lib/gcc/i386-unknown-linux/4.6.0/64"
     51 // CHECK-32-TO-64: "-L[[SYSROOT]]/usr/lib/gcc/i386-unknown-linux/4.6.0/../../../../i386-unknown-linux/lib/../lib64"
     52 // CHECK-32-TO-64: "-L[[SYSROOT]]/usr/lib/gcc/i386-unknown-linux/4.6.0/../../../../lib64"
     53 // CHECK-32-TO-64: "-L[[SYSROOT]]/lib/../lib64"
     54 // CHECK-32-TO-64: "-L[[SYSROOT]]/usr/lib/../lib64"
     55 // CHECK-32-TO-64: "-L[[SYSROOT]]/usr/lib/gcc/i386-unknown-linux/4.6.0"
     56 // CHECK-32-TO-64: "-L[[SYSROOT]]/usr/lib/gcc/i386-unknown-linux/4.6.0/../../../../i386-unknown-linux/lib"
     57 // CHECK-32-TO-64: "-L[[SYSROOT]]/usr/lib/gcc/i386-unknown-linux/4.6.0/../../.."
     58 // CHECK-32-TO-64: "-L[[SYSROOT]]/lib"
     59 // CHECK-32-TO-64: "-L[[SYSROOT]]/usr/lib"
     60 //
     61 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
     62 // RUN:     -target x86_64-unknown-linux -m64 \
     63 // RUN:     --sysroot=%S/Inputs/multilib_64bit_linux_tree \
     64 // RUN:   | FileCheck --check-prefix=CHECK-64-TO-64 %s
     65 // CHECK-64-TO-64: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
     66 // CHECK-64-TO-64: "{{.*}}/usr/lib/gcc/x86_64-unknown-linux/4.6.0/crtbegin.o"
     67 // CHECK-64-TO-64: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-unknown-linux/4.6.0"
     68 // CHECK-64-TO-64: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-unknown-linux/4.6.0/../../../../x86_64-unknown-linux/lib/../lib64"
     69 // CHECK-64-TO-64: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-unknown-linux/4.6.0/../../../../lib64"
     70 // CHECK-64-TO-64: "-L[[SYSROOT]]/lib/../lib64"
     71 // CHECK-64-TO-64: "-L[[SYSROOT]]/usr/lib/../lib64"
     72 // CHECK-64-TO-64: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-unknown-linux/4.6.0/../../../../x86_64-unknown-linux/lib"
     73 // CHECK-64-TO-64: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-unknown-linux/4.6.0/../../.."
     74 // CHECK-64-TO-64: "-L[[SYSROOT]]/lib"
     75 // CHECK-64-TO-64: "-L[[SYSROOT]]/usr/lib"
     76 //
     77 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
     78 // RUN:     -target x86_64-unknown-linux -m32 \
     79 // RUN:     --sysroot=%S/Inputs/multilib_64bit_linux_tree \
     80 // RUN:   | FileCheck --check-prefix=CHECK-64-TO-32 %s
     81 // CHECK-64-TO-32: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
     82 // CHECK-64-TO-32: "{{.*}}/usr/lib/gcc/x86_64-unknown-linux/4.6.0/32/crtbegin.o"
     83 // CHECK-64-TO-32: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-unknown-linux/4.6.0/32"
     84 // CHECK-64-TO-32: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-unknown-linux/4.6.0/../../../../x86_64-unknown-linux/lib/../lib32"
     85 // CHECK-64-TO-32: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-unknown-linux/4.6.0/../../../../lib32"
     86 // CHECK-64-TO-32: "-L[[SYSROOT]]/lib/../lib32"
     87 // CHECK-64-TO-32: "-L[[SYSROOT]]/usr/lib/../lib32"
     88 // CHECK-64-TO-32: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-unknown-linux/4.6.0"
     89 // CHECK-64-TO-32: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-unknown-linux/4.6.0/../../../../x86_64-unknown-linux/lib"
     90 // CHECK-64-TO-32: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-unknown-linux/4.6.0/../../.."
     91 // CHECK-64-TO-32: "-L[[SYSROOT]]/lib"
     92 // CHECK-64-TO-32: "-L[[SYSROOT]]/usr/lib"
     93 //
     94 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
     95 // RUN:     -target x86_64-unknown-linux -m32 \
     96 // RUN:     -gcc-toolchain %S/Inputs/multilib_64bit_linux_tree/usr \
     97 // RUN:     --sysroot=%S/Inputs/multilib_32bit_linux_tree \
     98 // RUN:   | FileCheck --check-prefix=CHECK-64-TO-32-SYSROOT %s
     99 // CHECK-64-TO-32-SYSROOT: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
    100 // CHECK-64-TO-32-SYSROOT: "{{.*}}/usr/lib/gcc/x86_64-unknown-linux/4.6.0/32/crtbegin.o"
    101 // CHECK-64-TO-32-SYSROOT: "-L{{[^"]*}}/Inputs/multilib_64bit_linux_tree/usr/lib/gcc/x86_64-unknown-linux/4.6.0/32"
    102 // CHECK-64-TO-32-SYSROOT: "-L[[SYSROOT]]/lib/../lib32"
    103 // CHECK-64-TO-32-SYSROOT: "-L[[SYSROOT]]/usr/lib/../lib32"
    104 // CHECK-64-TO-32-SYSROOT: "-L{{[^"]*}}/Inputs/multilib_64bit_linux_tree/usr/lib/gcc/x86_64-unknown-linux/4.6.0"
    105 // CHECK-64-TO-32-SYSROOT: "-L[[SYSROOT]]/lib"
    106 // CHECK-64-TO-32-SYSROOT: "-L[[SYSROOT]]/usr/lib"
    107 //
    108 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
    109 // RUN:     -target i386-unknown-linux -m32 \
    110 // RUN:     -ccc-install-dir %S/Inputs/fake_install_tree/bin \
    111 // RUN:     --sysroot=%S/Inputs/basic_linux_tree \
    112 // RUN:   | FileCheck --check-prefix=CHECK-INSTALL-DIR-32 %s
    113 // CHECK-INSTALL-DIR-32: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
    114 // CHECK-INSTALL-DIR-32: "{{.*}}/Inputs/fake_install_tree/bin/../lib/gcc/i386-unknown-linux/4.7.0/crtbegin.o"
    115 // CHECK-INSTALL-DIR-32: "-L{{.*}}/Inputs/fake_install_tree/bin/../lib/gcc/i386-unknown-linux/4.7.0"
    116 //
    117 // Check that with 64-bit builds, we don't actually use the install directory
    118 // as its version of GCC is lower than our sysrooted version.
    119 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
    120 // RUN:     -target x86_64-unknown-linux -m64 \
    121 // RUN:     -ccc-install-dir %S/Inputs/fake_install_tree/bin \
    122 // RUN:     --sysroot=%S/Inputs/basic_linux_tree \
    123 // RUN:   | FileCheck --check-prefix=CHECK-INSTALL-DIR-64 %s
    124 // CHECK-INSTALL-DIR-64: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
    125 // CHECK-INSTALL-DIR-64: "{{.*}}/usr/lib/gcc/x86_64-unknown-linux/4.6.0/crtbegin.o"
    126 // CHECK-INSTALL-DIR-64: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-unknown-linux/4.6.0"
    127 //
    128 // Check that we support unusual patch version formats, including missing that
    129 // component.
    130 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
    131 // RUN:     -target i386-unknown-linux -m32 \
    132 // RUN:     -ccc-install-dir %S/Inputs/gcc_version_parsing1/bin \
    133 // RUN:     --sysroot=%S/Inputs/basic_linux_tree \
    134 // RUN:   | FileCheck --check-prefix=CHECK-GCC-VERSION1 %s
    135 // CHECK-GCC-VERSION1: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
    136 // CHECK-GCC-VERSION1: "{{.*}}/Inputs/gcc_version_parsing1/bin/../lib/gcc/i386-unknown-linux/4.7/crtbegin.o"
    137 // CHECK-GCC-VERSION1: "-L{{.*}}/Inputs/gcc_version_parsing1/bin/../lib/gcc/i386-unknown-linux/4.7"
    138 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
    139 // RUN:     -target i386-unknown-linux -m32 \
    140 // RUN:     -ccc-install-dir %S/Inputs/gcc_version_parsing2/bin \
    141 // RUN:     --sysroot=%S/Inputs/basic_linux_tree \
    142 // RUN:   | FileCheck --check-prefix=CHECK-GCC-VERSION2 %s
    143 // CHECK-GCC-VERSION2: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
    144 // CHECK-GCC-VERSION2: "{{.*}}/Inputs/gcc_version_parsing2/bin/../lib/gcc/i386-unknown-linux/4.7.x/crtbegin.o"
    145 // CHECK-GCC-VERSION2: "-L{{.*}}/Inputs/gcc_version_parsing2/bin/../lib/gcc/i386-unknown-linux/4.7.x"
    146 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
    147 // RUN:     -target i386-unknown-linux -m32 \
    148 // RUN:     -ccc-install-dir %S/Inputs/gcc_version_parsing3/bin \
    149 // RUN:     --sysroot=%S/Inputs/basic_linux_tree \
    150 // RUN:   | FileCheck --check-prefix=CHECK-GCC-VERSION3 %s
    151 // CHECK-GCC-VERSION3: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
    152 // CHECK-GCC-VERSION3: "{{.*}}/Inputs/gcc_version_parsing3/bin/../lib/gcc/i386-unknown-linux/4.7.99-rc5/crtbegin.o"
    153 // CHECK-GCC-VERSION3: "-L{{.*}}/Inputs/gcc_version_parsing3/bin/../lib/gcc/i386-unknown-linux/4.7.99-rc5"
    154 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
    155 // RUN:     -target i386-unknown-linux -m32 \
    156 // RUN:     -ccc-install-dir %S/Inputs/gcc_version_parsing4/bin \
    157 // RUN:     --sysroot=%S/Inputs/basic_linux_tree \
    158 // RUN:   | FileCheck --check-prefix=CHECK-GCC-VERSION4 %s
    159 // CHECK-GCC-VERSION4: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
    160 // CHECK-GCC-VERSION4: "{{.*}}/Inputs/gcc_version_parsing4/bin/../lib/gcc/i386-unknown-linux/4.7.99/crtbegin.o"
    161 // CHECK-GCC-VERSION4: "-L{{.*}}/Inputs/gcc_version_parsing4/bin/../lib/gcc/i386-unknown-linux/4.7.99"
    162 //
    163 // Test a very broken version of multiarch that shipped in Ubuntu 11.04.
    164 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
    165 // RUN:     -target i386-unknown-linux \
    166 // RUN:     --sysroot=%S/Inputs/ubuntu_11.04_multiarch_tree \
    167 // RUN:   | FileCheck --check-prefix=CHECK-UBUNTU-11-04 %s
    168 // CHECK-UBUNTU-11-04: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
    169 // CHECK-UBUNTU-11-04: "{{.*}}/usr/lib/i386-linux-gnu/gcc/i686-linux-gnu/4.5/crtbegin.o"
    170 // CHECK-UBUNTU-11-04: "-L[[SYSROOT]]/usr/lib/i386-linux-gnu/gcc/i686-linux-gnu/4.5"
    171 // CHECK-UBUNTU-11-04: "-L[[SYSROOT]]/usr/lib/i386-linux-gnu/gcc/i686-linux-gnu/4.5/../../../../i386-linux-gnu"
    172 // CHECK-UBUNTU-11-04: "-L[[SYSROOT]]/usr/lib/i386-linux-gnu"
    173 // CHECK-UBUNTU-11-04: "-L[[SYSROOT]]/usr/lib/i386-linux-gnu/gcc/i686-linux-gnu/4.5/../../../.."
    174 // CHECK-UBUNTU-11-04: "-L[[SYSROOT]]/lib"
    175 // CHECK-UBUNTU-11-04: "-L[[SYSROOT]]/usr/lib"
    176 //
    177 // Check multi arch support on Ubuntu 12.04 LTS.
    178 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
    179 // RUN:     -target arm-unknown-linux-gnueabihf \
    180 // RUN:     --sysroot=%S/Inputs/ubuntu_12.04_LTS_multiarch_tree \
    181 // RUN:   | FileCheck --check-prefix=CHECK-UBUNTU-12-04-ARM-HF %s
    182 // CHECK-UBUNTU-12-04-ARM-HF: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
    183 // CHECK-UBUNTU-12-04-ARM-HF: "{{.*}}/usr/lib/gcc/arm-linux-gnueabihf/4.6.3/../../../arm-linux-gnueabihf/crt1.o"
    184 // CHECK-UBUNTU-12-04-ARM-HF: "{{.*}}/usr/lib/gcc/arm-linux-gnueabihf/4.6.3/../../../arm-linux-gnueabihf/crti.o"
    185 // CHECK-UBUNTU-12-04-ARM-HF: "{{.*}}/usr/lib/gcc/arm-linux-gnueabihf/4.6.3/crtbegin.o"
    186 // CHECK-UBUNTU-12-04-ARM-HF: "-L[[SYSROOT]]/usr/lib/gcc/arm-linux-gnueabihf/4.6.3"
    187 // CHECK-UBUNTU-12-04-ARM-HF: "-L[[SYSROOT]]/usr/lib/gcc/arm-linux-gnueabihf/4.6.3/../../../arm-linux-gnueabihf"
    188 // CHECK-UBUNTU-12-04-ARM-HF: "-L[[SYSROOT]]/lib/arm-linux-gnueabihf"
    189 // CHECK-UBUNTU-12-04-ARM-HF: "-L[[SYSROOT]]/usr/lib/arm-linux-gnueabihf"
    190 // CHECK-UBUNTU-12-04-ARM-HF: "-L[[SYSROOT]]/usr/lib/gcc/arm-linux-gnueabihf/4.6.3/../../.."
    191 // CHECK-UBUNTU-12-04-ARM-HF: "{{.*}}/usr/lib/gcc/arm-linux-gnueabihf/4.6.3/crtend.o"
    192 // CHECK-UBUNTU-12-04-ARM-HF: "{{.*}}/usr/lib/gcc/arm-linux-gnueabihf/4.6.3/../../../arm-linux-gnueabihf/crtn.o"
    193 //
    194 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
    195 // RUN:     -target arm-unknown-linux-gnueabi \
    196 // RUN:     --sysroot=%S/Inputs/ubuntu_12.04_LTS_multiarch_tree \
    197 // RUN:   | FileCheck --check-prefix=CHECK-UBUNTU-12-04-ARM %s
    198 // CHECK-UBUNTU-12-04-ARM: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
    199 // CHECK-UBUNTU-12-04-ARM: "{{.*}}/usr/lib/gcc/arm-linux-gnueabi/4.6.1/../../../arm-linux-gnueabi/crt1.o"
    200 // CHECK-UBUNTU-12-04-ARM: "{{.*}}/usr/lib/gcc/arm-linux-gnueabi/4.6.1/../../../arm-linux-gnueabi/crti.o"
    201 // CHECK-UBUNTU-12-04-ARM: "{{.*}}/usr/lib/gcc/arm-linux-gnueabi/4.6.1/crtbegin.o"
    202 // CHECK-UBUNTU-12-04-ARM: "-L[[SYSROOT]]/usr/lib/gcc/arm-linux-gnueabi/4.6.1"
    203 // CHECK-UBUNTU-12-04-ARM: "-L[[SYSROOT]]/usr/lib/gcc/arm-linux-gnueabi/4.6.1/../../../arm-linux-gnueabi"
    204 // CHECK-UBUNTU-12-04-ARM: "-L[[SYSROOT]]/lib/arm-linux-gnueabi"
    205 // CHECK-UBUNTU-12-04-ARM: "-L[[SYSROOT]]/usr/lib/arm-linux-gnueabi"
    206 // CHECK-UBUNTU-12-04-ARM: "-L[[SYSROOT]]/usr/lib/gcc/arm-linux-gnueabi/4.6.1/../../.."
    207 // CHECK-UBUNTU-12-04-ARM: "{{.*}}/usr/lib/gcc/arm-linux-gnueabi/4.6.1/crtend.o"
    208 // CHECK-UBUNTU-12-04-ARM: "{{.*}}/usr/lib/gcc/arm-linux-gnueabi/4.6.1/../../../arm-linux-gnueabi/crtn.o"
    209 //
    210 // Test the setup that shipped in SUSE 10.3 on ppc64.
    211 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
    212 // RUN:     -target powerpc64-suse-linux \
    213 // RUN:     --sysroot=%S/Inputs/suse_10.3_ppc64_tree \
    214 // RUN:   | FileCheck --check-prefix=CHECK-SUSE-10-3-PPC64 %s
    215 // CHECK-SUSE-10-3-PPC64: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
    216 // CHECK-SUSE-10-3-PPC64: "{{.*}}/usr/lib/gcc/powerpc64-suse-linux/4.1.2/64/crtbegin.o"
    217 // CHECK-SUSE-10-3-PPC64: "-L[[SYSROOT]]/usr/lib/gcc/powerpc64-suse-linux/4.1.2/64"
    218 // CHECK-SUSE-10-3-PPC64: "-L[[SYSROOT]]/usr/lib/gcc/powerpc64-suse-linux/4.1.2/../../../../lib64"
    219 // CHECK-SUSE-10-3-PPC64: "-L[[SYSROOT]]/lib/../lib64"
    220 // CHECK-SUSE-10-3-PPC64: "-L[[SYSROOT]]/usr/lib/../lib64"
    221 //
    222 // Check dynamic-linker for different archs
    223 // RUN: %clang %s -### -o %t.o 2>&1 \
    224 // RUN:     -target arm-linux-gnueabi \
    225 // RUN:   | FileCheck --check-prefix=CHECK-ARM %s
    226 // CHECK-ARM: "{{.*}}ld{{(.exe)?}}"
    227 // CHECK-ARM: "-m" "armelf_linux_eabi"
    228 // CHECK-ARM: "-dynamic-linker" "{{.*}}/lib/ld-linux.so.3"
    229 //
    230 // RUN: %clang %s -### -o %t.o 2>&1 \
    231 // RUN:     -target arm-linux-gnueabihf \
    232 // RUN:   | FileCheck --check-prefix=CHECK-ARM-HF %s
    233 // CHECK-ARM-HF: "{{.*}}ld{{(.exe)?}}"
    234 // CHECK-ARM-HF: "-m" "armelf_linux_eabi"
    235 // CHECK-ARM-HF: "-dynamic-linker" "{{.*}}/lib/ld-linux-armhf.so.3"
    236 //
    237 // Check that we do not pass --hash-style=gnu and --hash-style=both to linker
    238 // and provide correct path to the dynamic linker and emulation mode when build
    239 // for MIPS platforms.
    240 // RUN: %clang %s -### -o %t.o 2>&1 \
    241 // RUN:     -target mips-linux-gnu -ccc-clang-archs mips \
    242 // RUN:   | FileCheck --check-prefix=CHECK-MIPS %s
    243 // CHECK-MIPS: "{{.*}}ld{{(.exe)?}}"
    244 // CHECK-MIPS: "-m" "elf32btsmip"
    245 // CHECK-MIPS: "-dynamic-linker" "{{.*}}/lib/ld.so.1"
    246 // CHECK-MIPS-NOT: "--hash-style={{gnu|both}}"
    247 // RUN: %clang %s -### -o %t.o 2>&1 \
    248 // RUN:     -target mipsel-linux-gnu -ccc-clang-archs mipsel \
    249 // RUN:   | FileCheck --check-prefix=CHECK-MIPSEL %s
    250 // CHECK-MIPSEL: "{{.*}}ld{{(.exe)?}}"
    251 // CHECK-MIPSEL: "-m" "elf32ltsmip"
    252 // CHECK-MIPSEL: "-dynamic-linker" "{{.*}}/lib/ld.so.1"
    253 // CHECK-MIPSEL-NOT: "--hash-style={{gnu|both}}"
    254 // RUN: %clang %s -### -o %t.o 2>&1 \
    255 // RUN:     -target mips64-linux-gnu -ccc-clang-archs mips64 \
    256 // RUN:   | FileCheck --check-prefix=CHECK-MIPS64 %s
    257 // CHECK-MIPS64: "{{.*}}ld{{(.exe)?}}"
    258 // CHECK-MIPS64: "-m" "elf64btsmip"
    259 // CHECK-MIPS64: "-dynamic-linker" "{{.*}}/lib64/ld.so.1"
    260 // CHECK-MIPS64-NOT: "--hash-style={{gnu|both}}"
    261 // RUN: %clang %s -### -o %t.o 2>&1 \
    262 // RUN:     -target mips64el-linux-gnu -ccc-clang-archs mips64el \
    263 // RUN:   | FileCheck --check-prefix=CHECK-MIPS64EL %s
    264 // CHECK-MIPS64EL: "{{.*}}ld{{(.exe)?}}"
    265 // CHECK-MIPS64EL: "-m" "elf64ltsmip"
    266 // CHECK-MIPS64EL: "-dynamic-linker" "{{.*}}/lib64/ld.so.1"
    267 // CHECK-MIPS64EL-NOT: "--hash-style={{gnu|both}}"
    268 //
    269 // Thoroughly exercise the Debian multiarch environment.
    270 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
    271 // RUN:     -target i686-linux-gnu \
    272 // RUN:     --sysroot=%S/Inputs/debian_multiarch_tree \
    273 // RUN:   | FileCheck --check-prefix=CHECK-DEBIAN-X86 %s
    274 // CHECK-DEBIAN-X86: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
    275 // CHECK-DEBIAN-X86: "{{.*}}/usr/lib/gcc/i686-linux-gnu/4.5/crtbegin.o"
    276 // CHECK-DEBIAN-X86: "-L[[SYSROOT]]/usr/lib/gcc/i686-linux-gnu/4.5"
    277 // CHECK-DEBIAN-X86: "-L[[SYSROOT]]/usr/lib/gcc/i686-linux-gnu/4.5/../../../i386-linux-gnu"
    278 // CHECK-DEBIAN-X86: "-L[[SYSROOT]]/usr/lib/i386-linux-gnu"
    279 // CHECK-DEBIAN-X86: "-L[[SYSROOT]]/usr/lib/gcc/i686-linux-gnu/4.5/../../.."
    280 // CHECK-DEBIAN-X86: "-L[[SYSROOT]]/lib"
    281 // CHECK-DEBIAN-X86: "-L[[SYSROOT]]/usr/lib"
    282 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
    283 // RUN:     -target x86_64-linux-gnu \
    284 // RUN:     --sysroot=%S/Inputs/debian_multiarch_tree \
    285 // RUN:   | FileCheck --check-prefix=CHECK-DEBIAN-X86-64 %s
    286 // CHECK-DEBIAN-X86-64: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
    287 // CHECK-DEBIAN-X86-64: "{{.*}}/usr/lib/gcc/x86_64-linux-gnu/4.5/crtbegin.o"
    288 // CHECK-DEBIAN-X86-64: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-linux-gnu/4.5"
    289 // CHECK-DEBIAN-X86-64: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-linux-gnu/4.5/../../../x86_64-linux-gnu"
    290 // CHECK-DEBIAN-X86-64: "-L[[SYSROOT]]/usr/lib/x86_64-linux-gnu"
    291 // CHECK-DEBIAN-X86-64: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-linux-gnu/4.5/../../.."
    292 // CHECK-DEBIAN-X86-64: "-L[[SYSROOT]]/lib"
    293 // CHECK-DEBIAN-X86-64: "-L[[SYSROOT]]/usr/lib"
    294 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
    295 // RUN:     -target powerpc-linux-gnu \
    296 // RUN:     --sysroot=%S/Inputs/debian_multiarch_tree \
    297 // RUN:   | FileCheck --check-prefix=CHECK-DEBIAN-PPC %s
    298 // CHECK-DEBIAN-PPC: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
    299 // CHECK-DEBIAN-PPC: "{{.*}}/usr/lib/gcc/powerpc-linux-gnu/4.5/crtbegin.o"
    300 // CHECK-DEBIAN-PPC: "-L[[SYSROOT]]/usr/lib/gcc/powerpc-linux-gnu/4.5"
    301 // CHECK-DEBIAN-PPC: "-L[[SYSROOT]]/usr/lib/gcc/powerpc-linux-gnu/4.5/../../../powerpc-linux-gnu"
    302 // CHECK-DEBIAN-PPC: "-L[[SYSROOT]]/usr/lib/powerpc-linux-gnu"
    303 // CHECK-DEBIAN-PPC: "-L[[SYSROOT]]/usr/lib/gcc/powerpc-linux-gnu/4.5/../../.."
    304 // CHECK-DEBIAN-PPC: "-L[[SYSROOT]]/lib"
    305 // CHECK-DEBIAN-PPC: "-L[[SYSROOT]]/usr/lib"
    306 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
    307 // RUN:     -target powerpc64-linux-gnu \
    308 // RUN:     --sysroot=%S/Inputs/debian_multiarch_tree \
    309 // RUN:   | FileCheck --check-prefix=CHECK-DEBIAN-PPC64 %s
    310 // CHECK-DEBIAN-PPC64: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
    311 // CHECK-DEBIAN-PPC64: "{{.*}}/usr/lib/gcc/powerpc64-linux-gnu/4.5/crtbegin.o"
    312 // CHECK-DEBIAN-PPC64: "-L[[SYSROOT]]/usr/lib/gcc/powerpc64-linux-gnu/4.5"
    313 // CHECK-DEBIAN-PPC64: "-L[[SYSROOT]]/usr/lib/gcc/powerpc64-linux-gnu/4.5/../../../powerpc64-linux-gnu"
    314 // CHECK-DEBIAN-PPC64: "-L[[SYSROOT]]/usr/lib/powerpc64-linux-gnu"
    315 // CHECK-DEBIAN-PPC64: "-L[[SYSROOT]]/usr/lib/gcc/powerpc64-linux-gnu/4.5/../../.."
    316 // CHECK-DEBIAN-PPC64: "-L[[SYSROOT]]/lib"
    317 // CHECK-DEBIAN-PPC64: "-L[[SYSROOT]]/usr/lib"
    318 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
    319 // RUN:     -target mips-linux-gnu \
    320 // RUN:     --sysroot=%S/Inputs/debian_multiarch_tree \
    321 // RUN:   | FileCheck --check-prefix=CHECK-DEBIAN-MIPS %s
    322 // CHECK-DEBIAN-MIPS: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
    323 // CHECK-DEBIAN-MIPS: "{{.*}}/usr/lib/gcc/mips-linux-gnu/4.5/crtbegin.o"
    324 // CHECK-DEBIAN-MIPS: "-L[[SYSROOT]]/usr/lib/gcc/mips-linux-gnu/4.5"
    325 // CHECK-DEBIAN-MIPS: "-L[[SYSROOT]]/usr/lib/gcc/mips-linux-gnu/4.5/../../../mips-linux-gnu"
    326 // CHECK-DEBIAN-MIPS: "-L[[SYSROOT]]/usr/lib/mips-linux-gnu"
    327 // CHECK-DEBIAN-MIPS: "-L[[SYSROOT]]/usr/lib/gcc/mips-linux-gnu/4.5/../../.."
    328 // CHECK-DEBIAN-MIPS: "-L[[SYSROOT]]/lib"
    329 // CHECK-DEBIAN-MIPS: "-L[[SYSROOT]]/usr/lib"
    330 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
    331 // RUN:     -target mipsel-linux-gnu \
    332 // RUN:     --sysroot=%S/Inputs/debian_multiarch_tree \
    333 // RUN:   | FileCheck --check-prefix=CHECK-DEBIAN-MIPSEL %s
    334 // CHECK-DEBIAN-MIPSEL: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
    335 // CHECK-DEBIAN-MIPSEL: "{{.*}}/usr/lib/gcc/mipsel-linux-gnu/4.5/crtbegin.o"
    336 // CHECK-DEBIAN-MIPSEL: "-L[[SYSROOT]]/usr/lib/gcc/mipsel-linux-gnu/4.5"
    337 // CHECK-DEBIAN-MIPSEL: "-L[[SYSROOT]]/usr/lib/gcc/mipsel-linux-gnu/4.5/../../../mipsel-linux-gnu"
    338 // CHECK-DEBIAN-MIPSEL: "-L[[SYSROOT]]/usr/lib/mipsel-linux-gnu"
    339 // CHECK-DEBIAN-MIPSEL: "-L[[SYSROOT]]/usr/lib/gcc/mipsel-linux-gnu/4.5/../../.."
    340 // CHECK-DEBIAN-MIPSEL: "-L[[SYSROOT]]/lib"
    341 // CHECK-DEBIAN-MIPSEL: "-L[[SYSROOT]]/usr/lib"
    342 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
    343 // RUN:     -target mips64-linux-gnu \
    344 // RUN:     --sysroot=%S/Inputs/debian_multiarch_tree \
    345 // RUN:   | FileCheck --check-prefix=CHECK-DEBIAN-MIPS64 %s
    346 // CHECK-DEBIAN-MIPS64: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
    347 // CHECK-DEBIAN-MIPS64: "{{.*}}/usr/lib/gcc/mips-linux-gnu/4.5/64/crtbegin.o"
    348 // CHECK-DEBIAN-MIPS64: "-L[[SYSROOT]]/usr/lib/gcc/mips-linux-gnu/4.5/64"
    349 // CHECK-DEBIAN-MIPS64: "-L[[SYSROOT]]/usr/lib/gcc/mips-linux-gnu/4.5"
    350 // CHECK-DEBIAN-MIPS64: "-L[[SYSROOT]]/usr/lib/gcc/mips-linux-gnu/4.5/../../.."
    351 // CHECK-DEBIAN-MIPS64: "-L[[SYSROOT]]/lib"
    352 // CHECK-DEBIAN-MIPS64: "-L[[SYSROOT]]/usr/lib"
    353 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
    354 // RUN:     -target mips64el-linux-gnu \
    355 // RUN:     --sysroot=%S/Inputs/debian_multiarch_tree \
    356 // RUN:   | FileCheck --check-prefix=CHECK-DEBIAN-MIPS64EL %s
    357 // CHECK-DEBIAN-MIPS64EL: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
    358 // CHECK-DEBIAN-MIPS64EL: "{{.*}}/usr/lib/gcc/mipsel-linux-gnu/4.5/64/crtbegin.o"
    359 // CHECK-DEBIAN-MIPS64EL: "-L[[SYSROOT]]/usr/lib/gcc/mipsel-linux-gnu/4.5/64"
    360 // CHECK-DEBIAN-MIPS64EL: "-L[[SYSROOT]]/usr/lib/gcc/mipsel-linux-gnu/4.5"
    361 // CHECK-DEBIAN-MIPS64EL: "-L[[SYSROOT]]/usr/lib/gcc/mipsel-linux-gnu/4.5/../../.."
    362 // CHECK-DEBIAN-MIPS64EL: "-L[[SYSROOT]]/lib"
    363 // CHECK-DEBIAN-MIPS64EL: "-L[[SYSROOT]]/usr/lib"
    364 //
    365 // Test linker invocation on Android.
    366 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
    367 // RUN:     -target arm-linux-androideabi \
    368 // RUN:     --sysroot=%S/Inputs/basic_android_tree/sysroot \
    369 // RUN:   | FileCheck --check-prefix=CHECK-ANDROID %s
    370 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
    371 // RUN:     -target arm-linux-android \
    372 // RUN:     --sysroot=%S/Inputs/basic_android_tree/sysroot \
    373 // RUN:   | FileCheck --check-prefix=CHECK-ANDROID %s
    374 // CHECK-ANDROID: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
    375 // CHECK-ANDROID: "{{.*}}/crtbegin_dynamic.o"
    376 // CHECK-ANDROID: "-L[[SYSROOT]]/usr/lib"
    377 // CHECK-ANDROID-NOT: "gcc_s"
    378 // CHECK-ANDROID: "-lgcc"
    379 // CHECK-ANDROID-NOT: "gcc_s"
    380 // CHECK-ANDROID: "{{.*}}/crtend_android.o"
    381 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
    382 // RUN:     -target arm-linux-androideabi \
    383 // RUN:     --sysroot=%S/Inputs/basic_android_tree/sysroot \
    384 // RUN:     -shared \
    385 // RUN:   | FileCheck --check-prefix=CHECK-ANDROID-SO %s
    386 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
    387 // RUN:     -target arm-linux-android \
    388 // RUN:     --sysroot=%S/Inputs/basic_android_tree/sysroot \
    389 // RUN:     -shared \
    390 // RUN:   | FileCheck --check-prefix=CHECK-ANDROID-SO %s
    391 // CHECK-ANDROID-SO: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
    392 // CHECK-ANDROID-SO: "{{.*}}/crtbegin_so.o"
    393 // CHECK-ANDROID-SO: "-L[[SYSROOT]]/usr/lib"
    394 // CHECK-ANDROID-SO-NOT: "gcc_s"
    395 // CHECK-ANDROID-SO: "-lgcc"
    396 // CHECK-ANDROID-SO-NOT: "gcc_s"
    397 // CHECK-ANDROID-SO: "{{.*}}/crtend_so.o"
    398 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
    399 // RUN:     -target arm-linux-androideabi \
    400 // RUN:     --sysroot=%S/Inputs/basic_android_tree/sysroot \
    401 // RUN:     -static \
    402 // RUN:   | FileCheck --check-prefix=CHECK-ANDROID-STATIC %s
    403 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
    404 // RUN:     -target arm-linux-android \
    405 // RUN:     --sysroot=%S/Inputs/basic_android_tree/sysroot \
    406 // RUN:     -static \
    407 // RUN:   | FileCheck --check-prefix=CHECK-ANDROID-STATIC %s
    408 // CHECK-ANDROID-STATIC: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
    409 // CHECK-ANDROID-STATIC: "{{.*}}/crtbegin_static.o"
    410 // CHECK-ANDROID-STATIC: "-L[[SYSROOT]]/usr/lib"
    411 // CHECK-ANDROID-STATIC-NOT: "gcc_s"
    412 // CHECK-ANDROID-STATIC: "-lgcc"
    413 // CHECK-ANDROID-STATIC-NOT: "gcc_s"
    414 // CHECK-ANDROID-STATIC: "{{.*}}/crtend_android.o"
    415 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
    416 // RUN:     -target arm-linux-androideabi \
    417 // RUN:     --sysroot=%S/Inputs/basic_android_tree/sysroot  \
    418 // RUN:     -pie \
    419 // RUN:   | FileCheck --check-prefix=CHECK-ANDROID-PIE %s
    420 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
    421 // RUN:     -target arm-linux-android \
    422 // RUN:     --sysroot=%S/Inputs/basic_android_tree/sysroot \
    423 // RUN:     -pie \
    424 // RUN:   | FileCheck --check-prefix=CHECK-ANDROID-PIE %s
    425 // CHECK-ANDROID-PIE: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
    426 // CHECK-ANDROID-PIE: "{{.*}}/crtbegin_dynamic.o"
    427 // CHECK-ANDROID-PIE: "-L[[SYSROOT]]/usr/lib"
    428 // CHECK-ANDROID-PIE-NOT: "gcc_s"
    429 // CHECK-ANDROID-PIE: "-lgcc"
    430 // CHECK-ANDROID-PIE-NOT: "gcc_s"
    431 // CHECK-ANDROID-PIE: "{{.*}}/crtend_android.o"
    432