| 1 | // RUN: %clang -no-canonical-prefixes -target i686-pc-openbsd %s -### 2>&1 \ |
| 2 | // RUN: | FileCheck --check-prefix=CHECK-LD %s |
| 3 | // CHECK-LD: clang{{.*}}" "-cc1" "-triple" "i686-pc-openbsd" |
| 4 | // CHECK-LD: ld{{.*}}" "-e" "__start" "--eh-frame-hdr" "-Bdynamic" "-dynamic-linker" "{{.*}}ld.so" "-o" "a.out" "{{.*}}crt0.o" "{{.*}}crtbegin.o" "{{.*}}.o" "-lcompiler_rt" "-lc" "-lcompiler_rt" "{{.*}}crtend.o" |
| 5 | |
| 6 | // Check for --eh-frame-hdr being passed with static linking |
| 7 | // RUN: %clang -no-canonical-prefixes -target i686-pc-openbsd -static %s -### 2>&1 \ |
| 8 | // RUN: | FileCheck --check-prefix=CHECK-LD-STATIC-EH %s |
| 9 | // CHECK-LD-STATIC-EH: clang{{.*}}" "-cc1" "-triple" "i686-pc-openbsd" |
| 10 | // CHECK-LD-STATIC-EH: ld{{.*}}" "-e" "__start" "--eh-frame-hdr" "-Bstatic" "-o" "a.out" "{{.*}}rcrt0.o" "{{.*}}crtbegin.o" "{{.*}}.o" "-lcompiler_rt" "-lc" "-lcompiler_rt" "{{.*}}crtend.o" |
| 11 | |
| 12 | // RUN: %clang -no-canonical-prefixes -target i686-pc-openbsd -pg -pthread %s -### 2>&1 \ |
| 13 | // RUN: | FileCheck --check-prefix=CHECK-PG %s |
| 14 | // CHECK-PG: clang{{.*}}" "-cc1" "-triple" "i686-pc-openbsd" |
| 15 | // CHECK-PG: ld{{.*}}" "-e" "__start" "--eh-frame-hdr" "-Bdynamic" "-dynamic-linker" "{{.*}}ld.so" "-nopie" "-o" "a.out" "{{.*}}gcrt0.o" "{{.*}}crtbegin.o" "{{.*}}.o" "-lcompiler_rt" "-lpthread_p" "-lc_p" "-lcompiler_rt" "{{.*}}crtend.o" |
| 16 | |
| 17 | // Check CPU type for MIPS64 |
| 18 | // RUN: %clang -target mips64-unknown-openbsd -### -c %s 2>&1 \ |
| 19 | // RUN: | FileCheck -check-prefix=CHECK-MIPS64-CPU %s |
| 20 | // RUN: %clang -target mips64el-unknown-openbsd -### -c %s 2>&1 \ |
| 21 | // RUN: | FileCheck -check-prefix=CHECK-MIPS64EL-CPU %s |
| 22 | // CHECK-MIPS64-CPU: "-target-cpu" "mips3" |
| 23 | // CHECK-MIPS64EL-CPU: "-target-cpu" "mips3" |
| 24 | |
| 25 | // Check that the new linker flags are passed to OpenBSD |
| 26 | // RUN: %clang -no-canonical-prefixes -target i686-pc-openbsd -r %s -### 2>&1 \ |
| 27 | // RUN: | FileCheck --check-prefix=CHECK-LD-R %s |
| 28 | // RUN: %clang -no-canonical-prefixes -target i686-pc-openbsd -s %s -### 2>&1 \ |
| 29 | // RUN: | FileCheck --check-prefix=CHECK-LD-S %s |
| 30 | // RUN: %clang -no-canonical-prefixes -target i686-pc-openbsd -t %s -### 2>&1 \ |
| 31 | // RUN: | FileCheck --check-prefix=CHECK-LD-T %s |
| 32 | // RUN: %clang -no-canonical-prefixes -target i686-pc-openbsd -Z %s -### 2>&1 \ |
| 33 | // RUN: | FileCheck --check-prefix=CHECK-LD-Z %s |
| 34 | // RUN: %clang -no-canonical-prefixes -target mips64-unknown-openbsd %s -### 2>&1 \ |
| 35 | // RUN: | FileCheck --check-prefix=CHECK-MIPS64-LD %s |
| 36 | // RUN: %clang -no-canonical-prefixes -target mips64el-unknown-openbsd %s -### 2>&1 \ |
| 37 | // RUN: | FileCheck --check-prefix=CHECK-MIPS64EL-LD %s |
| 38 | // CHECK-LD-R: clang{{.*}}" "-cc1" "-triple" "i686-pc-openbsd" |
| 39 | // CHECK-LD-R: ld{{.*}}" "-e" "__start" "--eh-frame-hdr" "-Bdynamic" "-dynamic-linker" "{{.*}}ld.so" "-o" "a.out" "{{.*}}crt0.o" "{{.*}}crtbegin.o" "-L{{.*}}" "-r" "{{.*}}.o" "-lcompiler_rt" "-lc" "-lcompiler_rt" "{{.*}}crtend.o" |
| 40 | // CHECK-LD-S: clang{{.*}}" "-cc1" "-triple" "i686-pc-openbsd" |
| 41 | // CHECK-LD-S: ld{{.*}}" "-e" "__start" "--eh-frame-hdr" "-Bdynamic" "-dynamic-linker" "{{.*}}ld.so" "-o" "a.out" "{{.*}}crt0.o" "{{.*}}crtbegin.o" "-L{{.*}}" "-s" "{{.*}}.o" "-lcompiler_rt" "-lc" "-lcompiler_rt" "{{.*}}crtend.o" |
| 42 | // CHECK-LD-T: clang{{.*}}" "-cc1" "-triple" "i686-pc-openbsd" |
| 43 | // CHECK-LD-T: ld{{.*}}" "-e" "__start" "--eh-frame-hdr" "-Bdynamic" "-dynamic-linker" "{{.*}}ld.so" "-o" "a.out" "{{.*}}crt0.o" "{{.*}}crtbegin.o" "-L{{.*}}" "-t" "{{.*}}.o" "-lcompiler_rt" "-lc" "-lcompiler_rt" "{{.*}}crtend.o" |
| 44 | // CHECK-LD-Z: clang{{.*}}" "-cc1" "-triple" "i686-pc-openbsd" |
| 45 | // CHECK-LD-Z: ld{{.*}}" "-e" "__start" "--eh-frame-hdr" "-Bdynamic" "-dynamic-linker" "{{.*}}ld.so" "-o" "a.out" "{{.*}}crt0.o" "{{.*}}crtbegin.o" "-L{{.*}}" "-Z" "{{.*}}.o" "-lcompiler_rt" "-lc" "-lcompiler_rt" "{{.*}}crtend.o" |
| 46 | // CHECK-MIPS64-LD: clang{{.*}}" "-cc1" "-triple" "mips64-unknown-openbsd" |
| 47 | // CHECK-MIPS64-LD: ld{{.*}}" "-EB" "-e" "__start" "--eh-frame-hdr" "-Bdynamic" "-dynamic-linker" "{{.*}}ld.so" "-o" "a.out" "{{.*}}crt0.o" "{{.*}}crtbegin.o" "-L{{.*}}" "{{.*}}.o" "-lcompiler_rt" "-lc" "-lcompiler_rt" "{{.*}}crtend.o" |
| 48 | // CHECK-MIPS64EL-LD: clang{{.*}}" "-cc1" "-triple" "mips64el-unknown-openbsd" |
| 49 | // CHECK-MIPS64EL-LD: ld{{.*}}" "-EL" "-e" "__start" "--eh-frame-hdr" "-Bdynamic" "-dynamic-linker" "{{.*}}ld.so" "-o" "a.out" "{{.*}}crt0.o" "{{.*}}crtbegin.o" "-L{{.*}}" "{{.*}}.o" "-lcompiler_rt" "-lc" "-lcompiler_rt" "{{.*}}crtend.o" |
| 50 | |
| 51 | // Check passing options to the assembler for various OpenBSD targets |
| 52 | // RUN: %clang -target amd64-pc-openbsd -m32 -### -no-integrated-as -c %s 2>&1 \ |
| 53 | // RUN: | FileCheck -check-prefix=CHECK-AMD64-M32 %s |
| 54 | // RUN: %clang -target powerpc-unknown-openbsd -### -no-integrated-as -c %s 2>&1 \ |
| 55 | // RUN: | FileCheck -check-prefix=CHECK-POWERPC %s |
| 56 | // RUN: %clang -target sparc-unknown-openbsd -### -no-integrated-as -c %s 2>&1 \ |
| 57 | // RUN: | FileCheck -check-prefix=CHECK-SPARC %s |
| 58 | // RUN: %clang -target sparc64-unknown-openbsd -### -no-integrated-as -c %s 2>&1 \ |
| 59 | // RUN: | FileCheck -check-prefix=CHECK-SPARC64 %s |
| 60 | // RUN: %clang -target mips64-unknown-openbsd -### -no-integrated-as -c %s 2>&1 \ |
| 61 | // RUN: | FileCheck -check-prefix=CHECK-MIPS64 %s |
| 62 | // RUN: %clang -target mips64-unknown-openbsd -fPIC -### -no-integrated-as -c %s 2>&1 \ |
| 63 | // RUN: | FileCheck -check-prefix=CHECK-MIPS64-PIC %s |
| 64 | // RUN: %clang -target mips64el-unknown-openbsd -### -no-integrated-as -c %s 2>&1 \ |
| 65 | // RUN: | FileCheck -check-prefix=CHECK-MIPS64EL %s |
| 66 | // RUN: %clang -target mips64el-unknown-openbsd -fPIC -### -no-integrated-as -c %s 2>&1 \ |
| 67 | // RUN: | FileCheck -check-prefix=CHECK-MIPS64EL-PIC %s |
| 68 | // CHECK-AMD64-M32: as{{.*}}" "--32" |
| 69 | // CHECK-POWERPC: as{{.*}}" "-mppc" "-many" |
| 70 | // CHECK-SPARC: as{{.*}}" "-32" "-Av8" |
| 71 | // CHECK-SPARC64: as{{.*}}" "-64" "-Av9" |
| 72 | // CHECK-MIPS64: as{{.*}}" "-mabi" "64" "-EB" |
| 73 | // CHECK-MIPS64-PIC: as{{.*}}" "-mabi" "64" "-EB" "-KPIC" |
| 74 | // CHECK-MIPS64EL: as{{.*}}" "-mabi" "64" "-EL" |
| 75 | // CHECK-MIPS64EL-PIC: as{{.*}}" "-mabi" "64" "-EL" "-KPIC" |
| 76 | |
| 77 | // Check that the integrated assembler is enabled for MIPS64/SPARC |
| 78 | // RUN: %clang -target mips64-unknown-openbsd -### -c %s 2>&1 \ |
| 79 | // RUN: | FileCheck -check-prefix=CHECK-IAS %s |
| 80 | // RUN: %clang -target mips64el-unknown-openbsd -### -c %s 2>&1 \ |
| 81 | // RUN: | FileCheck -check-prefix=CHECK-IAS %s |
| 82 | // RUN: %clang -target sparc-unknown-openbsd -### -c %s 2>&1 \ |
| 83 | // RUN: | FileCheck -check-prefix=CHECK-IAS %s |
| 84 | // RUN: %clang -target sparc64-unknown-openbsd -### -c %s 2>&1 \ |
| 85 | // RUN: | FileCheck -check-prefix=CHECK-IAS %s |
| 86 | // CHECK-IAS-NOT: "-no-integrated-as" |
| 87 | |
| 88 | // Check linking against correct startup code when (not) using PIE |
| 89 | // RUN: %clang -no-canonical-prefixes -target i686-pc-openbsd %s -### 2>&1 \ |
| 90 | // RUN: | FileCheck -check-prefix=CHECK-PIE %s |
| 91 | // RUN: %clang -no-canonical-prefixes -target i686-pc-openbsd -pie %s -### 2>&1 \ |
| 92 | // RUN: | FileCheck -check-prefix=CHECK-PIE-FLAG %s |
| 93 | // RUN: %clang -no-canonical-prefixes -target i686-pc-openbsd -fno-pie %s -### 2>&1 \ |
| 94 | // RUN: | FileCheck -check-prefix=CHECK-PIE %s |
| 95 | // RUN: %clang -no-canonical-prefixes -target i686-pc-openbsd -static %s -### 2>&1 \ |
| 96 | // RUN: | FileCheck -check-prefix=CHECK-STATIC-PIE %s |
| 97 | // RUN: %clang -no-canonical-prefixes -target i686-pc-openbsd -static -fno-pie %s -### 2>&1 \ |
| 98 | // RUN: | FileCheck -check-prefix=CHECK-STATIC-PIE %s |
| 99 | // RUN: %clang -no-canonical-prefixes -target i686-pc-openbsd -nopie %s -### 2>&1 \ |
| 100 | // RUN: | FileCheck -check-prefix=CHECK-NOPIE %s |
| 101 | // RUN: %clang -no-canonical-prefixes -target i686-pc-openbsd -fno-pie -nopie %s -### 2>&1 \ |
| 102 | // RUN: | FileCheck -check-prefix=CHECK-NOPIE %s |
| 103 | // RUN: %clang -no-canonical-prefixes -target i686-pc-openbsd -static -nopie %s -### 2>&1 \ |
| 104 | // RUN: | FileCheck -check-prefix=CHECK-NOPIE %s |
| 105 | // RUN: %clang -no-canonical-prefixes -target i686-pc-openbsd -fno-pie -static -nopie %s -### 2>&1 \ |
| 106 | // RUN: | FileCheck -check-prefix=CHECK-NOPIE %s |
| 107 | // CHECK-PIE: "{{.*}}crt0.o" |
| 108 | // CHECK-PIE-NOT: "-nopie" |
| 109 | // CHECK-PIE-FLAG: "-pie" |
| 110 | // CHECK-STATIC-PIE: "{{.*}}rcrt0.o" |
| 111 | // CHECK-STATIC-PIE-NOT: "-nopie" |
| 112 | // CHECK-NOPIE: "-nopie" "{{.*}}crt0.o" |
| 113 | |
| 114 | // Check ARM float ABI |
| 115 | // RUN: %clang -target arm-unknown-openbsd -### -c %s 2>&1 \ |
| 116 | // RUN: | FileCheck -check-prefix=CHECK-ARM-FLOAT-ABI %s |
| 117 | // CHECK-ARM-FLOAT-ABI-NOT: "-target-feature" "+soft-float" |
| 118 | // CHECK-ARM-FLOAT-ABI: "-target-feature" "+soft-float-abi" |
| 119 | |
| 120 | // Check PowerPC for Secure PLT |
| 121 | // RUN: %clang -target powerpc-unknown-openbsd -### -c %s 2>&1 \ |
| 122 | // RUN: | FileCheck -check-prefix=CHECK-POWERPC-SECUREPLT %s |
| 123 | // CHECK-POWERPC-SECUREPLT: "-target-feature" "+secure-plt" |
| 124 | |