xref: /llvm-project/clang/test/Driver/haiku.c (revision f5991161529511ca6ebc058da2a0507c2fc5283e)
1c184f27fSBrad Smith // UNSUPPORTED: system-windows
2c184f27fSBrad Smith 
3a3ba9d69SBrad Smith // Check the C header paths
4a3ba9d69SBrad Smith // RUN: %clang --target=x86_64-unknown-haiku -### %s 2>&1 \
5a3ba9d69SBrad Smith // RUN:   | FileCheck --check-prefix=CHECK-C-HEADER-PATH %s
6a3ba9d69SBrad Smith // CHECK-C-HEADER-PATH: "-internal-isystem" "/boot/system/non-packaged/develop/headers"
7a3ba9d69SBrad Smith // CHECK-C-HEADER-PATH: "-internal-isystem" "/boot/system/develop/headers/os"
8a3ba9d69SBrad Smith // CHECK-C-HEADER-PATH: "-internal-isystem" "/boot/system/develop/headers/os/app"
9a3ba9d69SBrad Smith // CHECK-C-HEADER-PATH: "-internal-isystem" "/boot/system/develop/headers/os/device"
10a3ba9d69SBrad Smith // CHECK-C-HEADER-PATH: "-internal-isystem" "/boot/system/develop/headers/os/drivers"
11a3ba9d69SBrad Smith // CHECK-C-HEADER-PATH: "-internal-isystem" "/boot/system/develop/headers/os/game"
12a3ba9d69SBrad Smith // CHECK-C-HEADER-PATH: "-internal-isystem" "/boot/system/develop/headers/os/interface"
13a3ba9d69SBrad Smith // CHECK-C-HEADER-PATH: "-internal-isystem" "/boot/system/develop/headers/os/kernel"
14a3ba9d69SBrad Smith // CHECK-C-HEADER-PATH: "-internal-isystem" "/boot/system/develop/headers/os/locale"
15a3ba9d69SBrad Smith // CHECK-C-HEADER-PATH: "-internal-isystem" "/boot/system/develop/headers/os/mail"
16a3ba9d69SBrad Smith // CHECK-C-HEADER-PATH: "-internal-isystem" "/boot/system/develop/headers/os/media"
17a3ba9d69SBrad Smith // CHECK-C-HEADER-PATH: "-internal-isystem" "/boot/system/develop/headers/os/midi"
18a3ba9d69SBrad Smith // CHECK-C-HEADER-PATH: "-internal-isystem" "/boot/system/develop/headers/os/midi2"
19a3ba9d69SBrad Smith // CHECK-C-HEADER-PATH: "-internal-isystem" "/boot/system/develop/headers/os/net"
20a3ba9d69SBrad Smith // CHECK-C-HEADER-PATH: "-internal-isystem" "/boot/system/develop/headers/os/opengl"
21a3ba9d69SBrad Smith // CHECK-C-HEADER-PATH: "-internal-isystem" "/boot/system/develop/headers/os/storage"
22a3ba9d69SBrad Smith // CHECK-C-HEADER-PATH: "-internal-isystem" "/boot/system/develop/headers/os/support"
23a3ba9d69SBrad Smith // CHECK-C-HEADER-PATH: "-internal-isystem" "/boot/system/develop/headers/os/translation"
24a3ba9d69SBrad Smith // CHECK-C-HEADER-PATH: "-internal-isystem" "/boot/system/develop/headers/os/add-ons/graphics"
25a3ba9d69SBrad Smith // CHECK-C-HEADER-PATH: "-internal-isystem" "/boot/system/develop/headers/os/add-ons/input_server"
26a3ba9d69SBrad Smith // CHECK-C-HEADER-PATH: "-internal-isystem" "/boot/system/develop/headers/os/add-ons/mail_daemon"
27a3ba9d69SBrad Smith // CHECK-C-HEADER-PATH: "-internal-isystem" "/boot/system/develop/headers/os/add-ons/registrar"
28a3ba9d69SBrad Smith // CHECK-C-HEADER-PATH: "-internal-isystem" "/boot/system/develop/headers/os/add-ons/screen_saver"
29a3ba9d69SBrad Smith // CHECK-C-HEADER-PATH: "-internal-isystem" "/boot/system/develop/headers/os/add-ons/tracker"
30a3ba9d69SBrad Smith // CHECK-C-HEADER-PATH: "-internal-isystem" "/boot/system/develop/headers/os/be_apps/Deskbar"
31a3ba9d69SBrad Smith // CHECK-C-HEADER-PATH: "-internal-isystem" "/boot/system/develop/headers/os/be_apps/NetPositive"
32a3ba9d69SBrad Smith // CHECK-C-HEADER-PATH: "-internal-isystem" "/boot/system/develop/headers/os/be_apps/Tracker"
33a3ba9d69SBrad Smith // CHECK-C-HEADER-PATH: "-internal-isystem" "/boot/system/develop/headers/3rdparty"
34a3ba9d69SBrad Smith // CHECK-C-HEADER-PATH: "-internal-isystem" "/boot/system/develop/headers/bsd"
35a3ba9d69SBrad Smith // CHECK-C-HEADER-PATH: "-internal-isystem" "/boot/system/develop/headers/glibc"
36a3ba9d69SBrad Smith // CHECK-C-HEADER-PATH: "-internal-isystem" "/boot/system/develop/headers/gnu"
37a3ba9d69SBrad Smith // CHECK-C-HEADER-PATH: "-internal-isystem" "/boot/system/develop/headers/posix"
38a3ba9d69SBrad Smith // CHECK-C-HEADER-PATH: "-internal-isystem" "/boot/system/develop/headers"
398ea74302SBrad Smith 
408ea74302SBrad Smith // Check x86_64-unknown-haiku, X86_64
418ea74302SBrad Smith // RUN: %clang -### %s 2>&1 --target=x86_64-unknown-haiku \
428ea74302SBrad Smith // RUN:     --sysroot=%S/Inputs/haiku_x86_64_tree \
438ea74302SBrad Smith // RUN:   | FileCheck --check-prefix=CHECK-LD-X86_64 %s
448ea74302SBrad Smith // CHECK-LD-X86_64: "-cc1" "-triple" "x86_64-unknown-haiku"
458ea74302SBrad Smith // CHECK-LD-X86_64-SAME: "-isysroot" "[[SYSROOT:[^"]+]]"
468ea74302SBrad Smith // CHECK-LD-X86_64: "{{.*}}ld{{(.exe)?}}"
478ea74302SBrad Smith // CHECK-LD-X86_64-SAME: "--no-undefined"
488ea74302SBrad Smith // CHECK-LD-X86_64-SAME: "[[SYSROOT]]/boot/system/develop/lib/crti.o"
498ea74302SBrad Smith // CHECK-LD-X86_64-SAME: {{^}} "[[SYSROOT]]/boot/system/develop/tools/lib/gcc/x86_64-unknown-haiku/13.2.0/crtbeginS.o"
508ea74302SBrad Smith // CHECK-LD-X86_64-SAME: {{^}} "[[SYSROOT]]/boot/system/develop/lib/start_dyn.o"
518ea74302SBrad Smith // CHECK-LD-X86_64-SAME: {{^}} "[[SYSROOT]]/boot/system/develop/lib/init_term_dyn.o"
528ea74302SBrad Smith // CHECK-LD-X86_64-SAME: "-lgcc" "--push-state" "--as-needed" "-lgcc_s" "--no-as-needed" "--pop-state"
538ea74302SBrad Smith // CHECK-LD-X86_64-SAME: {{^}} "-lroot"
548ea74302SBrad Smith // CHECK-LD-X86_64-SAME: {{^}} "-lgcc" "--push-state" "--as-needed" "-lgcc_s" "--no-as-needed" "--pop-state"
558ea74302SBrad Smith // CHECK-LD-X86_64-SAME: {{^}} "[[SYSROOT]]/boot/system/develop/tools/lib/gcc/x86_64-unknown-haiku/13.2.0/crtendS.o"
568ea74302SBrad Smith // CHECK-LD-X86_64-SAME: {{^}} "[[SYSROOT]]/boot/system/develop/lib/crtn.o"
578ea74302SBrad Smith 
588da1e3ddSBrad Smith // Check -rdynamic is a no-op
598da1e3ddSBrad Smith // RUN: %clang -### -rdynamic %s 2>&1 --target=x86_64-unknown-haiku \
608da1e3ddSBrad Smith // RUN:    | FileCheck --check-prefix=CHECK-RDYNAMIC %s
618da1e3ddSBrad Smith // CHECK-RDYNAMIC-NOT: "-export-dynamic"
628da1e3ddSBrad Smith 
638ea74302SBrad Smith // Check the right flags are present with -shared
648ea74302SBrad Smith // RUN: %clang -### %s -shared 2>&1 --target=x86_64-unknown-haiku \
658ea74302SBrad Smith // RUN:     --sysroot=%S/Inputs/haiku_x86_64_tree \
668ea74302SBrad Smith // RUN:   | FileCheck --check-prefix=CHECK-X86_64-SHARED %s
678ea74302SBrad Smith // CHECK-X86_64-SHARED: "-cc1" "-triple" "x86_64-unknown-haiku"
688ea74302SBrad Smith // CHECK-X86_64-SHARED-SAME: "-isysroot" "[[SYSROOT:[^"]+]]"
698ea74302SBrad Smith // CHECK-X86_64-SHARED: "{{.*}}ld{{(.exe)?}}"
708ea74302SBrad Smith // CHECK-X86_64-SHARED-NOT: "[[SYSROOT]]/boot/system/develop/lib/start_dyn.o"
717cfe32d4SBrad Smith 
727cfe32d4SBrad Smith // Check default ARM CPU, ARMv6
737cfe32d4SBrad Smith // RUN: %clang -### %s 2>&1 --target=arm-unknown-haiku \
747cfe32d4SBrad Smith // RUN:   | FileCheck --check-prefix=CHECK-ARM-CPU %s
757cfe32d4SBrad Smith // CHECK-ARM-CPU: "-target-cpu" "arm1176jzf-s"
764d5a8ccfSBrad Smith 
77*81617f85SBrad Smith // Check that the -X and --no-relax flags are passed to the linker on riscv64
78*81617f85SBrad Smith // RUN: %clang --target=riscv64-unknown-haiku -mno-relax -### %s 2>&1 \
79*81617f85SBrad Smith // RUN:   | FileCheck -check-prefix=RISCV64-FLAGS %s
80*81617f85SBrad Smith // RISCV64-FLAGS: "-X" "--no-relax"
81*81617f85SBrad Smith 
824d5a8ccfSBrad Smith // Check passing LTO flags to the linker
834d5a8ccfSBrad Smith // RUN: %clang --target=x86_64-unknown-haiku -flto -### %s 2>&1 \
844d5a8ccfSBrad Smith // RUN:   | FileCheck -check-prefix=CHECK-LTO-FLAGS %s
854d5a8ccfSBrad Smith // CHECK-LTO-FLAGS: "-plugin-opt=mcpu=x86-64"
86