Clang Project

clang_source_code/test/Driver/myriad-toolchain.c
1// RUN: %clang -no-canonical-prefixes -### -target sparc-myriad-rtems %s \
2// RUN: -ccc-install-dir %S/Inputs/basic_myriad_tree/bin \
3// RUN: --gcc-toolchain=%S/Inputs/basic_myriad_tree 2>&1 | FileCheck %s -check-prefix=LINK_WITH_RTEMS
4// LINK_WITH_RTEMS: Inputs{{.*}}crti.o
5// LINK_WITH_RTEMS: Inputs{{.*}}crtbegin.o
6// LINK_WITH_RTEMS: "-L{{.*}}Inputs/basic_myriad_tree/lib/gcc/sparc-myriad-rtems/6.3.0"
7// LINK_WITH_RTEMS: "-L{{.*}}Inputs/basic_myriad_tree/bin/../sparc-myriad-rtems/lib"
8// LINK_WITH_RTEMS: "--start-group" "-lc" "-lgcc" "-lrtemscpu" "-lrtemsbsp" "--end-group"
9// LINK_WITH_RTEMS: Inputs{{.*}}crtend.o
10// LINK_WITH_RTEMS: Inputs{{.*}}crtn.o
11
12// RUN: %clang -c -no-canonical-prefixes -### -target sparc-myriad-rtems -x c++ %s \
13// RUN: -stdlib=libstdc++ --gcc-toolchain=%S/Inputs/basic_myriad_tree 2>&1 | FileCheck %s -check-prefix=COMPILE_CXX
14// COMPILE_CXX: "-internal-isystem" "{{.*}}/Inputs/basic_myriad_tree/lib/gcc/sparc-myriad-rtems/6.3.0/../../../../sparc-myriad-rtems/include/c++/6.3.0"
15// COMPILE_CXX: "-internal-isystem" "{{.*}}/Inputs/basic_myriad_tree/lib/gcc/sparc-myriad-rtems/6.3.0/../../../../sparc-myriad-rtems/include/c++/6.3.0/sparc-myriad-rtems"
16// COMPILE_CXX: "-internal-isystem" "{{.*}}/Inputs/basic_myriad_tree/lib/gcc/sparc-myriad-rtems/6.3.0/../../../../sparc-myriad-rtems/include/c++/6.3.0/backward"
17
18// RUN: %clang -### -E -target sparc-myriad --sysroot=/yow %s 2>&1 \
19// RUN:   | FileCheck %s -check-prefix=SLASH_INCLUDE
20// SLASH_INCLUDE: "-isysroot" "/yow" "-internal-isystem" "/yow/include"
21
22// RUN: %clang -### -E -target sparc-myriad --sysroot=/yow %s -nostdinc 2>&1 \
23// RUN:   | FileCheck %s -check-prefix=NO_SLASH_INCLUDE
24// NO_SLASH_INCLUDE: "-isysroot" "/yow"
25// NO_SLASH_INCLUDE-NOT: "-internal-isystem" "/yow/include"
26
27// RUN: %clang -### -target what-myriad %s 2>&1 | FileCheck %s -check-prefix=BAD_ARCH
28// BAD_ARCH: the target architecture 'what' is not supported by the target 'myriad'
29
30// Ensure that '-target shave' picks a different compiler.
31// Also check that '-I' is turned into '-i:' for the assembler.
32
33// Note that since we don't know where movi tools are installed,
34// the driver may or may not find a full path to them.
35// That is, the 0th argument will be "/path/to/my/moviCompile"
36// or just "moviCompile" depending on whether moviCompile is found.
37// As such, we test only for a trailing quote in its rendering.
38// The same goes for "moviAsm".
39
40// RUN: %clang -target shave-myriad -mcpu=myriad2.2 -c -### %s -isystem somewhere -Icommon -Wa,-yippee 2>&1 \
41// RUN:   | FileCheck %s -check-prefix=MOVICOMPILE
42// MOVICOMPILE: moviCompile{{(.exe)?}}" "-S" "-fno-exceptions" "-DMYRIAD2" "-mcpu=myriad2.2" "-isystem" "somewhere" "-I" "common"
43// MOVICOMPILE: moviAsm{{(.exe)?}}" "-no6thSlotCompression" "-cv:myriad2.2" "-noSPrefixing" "-a"
44// MOVICOMPILE: "-yippee" "-i:somewhere" "-i:common"
45
46// RUN: %clang -target shave-myriad -c -### %s -DEFINE_ME -UNDEFINE_ME 2>&1 \
47// RUN:   | FileCheck %s -check-prefix=DEFINES
48// DEFINES: "-D" "EFINE_ME" "-U" "NDEFINE_ME"
49
50// RUN: %clang -target shave-myriad -c -### %s -Icommon -iquote quotepath -isystem syspath 2>&1 \
51// RUN:   | FileCheck %s -check-prefix=INCLUDES
52// INCLUDES: "-iquote" "quotepath" "-isystem" "syspath"
53
54// -fno-split-dwarf-inlining is consumed but not passed to moviCompile.
55// RUN: %clang -target shave-myriad -c -### %s -g -fno-inline-functions \
56// RUN: -fno-inline-functions-called-once -Os -Wall -MF dep.d -fno-split-dwarf-inlining \
57// RUN: -ffunction-sections -Xclang -xclangflag -mllvm -llvm-flag 2>&1 \
58// RUN:   | FileCheck %s -check-prefix=PASSTHRU_OPTIONS
59// PASSTHRU_OPTIONS: "-g" "-fno-inline-functions" "-fno-inline-functions-called-once"
60// PASSTHRU_OPTIONS: "-Os" "-Wall" "-MF" "dep.d" "-ffunction-sections"
61// PASSTHRU_OPTIONS: "-Xclang" "-xclangflag" "-mllvm" "-llvm-flag"
62
63// RUN: %clang -target shave-myriad -c %s -o foo.o -### -MD -MF dep.d 2>&1 \
64// RUN:   | FileCheck %s -check-prefix=MDMF
65// MDMF: "-S" "-fno-exceptions" "-DMYRIAD2" "-MD" "-MF" "dep.d" "-MT" "foo.o"
66
67// RUN: %clang -target shave-myriad -std=gnu++11 -mcpu=anothercpu -S %s -o foo.o -### 2>&1 \
68// RUN:   | FileCheck %s -check-prefix=STDEQ
69// STDEQ: "-S" "-fno-exceptions" "-DMYRIAD2" "-std=gnu++11" "-mcpu=anothercpu"
70
71// RUN: %clang -target shave-myriad -E -Ifoo %s -o foo.i -### 2>&1 \
72// RUN:   | FileCheck %s -check-prefix=PREPROCESS
73// PREPROCESS: "-E" "-DMYRIAD2" "-I" "foo"
74
75// RUN: %clang -stdlib=platform -target sparc-myriad -### --driver-mode=g++ %s 2>&1 | FileCheck %s --check-prefix=LIBSTDCXX
76// LIBSTDCXX: "-lstdc++" "-lc" "-lgcc"
77
78// RUN: %clang -stdlib=libc++ -### -target sparcel-myriad -S -x c++ %s 2>&1 | FileCheck %s -check-prefix=LIBCXX
79// LIBCXX: "-internal-isystem" "{{.*}}/../include/c++/v1"
80
81// RUN: %clang -target sparc-myriad -### -nostdlib %s 2>&1 | FileCheck %s --check-prefix=NOSTDLIB
82// NOSTDLIB-NOT: crtbegin.o
83// NOSTDLIB-NOT: "-lc"
84
85// RUN: %clang -### -c -g %s -target sparc-myriad 2>&1 | FileCheck -check-prefix=G_SPARC %s
86// G_SPARC: "-debug-info-kind=limited" "-dwarf-version=2"
87
88// RUN: %clang -### -c %s -target sparc-myriad-rtems -fuse-init-array 2>&1 \
89// RUN: | FileCheck -check-prefix=USE-INIT-ARRAY %s
90// USE-INIT-ARRAY-NOT: argument unused
91