[Reland][Runtimes] Merge 'compile_commands.json' files from runtimes build (#116303)
[llvm-project.git] / clang / test / Driver / darwin-ld-lto.c
blobb96d5ab30b496d3b9a42373cf906b90e7599f8b4
1 // Check that ld gets "-lto_library".
3 // RUN: mkdir -p %t/bin
4 // RUN: mkdir -p %t/lib
5 // RUN: touch %t/lib/libLTO.dylib
6 // RUN: %clang -fuse-ld= --target=x86_64-apple-darwin10 -### %s \
7 // RUN: -ccc-install-dir %t/bin -mlinker-version=133 2> %t.log
8 // RUN: FileCheck -check-prefix=LINK_LTOLIB_PATH %s -input-file %t.log
9 //
10 // LINK_LTOLIB_PATH: {{ld(.exe)?"}}
11 // LINK_LTOLIB_PATH: "-lto_library"
13 // Also pass -lto_library even if the file doesn't exist; if it's needed at
14 // link time, ld will complain instead.
15 // RUN: %clang -fuse-ld= --target=x86_64-apple-darwin10 -### %s \
16 // RUN: -ccc-install-dir %S/dummytestdir -mlinker-version=133 2> %t.log
17 // RUN: FileCheck -check-prefix=LINK_LTOLIB_PATH %s -input-file %t.log
20 // Check that -object_lto_path is passed correctly to ld64
21 // RUN: %clang -fuse-ld= --target=x86_64-apple-darwin10 %s -flto=full \
22 // RUN: -mlinker-version=116 -### 2>&1 \
23 // RUN: | FileCheck -check-prefix=FULL_LTO_OBJECT_PATH %s
24 // FULL_LTO_OBJECT_PATH: {{ld(.exe)?"}}
25 // FULL_LTO_OBJECT_PATH-SAME: "-object_path_lto"
26 // FULL_LTO_OBJECT_PATH-SAME: {{cc\-[a-zA-Z0-9_]+.o}}"
27 // RUN: %clang -fuse-ld= --target=x86_64-apple-darwin10 %s -flto=thin \
28 // RUN: -mlinker-version=116 -### 2>&1 \
29 // RUN: | FileCheck -check-prefix=THIN_LTO_OBJECT_PATH %s
30 // THIN_LTO_OBJECT_PATH: {{ld(.exe)?"}}
31 // THIN_LTO_OBJECT_PATH-SAME: "-object_path_lto"
32 // THIN_LTO_OBJECT_PATH-SAME: {{thinlto\-[a-zA-Z0-9_]+}}
35 // Check that we pass through -fglobal-isel flags to libLTO.
36 // RUN: %clang --target=arm64-apple-darwin %s -flto -fglobal-isel -### 2>&1 | \
37 // RUN: FileCheck --check-prefix=GISEL %s
38 // GISEL: {{ld(.exe)?"}}
39 // GISEL: "-mllvm" "-global-isel"
40 // GISEL: "-mllvm" "-global-isel-abort=0"
43 // Check that we disable atexit()-based global destructor lowering when
44 // compiling/linking for kernel/kext/freestanding.
45 // RUN: %clang --target=arm64-apple-darwin %s -flto -fapple-kext -### 2>&1 | \
46 // RUN: FileCheck --check-prefix=KEXT %s
47 // KEXT: {{ld(.exe)?"}}
48 // KEXT: "-mllvm" "-disable-atexit-based-global-dtor-lowering"