Clang Project

clang_source_code/test/Driver/darwin-ld-lto.c
1// REQUIRES: system-darwin
2
3// Check that ld gets "-lto_library".
4
5// RUN: mkdir -p %t/bin
6// RUN: mkdir -p %t/lib
7// RUN: touch %t/lib/libLTO.dylib
8// RUN: %clang -target x86_64-apple-darwin10 -### %s \
9// RUN:   -ccc-install-dir %t/bin -mlinker-version=133 2> %t.log
10// RUN: FileCheck -check-prefix=LINK_LTOLIB_PATH %s -input-file %t.log
11//
12// LINK_LTOLIB_PATH: {{ld(.exe)?"}}
13// LINK_LTOLIB_PATH: "-lto_library"
14
15// Also pass -lto_library even if the file doesn't exist; if it's needed at
16// link time, ld will complain instead.
17// RUN: %clang -target x86_64-apple-darwin10 -### %s \
18// RUN:   -ccc-install-dir %S/dummytestdir -mlinker-version=133 2> %t.log
19// RUN: FileCheck -check-prefix=LINK_LTOLIB_PATH %s -input-file %t.log
20
21
22// Check that -object_lto_path is passed correctly to ld64
23// RUN: %clang -target x86_64-apple-darwin10 %s -flto=full -### 2>&1 | \
24// RUN:   FileCheck -check-prefix=FULL_LTO_OBJECT_PATH %s
25// FULL_LTO_OBJECT_PATH: {{ld(.exe)?"}}
26// FULL_LTO_OBJECT_PATH-SAME: "-object_path_lto" "{{[a-zA-Z0-9_\/]+\/cc\-[a-zA-Z0-9_]+.o}}"
27// RUN: %clang -target x86_64-apple-darwin10 %s -flto=thin -### 2>&1 | \
28// RUN:   FileCheck -check-prefix=THIN_LTO_OBJECT_PATH %s
29// THIN_LTO_OBJECT_PATH: {{ld(.exe)?"}}
30// THIN_LTO_OBJECT_PATH-SAME: "-object_path_lto" "{{[a-zA-Z0-9_\/]+\/thinlto\-[a-zA-Z0-9_]+}}"
31