• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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: crt1.o
86 // CHECK-STATIC: crtbeginT.o
87 
88 // RUN: %clang -no-canonical-prefixes -target x86_64-pc-freebsd8 -shared %s \
89 // RUN:   --sysroot=%S/Inputs/multiarch_freebsd64_tree -### 2>&1 \
90 // RUN:   | FileCheck --check-prefix=CHECK-SHARED %s
91 // CHECK-SHARED: crti.o
92 // CHECK-SHARED: crtbeginS.o
93 
94 // RUN: %clang -no-canonical-prefixes -target x86_64-pc-freebsd8 -pie %s \
95 // RUN:   --sysroot=%S/Inputs/multiarch_freebsd64_tree -### 2>&1 \
96 // RUN:   | FileCheck --check-prefix=CHECK-PIE %s
97 // CHECK-PIE: pie
98 // CHECK-PIE: Scrt1.o
99 // CHECK-PIE: crtbeginS.o
100 
101 // RUN: %clang -no-canonical-prefixes -target x86_64-pc-freebsd8 %s \
102 // RUN:   --sysroot=%S/Inputs/multiarch_freebsd64_tree -### 2>&1 \
103 // RUN:   | FileCheck --check-prefix=CHECK-NORMAL %s
104 // CHECK-NORMAL: crt1.o
105 // CHECK-NORMAL: crtbegin.o
106 
107 // RUN: %clang %s -### -target arm-unknown-freebsd10.0 -no-integrated-as 2>&1 \
108 // RUN:   | FileCheck --check-prefix=CHECK-ARM %s
109 // CHECK-ARM: "-cc1"{{.*}}" "-fsjlj-exceptions"
110 // CHECK-ARM: as{{.*}}" "-mfpu=softvfp"{{.*}}"-matpcs"
111 // CHECK-ARM-EABI-NOT: as{{.*}}" "-mfpu=vfp"
112 
113 // RUN: %clang %s -### -target arm-gnueabi-freebsd10.0 -no-integrated-as 2>&1 \
114 // RUN:   | FileCheck --check-prefix=CHECK-ARM-EABI %s
115 // CHECK-ARM-EABI-NOT: "-cc1"{{.*}}" "-fsjlj-exceptions"
116 // CHECK-ARM-EABI: as{{.*}}" "-mfpu=softvfp" "-meabi=5"
117 // CHECK-ARM-EABI-NOT: as{{.*}}" "-mfpu=vfp"
118 // CHECK-ARM-EABI-NOT: as{{.*}}" "-matpcs"
119 
120 // RUN: %clang %s -### -target arm-gnueabihf-freebsd10.0 -no-integrated-as 2>&1 \
121 // RUN:   | FileCheck --check-prefix=CHECK-ARM-EABIHF %s
122 // CHECK-ARM-EABIHF-NOT: "-cc1"{{.*}}" "-fsjlj-exceptions"
123 // CHECK-ARM-EABIHF: as{{.*}}" "-mfpu=vfp" "-meabi=5"
124 // CHECK-ARM-EABIHF-NOT: as{{.*}}" "-mfpu=softvfp"
125 // CHECK-ARM-EABIHF-NOT: as{{.*}}" "-matpcs"
126 
127 // RUN: %clang -target x86_64-pc-freebsd8 %s -### -flto 2>&1 \
128 // RUN:   | FileCheck --check-prefix=CHECK-LTO %s
129 // CHECK-LTO: ld{{.*}}" "-plugin{{.*}}LLVMgold.so
130 
131 // RUN: %clang -target sparc-unknown-freebsd8 %s -### -fpic -no-integrated-as 2>&1 \
132 // RUN:   | FileCheck --check-prefix=CHECK-SPARC-PIE %s
133 // CHECK-SPARC-PIE: as{{.*}}" "-KPIC
134 
135 // RUN: %clang -mcpu=ultrasparc -target sparc64-unknown-freebsd8 %s -### -no-integrated-as 2>&1 \
136 // RUN:   | FileCheck --check-prefix=CHECK-SPARC-CPU %s
137 // CHECK-SPARC-CPU: cc1{{.*}}" "-target-cpu" "ultrasparc"
138 // CHECK-SPARC-CPU: as{{.*}}" "-Av9
139