1 // REQUIRES: ppc32-registered-target,ppc64-registered-target,mips-registered-target 2 // RUN: %clang -no-canonical-prefixes \ 3 // RUN: -target powerpc-pc-freebsd8 %s \ 4 // RUN: --sysroot=%S/Inputs/basic_freebsd_tree -### 2>&1 \ 5 // RUN: | FileCheck --check-prefix=CHECK-PPC %s 6 // CHECK-PPC: clang{{.*}}" "-cc1" "-triple" "powerpc-pc-freebsd8" 7 // CHECK-PPC: ld{{.*}}" "--sysroot=[[SYSROOT:[^"]+]]" 8 // CHECK-PPC: "--eh-frame-hdr" "-dynamic-linker" "{{.*}}ld-elf{{.*}}" "-o" "a.out" "{{.*}}crt1.o" "{{.*}}crti.o" "{{.*}}crtbegin.o" "-L[[SYSROOT]]/usr/lib" "{{.*}}.o" "-lgcc" "--as-needed" "-lgcc_s" "--no-as-needed" "-lc" "-lgcc" "--as-needed" "-lgcc_s" "--no-as-needed" "{{.*}}crtend.o" "{{.*}}crtn.o" 9 // 10 // RUN: %clang -no-canonical-prefixes \ 11 // RUN: -target powerpc64-pc-freebsd8 %s \ 12 // RUN: --sysroot=%S/Inputs/basic_freebsd64_tree -### 2>&1 \ 13 // RUN: | FileCheck --check-prefix=CHECK-PPC64 %s 14 // CHECK-PPC64: clang{{.*}}" "-cc1" "-triple" "powerpc64-pc-freebsd8" 15 // CHECK-PPC64: ld{{.*}}" "--sysroot=[[SYSROOT:[^"]+]]" 16 // CHECK-PPC64: "--eh-frame-hdr" "-dynamic-linker" "{{.*}}ld-elf{{.*}}" "-o" "a.out" "{{.*}}crt1.o" "{{.*}}crti.o" "{{.*}}crtbegin.o" "-L[[SYSROOT]]/usr/lib" "{{.*}}.o" "-lgcc" "--as-needed" "-lgcc_s" "--no-as-needed" "-lc" "-lgcc" "--as-needed" "-lgcc_s" "--no-as-needed" "{{.*}}crtend.o" "{{.*}}crtn.o" 17 // 18 // 19 // Check that -m32 properly adjusts the toolchain flags. 20 // 21 // RUN: %clang -no-canonical-prefixes -target x86_64-pc-freebsd8 -m32 %s \ 22 // RUN: --sysroot=%S/Inputs/multiarch_freebsd64_tree -### 2>&1 \ 23 // RUN: | FileCheck --check-prefix=CHECK-LIB32 %s 24 // CHECK-LIB32: clang{{.*}}" "-cc1" "-triple" "i386-pc-freebsd8" 25 // CHECK-LIB32: ld{{.*}}" {{.*}} "-m" "elf_i386_fbsd" 26 // 27 // RUN: %clang -target x86_64-pc-freebsd8 -m32 %s 2>&1 \ 28 // RUN: --sysroot=%S/Inputs/multiarch_freebsd64_tree -print-search-dirs 2>&1 \ 29 // RUN: | FileCheck --check-prefix=CHECK-LIB32PATHS %s 30 // CHECK-LIB32PATHS: libraries: ={{.*:?}}/usr/lib32 31 // 32 // Check that the new linker flags are passed to FreeBSD 33 // RUN: %clang -no-canonical-prefixes -target x86_64-pc-freebsd8 -m32 %s \ 34 // RUN: --sysroot=%S/Inputs/multiarch_freebsd64_tree -### 2>&1 \ 35 // RUN: | FileCheck --check-prefix=CHECK-LDFLAGS8 %s 36 // RUN: %clang -no-canonical-prefixes -target x86_64-pc-freebsd9 -m32 %s \ 37 // RUN: --sysroot=%S/Inputs/multiarch_freebsd64_tree -### 2>&1 \ 38 // RUN: | FileCheck --check-prefix=CHECK-LDFLAGS9 %s 39 // RUN: %clang -no-canonical-prefixes -target x86_64-pc-freebsd10.0 -m32 %s \ 40 // RUN: --sysroot=%S/Inputs/multiarch_freebsd64_tree -### 2>&1 \ 41 // RUN: | FileCheck --check-prefix=CHECK-LDFLAGS9 %s 42 // CHECK-LDFLAGS8-NOT: --hash-style=both 43 // CHECK-LDFLAGS8: --enable-new-dtags 44 // CHECK-LDFLAGS9: --hash-style=both 45 // CHECK-LDFLAGS9: --enable-new-dtags 46 // 47 // Check that we do not pass --hash-style=gnu and --hash-style=both to linker 48 // and provide correct path to the dynamic linker for MIPS platforms. 49 // Also verify that we tell the assembler to target the right ISA and ABI. 50 // RUN: %clang %s -### -o %t.o 2>&1 \ 51 // RUN: -target mips-unknown-freebsd10.0 \ 52 // RUN: | FileCheck --check-prefix=CHECK-MIPS %s 53 // CHECK-MIPS: "{{[^" ]*}}ld{{[^" ]*}}" 54 // CHECK-MIPS: "-dynamic-linker" "{{.*}}/libexec/ld-elf.so.1" 55 // CHECK-MIPS-NOT: "--hash-style={{gnu|both}}" 56 // RUN: %clang %s -### -o %t.o 2>&1 \ 57 // RUN: -target mipsel-unknown-freebsd10.0 \ 58 // RUN: | FileCheck --check-prefix=CHECK-MIPSEL %s 59 // CHECK-MIPSEL: "{{[^" ]*}}ld{{[^" ]*}}" 60 // CHECK-MIPSEL: "-dynamic-linker" "{{.*}}/libexec/ld-elf.so.1" 61 // CHECK-MIPSEL-NOT: "--hash-style={{gnu|both}}" 62 // RUN: %clang %s -### -o %t.o 2>&1 \ 63 // RUN: -target mips64-unknown-freebsd10.0 \ 64 // RUN: | FileCheck --check-prefix=CHECK-MIPS64 %s 65 // CHECK-MIPS64: "{{[^" ]*}}ld{{[^" ]*}}" 66 // CHECK-MIPS64: "-dynamic-linker" "{{.*}}/libexec/ld-elf.so.1" 67 // CHECK-MIPS64-NOT: "--hash-style={{gnu|both}}" 68 // RUN: %clang %s -### -o %t.o 2>&1 \ 69 // RUN: -target mips64el-unknown-freebsd10.0 \ 70 // RUN: | FileCheck --check-prefix=CHECK-MIPS64EL %s 71 // CHECK-MIPS64EL: "{{[^" ]*}}ld{{[^" ]*}}" 72 // CHECK-MIPS64EL: "-dynamic-linker" "{{.*}}/libexec/ld-elf.so.1" 73 // CHECK-MIPS64EL-NOT: "--hash-style={{gnu|both}}" 74 75 // RUN: %clang -no-canonical-prefixes -target x86_64-pc-freebsd8 -static %s \ 76 // RUN: --sysroot=%S/Inputs/multiarch_freebsd64_tree -### 2>&1 \ 77 // RUN: | FileCheck --check-prefix=CHECK-STATIC %s 78 // CHECK-STATIC: crt1.o 79 // CHECK-STATIC: crtbeginT.o 80 81 // RUN: %clang -no-canonical-prefixes -target x86_64-pc-freebsd8 -shared %s \ 82 // RUN: --sysroot=%S/Inputs/multiarch_freebsd64_tree -### 2>&1 \ 83 // RUN: | FileCheck --check-prefix=CHECK-SHARED %s 84 // CHECK-SHARED: crti.o 85 // CHECK-SHARED: crtbeginS.o 86 87 // RUN: %clang -no-canonical-prefixes -target x86_64-pc-freebsd8 -pie %s \ 88 // RUN: --sysroot=%S/Inputs/multiarch_freebsd64_tree -### 2>&1 \ 89 // RUN: | FileCheck --check-prefix=CHECK-PIE %s 90 // CHECK-PIE: pie 91 // CHECK-PIE: Scrt1.o 92 // CHECK-PIE: crtbeginS.o 93 94 // RUN: %clang -no-canonical-prefixes -target x86_64-pc-freebsd8 %s \ 95 // RUN: --sysroot=%S/Inputs/multiarch_freebsd64_tree -### 2>&1 \ 96 // RUN: | FileCheck --check-prefix=CHECK-NORMAL %s 97 // CHECK-NORMAL: crt1.o 98 // CHECK-NORMAL: crtbegin.o 99 100 // RUN: %clang %s -### -o %t.o -target arm-unknown-freebsd10.0 2>&1 \ 101 // RUN: | FileCheck --check-prefix=CHECK-ARM %s 102 // CHECK-ARM: clang{{.*}}" "-cc1"{{.*}}" "-fsjlj-exceptions" 103 // CHECK-ARM: as{{.*}}" "-mfpu=softvfp"{{.*}}"-matpcs" 104 105 // RUN: %clang %s -### -o %t.o -target arm-gnueabi-freebsd10.0 2>&1 \ 106 // RUN: | FileCheck --check-prefix=CHECK-ARM-EABI %s 107 // CHECK-ARM-EABI-NOT: clang{{.*}}" "-cc1"{{.*}}" "-fsjlj-exceptions" 108 // CHECK-ARM-EABI: as{{.*}}" "-mfpu=softvfp" "-meabi=5" 109 // CHECK-ARM-EABI-NOT: as{{.*}}" "-matpcs" 110