1 // General tests that ld invocations on Solaris targets sane. Note that we use 2 // sysroot to make these tests independent of the host system. 3 4 // Check sparc-sun-solaris2.11, 32bit 5 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \ 6 // RUN: --target=sparc-sun-solaris2.11 \ 7 // RUN: --gcc-toolchain="" \ 8 // RUN: --sysroot=%S/Inputs/solaris_sparc_tree \ 9 // RUN: | FileCheck --check-prefix=CHECK-LD-SPARC32 %s 10 // CHECK-LD-SPARC32-NOT: warning: 11 // CHECK-LD-SPARC32: {{.*}}clang{{(.exe)?}}" "-cc1" "-triple" "sparc-sun-solaris2.11" 12 // CHECK-LD-SPARC32-SAME: "-isysroot" "[[SYSROOT:[^"]+]]" 13 // CHECK-LD-SPARC32: "{{.*}}ld{{(.exe)?}}" 14 // CHECK-LD-SPARC32-SAME: "[[SYSROOT]]/usr/gcc/4.8/lib/gcc/sparc-sun-solaris2.11/4.8.2{{/|\\\\}}crt1.o" 15 // CHECK-LD-SPARC32-SAME: "[[SYSROOT]]/usr/lib{{/|\\\\}}crti.o" 16 // CHECK-LD-SPARC32-SAME: "[[SYSROOT]]/usr/gcc/4.8/lib/gcc/sparc-sun-solaris2.11/4.8.2{{/|\\\\}}crtbegin.o" 17 // CHECK-LD-SPARC32-SAME: "-L[[SYSROOT]]/usr/gcc/4.8/lib/gcc/sparc-sun-solaris2.11/4.8.2" 18 // CHECK-LD-SPARC32-SAME: "-L[[SYSROOT]]/usr/gcc/4.8/lib/gcc/sparc-sun-solaris2.11/4.8.2/../../.." 19 // CHECK-LD-SPARC32-SAME: "-L[[SYSROOT]]/usr/lib" 20 // CHECK-LD-SPARC32-SAME: "-lgcc_s" 21 // CHECK-LD-SPARC32-SAME: "-lc" 22 // CHECK-LD-SPARC32-SAME: "-lgcc" 23 // CHECK-LD-SPARC32-SAME: "-lm" 24 // CHECK-LD-SPARC32-SAME: "[[SYSROOT]]/usr/gcc/4.8/lib/gcc/sparc-sun-solaris2.11/4.8.2{{/|\\\\}}crtend.o" 25 // CHECK-LD-SPARC32-SAME: "[[SYSROOT]]/usr/lib{{/|\\\\}}crtn.o" 26 27 // Check sparc-sun-solaris2.11, 64bit 28 // RUN: %clang -no-canonical-prefixes -m64 %s -### -o %t.o 2>&1 \ 29 // RUN: --target=sparc-sun-solaris2.11 \ 30 // RUN: --gcc-toolchain="" \ 31 // RUN: --sysroot=%S/Inputs/solaris_sparc_tree \ 32 // RUN: | FileCheck --check-prefix=CHECK-LD-SPARC64 %s 33 // CHECK-LD-SPARC64-NOT: warning: 34 // CHECK-LD-SPARC64: {{.*}}clang{{(.exe)?}}" "-cc1" "-triple" "sparcv9-sun-solaris2.11" 35 // CHECK-LD-SPARC64-SAME: "-isysroot" "[[SYSROOT:[^"]+]]" 36 // CHECK-LD-SPARC64: "{{.*}}ld{{(.exe)?}}" 37 // CHECK-LD-SPARC64-SAME: "[[SYSROOT]]/usr/gcc/4.8/lib/gcc/sparc-sun-solaris2.11/4.8.2/sparcv9{{/|\\\\}}crt1.o" 38 // CHECK-LD-SPARC64-SAME: "[[SYSROOT]]/usr/lib/sparcv9{{/|\\\\}}crti.o" 39 // CHECK-LD-SPARC64-SAME: "[[SYSROOT]]/usr/gcc/4.8/lib/gcc/sparc-sun-solaris2.11/4.8.2/sparcv9{{/|\\\\}}crtbegin.o" 40 // CHECK-LD-SPARC64-SAME: "-L[[SYSROOT]]/usr/gcc/4.8/lib/gcc/sparc-sun-solaris2.11/4.8.2/sparcv9" 41 // CHECK-LD-SPARC64-SAME: "-L[[SYSROOT]]/usr/gcc/4.8/lib/gcc/sparc-sun-solaris2.11/4.8.2/../../../sparcv9" 42 // CHECK-LD-SPARC64-SAME: "-L[[SYSROOT]]/usr/lib/sparcv9" 43 // CHECK-LD-SPARC64-SAME: "-lgcc_s" 44 // CHECK-LD-SPARC64-SAME: "-lc" 45 // CHECK-LD-SPARC64-SAME: "-lgcc" 46 // CHECK-LD-SPARC64-SAME: "-lm" 47 // CHECK-LD-SPARC64-SAME: "[[SYSROOT]]/usr/gcc/4.8/lib/gcc/sparc-sun-solaris2.11/4.8.2/sparcv9{{/|\\\\}}crtend.o" 48 // CHECK-LD-SPARC64-SAME: "[[SYSROOT]]/usr/lib/sparcv9{{/|\\\\}}crtn.o" 49 50 // Check i386-pc-solaris2.11, 32bit 51 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \ 52 // RUN: --target=i386-pc-solaris2.11 \ 53 // RUN: --gcc-toolchain="" \ 54 // RUN: --sysroot=%S/Inputs/solaris_x86_tree \ 55 // RUN: | FileCheck --check-prefix=CHECK-LD-X32 %s 56 // CHECK-LD-X32-NOT: warning: 57 // CHECK-LD-X32: {{.*}}clang{{(.exe)?}}" "-cc1" "-triple" "i386-pc-solaris2.11" 58 // CHECK-LD-X32-SAME: "-isysroot" "[[SYSROOT:[^"]+]]" 59 // CHECK-LD-X32: "{{.*}}ld{{(.exe)?}}" 60 // CHECK-LD-X32-SAME: "[[SYSROOT]]/usr/lib{{/|\\\\}}crt1.o" 61 // CHECK-LD-X32-SAME: "[[SYSROOT]]/usr/lib{{/|\\\\}}crti.o" 62 // CHECK-LD-X32-SAME: "[[SYSROOT]]/usr/gcc/4.9/lib/gcc/i386-pc-solaris2.11/4.9.4{{/|\\\\}}crtbegin.o" 63 // CHECK-LD-X32-SAME: "-L[[SYSROOT]]/usr/gcc/4.9/lib/gcc/i386-pc-solaris2.11/4.9.4" 64 // CHECK-LD-X32-SAME: "-L[[SYSROOT]]/usr/gcc/4.9/lib/gcc/i386-pc-solaris2.11/4.9.4/../../.." 65 // CHECK-LD-X32-SAME: "-L[[SYSROOT]]/usr/lib" 66 // CHECK-LD-X32-SAME: "-lgcc_s" 67 // CHECK-LD-X32-SAME: "-lc" 68 // CHECK-LD-X32-SAME: "-lgcc" 69 // CHECK-LD-X32-SAME: "-lm" 70 // CHECK-LD-X32-SAME: "[[SYSROOT]]/usr/gcc/4.9/lib/gcc/i386-pc-solaris2.11/4.9.4{{/|\\\\}}crtend.o" 71 // CHECK-LD-X32-SAME: "[[SYSROOT]]/usr/lib{{/|\\\\}}crtn.o" 72 73 // Check i386-pc-solaris2.11, 64bit 74 // RUN: %clang -no-canonical-prefixes -m64 %s -### -o %t.o 2>&1 \ 75 // RUN: --target=i386-pc-solaris2.11 \ 76 // RUN: --gcc-toolchain="" \ 77 // RUN: --sysroot=%S/Inputs/solaris_x86_tree \ 78 // RUN: | FileCheck --check-prefix=CHECK-LD-X64 %s 79 // CHECK-LD-X64-NOT: warning: 80 // CHECK-LD-X64: {{.*}}clang{{(.exe)?}}" "-cc1" "-triple" "x86_64-pc-solaris2.11" 81 // CHECK-LD-X64-SAME: "-isysroot" "[[SYSROOT:[^"]+]]" 82 // CHECK-LD-X64: "{{.*}}ld{{(.exe)?}}" 83 // CHECK-LD-X64-SAME: "[[SYSROOT]]/usr/lib/amd64{{/|\\\\}}crt1.o" 84 // CHECK-LD-X64-SAME: "[[SYSROOT]]/usr/lib/amd64{{/|\\\\}}crti.o" 85 // CHECK-LD-X64-SAME: "[[SYSROOT]]/usr/gcc/4.9/lib/gcc/i386-pc-solaris2.11/4.9.4/amd64{{/|\\\\}}crtbegin.o" 86 // CHECK-LD-X64-SAME: "-L[[SYSROOT]]/usr/gcc/4.9/lib/gcc/i386-pc-solaris2.11/4.9.4/amd64" 87 // CHECK-LD-X64-SAME: "-L[[SYSROOT]]/usr/gcc/4.9/lib/gcc/i386-pc-solaris2.11/4.9.4/../../../amd64" 88 // CHECK-LD-X64-SAME: "-L[[SYSROOT]]/usr/lib/amd64" 89 // CHECK-LD-X64-SAME: "-lgcc_s" 90 // CHECK-LD-X64-SAME: "-lc" 91 // CHECK-LD-X64-SAME: "-lgcc" 92 // CHECK-LD-X64-SAME: "-lm" 93 // CHECK-LD-X64-SAME: "[[SYSROOT]]/usr/gcc/4.9/lib/gcc/i386-pc-solaris2.11/4.9.4/amd64{{/|\\\\}}crtend.o" 94 // CHECK-LD-X64-SAME: "[[SYSROOT]]/usr/lib/amd64{{/|\\\\}}crtn.o" 95 96 // Check the right -l flags are present with -shared 97 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o -shared 2>&1 \ 98 // RUN: --target=sparc-sun-solaris2.11 \ 99 // RUN: --gcc-toolchain="" \ 100 // RUN: --sysroot=%S/Inputs/solaris_sparc_tree \ 101 // RUN: | FileCheck --check-prefix=CHECK-SPARC32-SHARED %s 102 // CHECK-SPARC32-SHARED: "{{.*}}ld{{(.exe)?}}" 103 // CHECK-SPARC32-SHARED-SAME: "-lgcc_s" 104 // CHECK-SPARC32-SHARED-SAME: "-lc" 105 // CHECK-SPARC32-SHARED-NOT: "-lgcc" 106 // CHECK-SPARC32-SHARED-NOT: "-lm" 107