1 // Check for --eh-frame-hdr being passed with static linking 2 // RUN: %clang --target=i686-pc-openbsd -static -### %s 2>&1 \ 3 // RUN: | FileCheck --check-prefix=CHECK-LD-STATIC-EH %s 4 // CHECK-LD-STATIC-EH: "-cc1" "-triple" "i686-pc-openbsd" 5 // 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" 6 7 // Check for profiling variants of libraries when linking and -nopie 8 // RUN: %clang --target=i686-pc-openbsd -pg -pthread -### %s 2>&1 \ 9 // RUN: | FileCheck --check-prefix=CHECK-PG %s 10 // CHECK-PG: "-cc1" "-triple" "i686-pc-openbsd" 11 // 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" 12 13 // Check CPU type for i386 14 // RUN: %clang --target=i386-unknown-openbsd -### -c %s 2>&1 \ 15 // RUN: | FileCheck -check-prefix=CHECK-i386-CPU %s 16 // CHECK-i386-CPU: "-target-cpu" "i586" 17 18 // Check CPU type for MIPS64 19 // RUN: %clang --target=mips64-unknown-openbsd -### -c %s 2>&1 \ 20 // RUN: | FileCheck -check-prefix=CHECK-MIPS64-CPU %s 21 // RUN: %clang --target=mips64el-unknown-openbsd -### -c %s 2>&1 \ 22 // RUN: | FileCheck -check-prefix=CHECK-MIPS64EL-CPU %s 23 // CHECK-MIPS64-CPU: "-target-cpu" "mips3" 24 // CHECK-MIPS64EL-CPU: "-target-cpu" "mips3" 25 26 // Check that the new linker flags are passed to OpenBSD 27 // RUN: %clang --target=i686-pc-openbsd -r -### %s 2>&1 \ 28 // RUN: | FileCheck --check-prefix=CHECK-LD-R %s 29 // RUN: %clang --target=i686-pc-openbsd -s -### %s 2>&1 \ 30 // RUN: | FileCheck --check-prefix=CHECK-LD-S %s 31 // RUN: %clang --target=i686-pc-openbsd -t -### %s 2>&1 \ 32 // RUN: | FileCheck --check-prefix=CHECK-LD-T %s 33 // RUN: %clang --target=i686-pc-openbsd -Z -### %s 2>&1 \ 34 // RUN: | FileCheck --check-prefix=CHECK-LD-Z %s 35 // RUN: %clang --target=mips64-unknown-openbsd -### %s 2>&1 \ 36 // RUN: | FileCheck --check-prefix=CHECK-MIPS64-LD %s 37 // RUN: %clang --target=mips64el-unknown-openbsd -### %s 2>&1 \ 38 // RUN: | FileCheck --check-prefix=CHECK-MIPS64EL-LD %s 39 // CHECK-LD-R: "-r" 40 // CHECK-LD-R-NOT: "-dynamic-linker" 41 // CHECK-LD-R-NOT: "-l 42 // CHECK-LD-R-NOT: crt{{[^./]+}}.o 43 // CHECK-LD-S: "-cc1" "-triple" "i686-pc-openbsd" 44 // 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" 45 // CHECK-LD-T: "-cc1" "-triple" "i686-pc-openbsd" 46 // 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" 47 // CHECK-LD-Z: "-cc1" "-triple" "i686-pc-openbsd" 48 // 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" 49 // CHECK-MIPS64-LD: "-cc1" "-triple" "mips64-unknown-openbsd" 50 // 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" 51 // CHECK-MIPS64EL-LD: "-cc1" "-triple" "mips64el-unknown-openbsd" 52 // 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" 53 54 // Check that --sysroot is passed to the linker 55 // RUN: %clang --target=i686-pc-openbsd -### %s 2>&1 \ 56 // RUN: --sysroot=%S/Inputs/basic_openbsd_tree \ 57 // RUN: | FileCheck --check-prefix=CHECK-LD-SYSROOT %s 58 // CHECK-LD-SYSROOT: ld{{.*}}" "--sysroot=[[SYSROOT:[^"]+]]" 59 60 // Check passing options to the assembler for various OpenBSD targets 61 // RUN: %clang --target=amd64-pc-openbsd -m32 -### -no-integrated-as -c %s 2>&1 \ 62 // RUN: | FileCheck -check-prefix=CHECK-AMD64-M32 %s 63 // RUN: %clang --target=arm-unknown-openbsd -### -no-integrated-as -c %s 2>&1 \ 64 // RUN: | FileCheck -check-prefix=CHECK-ARM %s 65 // RUN: %clang --target=powerpc-unknown-openbsd -### -no-integrated-as -c %s 2>&1 \ 66 // RUN: | FileCheck -check-prefix=CHECK-POWERPC %s 67 // RUN: %clang --target=sparc64-unknown-openbsd -### -no-integrated-as -c %s 2>&1 \ 68 // RUN: | FileCheck -check-prefix=CHECK-SPARC64 %s 69 // RUN: %clang --target=mips64-unknown-openbsd -### -no-integrated-as -c %s 2>&1 \ 70 // RUN: | FileCheck -check-prefix=CHECK-MIPS64 %s 71 // RUN: %clang --target=mips64-unknown-openbsd -fPIC -### -no-integrated-as -c %s 2>&1 \ 72 // RUN: | FileCheck -check-prefix=CHECK-MIPS64-PIC %s 73 // RUN: %clang --target=mips64el-unknown-openbsd -### -no-integrated-as -c %s 2>&1 \ 74 // RUN: | FileCheck -check-prefix=CHECK-MIPS64EL %s 75 // RUN: %clang --target=mips64el-unknown-openbsd -fPIC -### -no-integrated-as -c %s 2>&1 \ 76 // RUN: | FileCheck -check-prefix=CHECK-MIPS64EL-PIC %s 77 // CHECK-AMD64-M32: as{{.*}}" "--32" 78 // CHECK-ARM: as{{.*}}" "-mcpu=cortex-a8" 79 // CHECK-POWERPC: as{{.*}}" "-mppc" "-many" 80 // CHECK-SPARC64: as{{.*}}" "-64" "-Av9a" 81 // CHECK-MIPS64: as{{.*}}" "-march" "mips3" "-mabi" "64" "-EB" 82 // CHECK-MIPS64-PIC: as{{.*}}" "-march" "mips3" "-mabi" "64" "-EB" "-KPIC" 83 // CHECK-MIPS64EL: as{{.*}}" "-mabi" "64" "-EL" 84 // CHECK-MIPS64EL-PIC: as{{.*}}" "-mabi" "64" "-EL" "-KPIC" 85 86 // Check linking against correct startup code when (not) using PIE 87 // RUN: %clang --target=i686-pc-openbsd -### %s 2>&1 \ 88 // RUN: | FileCheck -check-prefix=CHECK-PIE %s 89 // RUN: %clang --target=i686-pc-openbsd -pie -### %s 2>&1 \ 90 // RUN: | FileCheck -check-prefix=CHECK-PIE-FLAG %s 91 // RUN: %clang --target=i686-pc-openbsd -fno-pie -### %s 2>&1 \ 92 // RUN: | FileCheck -check-prefix=CHECK-PIE %s 93 // RUN: %clang --target=i686-pc-openbsd -static -### %s 2>&1 \ 94 // RUN: | FileCheck -check-prefix=CHECK-STATIC-PIE %s 95 // RUN: %clang --target=i686-pc-openbsd -static -fno-pie -### %s 2>&1 \ 96 // RUN: | FileCheck -check-prefix=CHECK-STATIC-PIE %s 97 // RUN: %clang --target=i686-pc-openbsd -nopie -### %s 2>&1 \ 98 // RUN: | FileCheck -check-prefix=CHECK-NOPIE %s 99 // RUN: %clang --target=i686-pc-openbsd -fno-pie -nopie -### %s 2>&1 \ 100 // RUN: | FileCheck -check-prefix=CHECK-NOPIE %s 101 // RUN: %clang --target=i686-pc-openbsd -static -nopie -### %s 2>&1 \ 102 // RUN: | FileCheck -check-prefix=CHECK-NOPIE %s 103 // RUN: %clang --target=i686-pc-openbsd -fno-pie -static -nopie -### %s 2>&1 \ 104 // RUN: | FileCheck -check-prefix=CHECK-NOPIE %s 105 // CHECK-PIE: "{{.*}}crt0.o" 106 // CHECK-PIE-NOT: "-nopie" 107 // CHECK-PIE-FLAG: "-pie" 108 // CHECK-STATIC-PIE: "{{.*}}rcrt0.o" 109 // CHECK-STATIC-PIE-NOT: "-nopie" 110 // CHECK-NOPIE: "-nopie" "{{.*}}crt0.o" 111 112 // Check ARM float ABI 113 // RUN: %clang --target=arm-unknown-openbsd -### -c %s 2>&1 \ 114 // RUN: | FileCheck -check-prefix=CHECK-ARM-FLOAT-ABI %s 115 // CHECK-ARM-FLOAT-ABI-NOT: "-target-feature" "+soft-float" 116 // CHECK-ARM-FLOAT-ABI: "-target-feature" "+soft-float-abi" 117 118 // Check PowerPC for Secure PLT 119 // RUN: %clang --target=powerpc-unknown-openbsd -### -c %s 2>&1 \ 120 // RUN: | FileCheck -check-prefix=CHECK-POWERPC-SECUREPLT %s 121 // CHECK-POWERPC-SECUREPLT: "-target-feature" "+secure-plt" 122 123 // Check that unwind tables are enabled 124 // RUN: %clang --target=arm-unknown-openbsd -### -S %s 2>&1 | \ 125 // RUN: FileCheck -check-prefix=NO-UNWIND-TABLES %s 126 // RUN: %clang --target=mips64-unknown-openbsd -### -S %s 2>&1 | \ 127 // RUN: FileCheck -check-prefix=UNWIND-TABLES %s 128 // UNWIND-TABLES: "-funwind-tables=2" 129 // NO-UNWIND-TABLES-NOT: "-funwind-tables=2" 130 131 // Check that the -X flag is passed to the linker on riscv64 132 // RUN: %clang --target=riscv64-unknown-openbsd -### %s 2>&1 \ 133 // RUN: | FileCheck -check-prefix=CHECK-RISCV64-FLAGS %s 134 // CHECK-RISCV64-FLAGS: "-X" 135