Home | History | Annotate | Download | only in Driver
      1 // RUN: %clang -no-canonical-prefixes \
      2 // RUN:   -target aarch64-pc-freebsd11 %s                              \
      3 // RUN:   --sysroot=%S/Inputs/basic_freebsd64_tree -### 2>&1 \
      4 // RUN:   | FileCheck --check-prefix=CHECK-ARM64 %s
      5 // CHECK-ARM64: "-cc1" "-triple" "aarch64-pc-freebsd11"
      6 // CHECK-ARM64: ld{{.*}}" "--sysroot=[[SYSROOT:[^"]+]]"
      7 // CHECK-ARM64: "--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"
      8 //
      9 // RUN: %clang -no-canonical-prefixes \
     10 // RUN:   -target powerpc-pc-freebsd8 %s    \
     11 // RUN:   --sysroot=%S/Inputs/basic_freebsd_tree -### 2>&1 \
     12 // RUN:   | FileCheck --check-prefix=CHECK-PPC %s
     13 // CHECK-PPC: "-cc1" "-triple" "powerpc-pc-freebsd8"
     14 // CHECK-PPC: ld{{.*}}" "--sysroot=[[SYSROOT:[^"]+]]"
     15 // 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"
     16 //
     17 // RUN: %clang -no-canonical-prefixes \
     18 // RUN:   -target powerpc64-pc-freebsd8 %s                              \
     19 // RUN:   --sysroot=%S/Inputs/basic_freebsd64_tree -### 2>&1 \
     20 // RUN:   | FileCheck --check-prefix=CHECK-PPC64 %s
     21 // CHECK-PPC64: "-cc1" "-triple" "powerpc64-pc-freebsd8"
     22 // CHECK-PPC64: ld{{.*}}" "--sysroot=[[SYSROOT:[^"]+]]"
     23 // 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"
     24 //
     25 //
     26 // Check that -m32 properly adjusts the toolchain flags.
     27 //
     28 // RUN: %clang -no-canonical-prefixes -target x86_64-pc-freebsd8 -m32 %s \
     29 // RUN:   --sysroot=%S/Inputs/multiarch_freebsd64_tree -### 2>&1 \
     30 // RUN:   | FileCheck --check-prefix=CHECK-LIB32 %s
     31 // CHECK-LIB32: "-cc1" "-triple" "i386-pc-freebsd8"
     32 // CHECK-LIB32: ld{{.*}}" {{.*}} "-m" "elf_i386_fbsd"
     33 //
     34 // RUN: %clang -target x86_64-pc-freebsd8 -m32 %s 2>&1 \
     35 // RUN:   --sysroot=%S/Inputs/multiarch_freebsd64_tree -print-search-dirs 2>&1 \
     36 // RUN:   | FileCheck --check-prefix=CHECK-LIB32PATHS %s
     37 // CHECK-LIB32PATHS: libraries: ={{.*:?}}/usr/lib32
     38 //
     39 // Check that the new linker flags are passed to FreeBSD
     40 // RUN: %clang -no-canonical-prefixes -target x86_64-pc-freebsd8 -m32 %s \
     41 // RUN:   --sysroot=%S/Inputs/multiarch_freebsd64_tree -### 2>&1 \
     42 // RUN:   | FileCheck --check-prefix=CHECK-LDFLAGS8 %s
     43 // RUN: %clang -no-canonical-prefixes -target x86_64-pc-freebsd9 -m32 %s \
     44 // RUN:   --sysroot=%S/Inputs/multiarch_freebsd64_tree -### 2>&1 \
     45 // RUN:   | FileCheck --check-prefix=CHECK-LDFLAGS9 %s
     46 // RUN: %clang -no-canonical-prefixes -target x86_64-pc-freebsd10.0 -m32 %s \
     47 // RUN:   --sysroot=%S/Inputs/multiarch_freebsd64_tree -### 2>&1 \
     48 // RUN:   | FileCheck --check-prefix=CHECK-LDFLAGS9 %s
     49 // CHECK-LDFLAGS8-NOT: --hash-style=both
     50 // CHECK-LDFLAGS8: --enable-new-dtags
     51 // CHECK-LDFLAGS9: --hash-style=both
     52 // CHECK-LDFLAGS9: --enable-new-dtags
     53 //
     54 // Check that we do not pass --hash-style=gnu and --hash-style=both to linker
     55 // and provide correct path to the dynamic linker for MIPS platforms.
     56 // Also verify that we tell the assembler to target the right ISA and ABI.
     57 // RUN: %clang %s -### -o %t.o 2>&1 \
     58 // RUN:     -target mips-unknown-freebsd10.0 \
     59 // RUN:   | FileCheck --check-prefix=CHECK-MIPS %s
     60 // CHECK-MIPS: "{{[^" ]*}}ld{{[^" ]*}}"
     61 // CHECK-MIPS: "-dynamic-linker" "{{.*}}/libexec/ld-elf.so.1"
     62 // CHECK-MIPS-NOT: "--hash-style={{gnu|both}}"
     63 // RUN: %clang %s -### -o %t.o 2>&1 \
     64 // RUN:     -target mipsel-unknown-freebsd10.0 \
     65 // RUN:   | FileCheck --check-prefix=CHECK-MIPSEL %s
     66 // CHECK-MIPSEL: "{{[^" ]*}}ld{{[^" ]*}}"
     67 // CHECK-MIPSEL: "-dynamic-linker" "{{.*}}/libexec/ld-elf.so.1"
     68 // CHECK-MIPSEL-NOT: "--hash-style={{gnu|both}}"
     69 // RUN: %clang %s -### 2>&1 \
     70 // RUN:     -target mips64-unknown-freebsd10.0 \
     71 // RUN:   | FileCheck --check-prefix=CHECK-MIPS64 %s
     72 // CHECK-MIPS64: "{{[^" ]*}}ld{{[^" ]*}}"
     73 // CHECK-MIPS64: "-dynamic-linker" "{{.*}}/libexec/ld-elf.so.1"
     74 // CHECK-MIPS64-NOT: "--hash-style={{gnu|both}}"
     75 // RUN: %clang %s -### 2>&1 \
     76 // RUN:     -target mips64el-unknown-freebsd10.0 \
     77 // RUN:   | FileCheck --check-prefix=CHECK-MIPS64EL %s
     78 // CHECK-MIPS64EL: "{{[^" ]*}}ld{{[^" ]*}}"
     79 // CHECK-MIPS64EL: "-dynamic-linker" "{{.*}}/libexec/ld-elf.so.1"
     80 // CHECK-MIPS64EL-NOT: "--hash-style={{gnu|both}}"
     81 
     82 // RUN: %clang -no-canonical-prefixes -target x86_64-pc-freebsd8 -static %s \
     83 // RUN:   --sysroot=%S/Inputs/multiarch_freebsd64_tree -### 2>&1 \
     84 // RUN:   | FileCheck --check-prefix=CHECK-STATIC %s
     85 // CHECK-STATIC: ld{{.*}}" "--eh-frame-hdr" "-Bstatic"
     86 // CHECK-STATIC: crt1.o
     87 // CHECK-STATIC: crtbeginT.o
     88 
     89 // RUN: %clang -no-canonical-prefixes -target x86_64-pc-freebsd8 -shared %s \
     90 // RUN:   --sysroot=%S/Inputs/multiarch_freebsd64_tree -### 2>&1 \
     91 // RUN:   | FileCheck --check-prefix=CHECK-SHARED %s
     92 // CHECK-SHARED: crti.o
     93 // CHECK-SHARED: crtbeginS.o
     94 
     95 // RUN: %clang -no-canonical-prefixes -target x86_64-pc-freebsd8 -pie %s \
     96 // RUN:   --sysroot=%S/Inputs/multiarch_freebsd64_tree -### 2>&1 \
     97 // RUN:   | FileCheck --check-prefix=CHECK-PIE %s
     98 // CHECK-PIE: pie
     99 // CHECK-PIE: Scrt1.o
    100 // CHECK-PIE: crtbeginS.o
    101 
    102 // RUN: %clang -no-canonical-prefixes -target x86_64-pc-freebsd8 %s \
    103 // RUN:   --sysroot=%S/Inputs/multiarch_freebsd64_tree -### 2>&1 \
    104 // RUN:   | FileCheck --check-prefix=CHECK-NORMAL %s
    105 // CHECK-NORMAL: crt1.o
    106 // CHECK-NORMAL: crtbegin.o
    107 
    108 // RUN: %clang %s -### -target arm-unknown-freebsd10.0 -no-integrated-as 2>&1 \
    109 // RUN:   | FileCheck --check-prefix=CHECK-ARM %s
    110 // CHECK-ARM: "-cc1"{{.*}}" "-fsjlj-exceptions"
    111 // CHECK-ARM: as{{.*}}" "-mfpu=softvfp"{{.*}}"-matpcs"
    112 // CHECK-ARM-EABI-NOT: as{{.*}}" "-mfpu=vfp"
    113 
    114 // RUN: %clang %s -### -target arm-gnueabi-freebsd10.0 -no-integrated-as 2>&1 \
    115 // RUN:   | FileCheck --check-prefix=CHECK-ARM-EABI %s
    116 // CHECK-ARM-EABI-NOT: "-cc1"{{.*}}" "-fsjlj-exceptions"
    117 // CHECK-ARM-EABI: as{{.*}}" "-mfpu=softvfp" "-meabi=5"
    118 // CHECK-ARM-EABI-NOT: as{{.*}}" "-mfpu=vfp"
    119 // CHECK-ARM-EABI-NOT: as{{.*}}" "-matpcs"
    120 
    121 // RUN: %clang %s -### -target arm-gnueabihf-freebsd10.0 -no-integrated-as 2>&1 \
    122 // RUN:   | FileCheck --check-prefix=CHECK-ARM-EABIHF %s
    123 // CHECK-ARM-EABIHF-NOT: "-cc1"{{.*}}" "-fsjlj-exceptions"
    124 // CHECK-ARM-EABIHF: as{{.*}}" "-mfpu=vfp" "-meabi=5"
    125 // CHECK-ARM-EABIHF-NOT: as{{.*}}" "-mfpu=softvfp"
    126 // CHECK-ARM-EABIHF-NOT: as{{.*}}" "-matpcs"
    127 
    128 // RUN: %clang -target x86_64-pc-freebsd8 %s -### -flto 2>&1 \
    129 // RUN:   | FileCheck --check-prefix=CHECK-LTO %s
    130 // CHECK-LTO: ld{{.*}}" "-plugin{{.*}}LLVMgold.so
    131 
    132 // RUN: %clang -target sparc-unknown-freebsd8 %s -### -fpic -no-integrated-as 2>&1 \
    133 // RUN:   | FileCheck --check-prefix=CHECK-SPARC-PIE %s
    134 // CHECK-SPARC-PIE: as{{.*}}" "-KPIC
    135 
    136 // RUN: %clang -mcpu=ultrasparc -target sparc64-unknown-freebsd8 %s -### -no-integrated-as 2>&1 \
    137 // RUN:   | FileCheck --check-prefix=CHECK-SPARC-CPU %s
    138 // CHECK-SPARC-CPU: cc1{{.*}}" "-target-cpu" "ultrasparc"
    139 // CHECK-SPARC-CPU: as{{.*}}" "-Av9
    140 
    141 // Check that -G flags are passed to the linker for mips
    142 // RUN: %clang -target mips-unknown-freebsd %s -### -G0 2>&1 \
    143 // RUN:   | FileCheck --check-prefix=CHECK-MIPS-G %s
    144 // CHECK-MIPS-G: ld{{.*}}" "-G0"
    145