2015-10-02 23:10:33 +08:00
|
|
|
// REQUIRES: system-darwin
|
|
|
|
|
darwin: Unconditionally pass -lto_library, remove -Wliblto warning.
https://reviews.llvm.org/D25932 made it so that clang always checks if
libLTO.dylib is present on disk, even if -flto is not being used. The
motivation for that change was that if a dependency happens to contain bitcode,
ld64 will try to load libLTO without -flto explicitly being enabled. However,
the change had the undesirable side effect of warning if libLTO.dylib doesn't
exist even if it isn't needed.
Change things so that -lto_library is always passes, independent of if it
exists or not. ld64 only looks at this flag if it uses LTO. If the dylib
exists, all is well. If it doesn't, and LTO is not being used, all is well too.
If ld64 does end up using LTO and the dylib does not exist, ld64 will print
something like
ld: could not process llvm bitcode object file, because foo/libLTO.dylib could not be loaded file 'test.o' for architecture x86_64
https://reviews.llvm.org/D26984
llvm-svn: 287685
2016-11-23 03:38:07 +08:00
|
|
|
// Check that ld gets "-lto_library".
|
2015-10-02 23:10:33 +08:00
|
|
|
|
2017-08-16 03:47:06 +08:00
|
|
|
// RUN: mkdir -p %t/bin
|
|
|
|
// RUN: mkdir -p %t/lib
|
|
|
|
// RUN: touch %t/lib/libLTO.dylib
|
2015-10-02 23:10:33 +08:00
|
|
|
// RUN: %clang -target x86_64-apple-darwin10 -### %s \
|
2017-08-16 03:47:06 +08:00
|
|
|
// RUN: -ccc-install-dir %t/bin -mlinker-version=133 2> %t.log
|
2016-08-31 04:36:50 +08:00
|
|
|
// RUN: FileCheck -check-prefix=LINK_LTOLIB_PATH %s -input-file %t.log
|
2015-10-02 23:10:33 +08:00
|
|
|
//
|
|
|
|
// LINK_LTOLIB_PATH: {{ld(.exe)?"}}
|
|
|
|
// LINK_LTOLIB_PATH: "-lto_library"
|
|
|
|
|
darwin: Unconditionally pass -lto_library, remove -Wliblto warning.
https://reviews.llvm.org/D25932 made it so that clang always checks if
libLTO.dylib is present on disk, even if -flto is not being used. The
motivation for that change was that if a dependency happens to contain bitcode,
ld64 will try to load libLTO without -flto explicitly being enabled. However,
the change had the undesirable side effect of warning if libLTO.dylib doesn't
exist even if it isn't needed.
Change things so that -lto_library is always passes, independent of if it
exists or not. ld64 only looks at this flag if it uses LTO. If the dylib
exists, all is well. If it doesn't, and LTO is not being used, all is well too.
If ld64 does end up using LTO and the dylib does not exist, ld64 will print
something like
ld: could not process llvm bitcode object file, because foo/libLTO.dylib could not be loaded file 'test.o' for architecture x86_64
https://reviews.llvm.org/D26984
llvm-svn: 287685
2016-11-23 03:38:07 +08:00
|
|
|
// Also pass -lto_library even if the file doesn't exist; if it's needed at
|
|
|
|
// link time, ld will complain instead.
|
2015-10-02 23:10:33 +08:00
|
|
|
// RUN: %clang -target x86_64-apple-darwin10 -### %s \
|
2016-10-27 07:23:08 +08:00
|
|
|
// RUN: -ccc-install-dir %S/dummytestdir -mlinker-version=133 2> %t.log
|
darwin: Unconditionally pass -lto_library, remove -Wliblto warning.
https://reviews.llvm.org/D25932 made it so that clang always checks if
libLTO.dylib is present on disk, even if -flto is not being used. The
motivation for that change was that if a dependency happens to contain bitcode,
ld64 will try to load libLTO without -flto explicitly being enabled. However,
the change had the undesirable side effect of warning if libLTO.dylib doesn't
exist even if it isn't needed.
Change things so that -lto_library is always passes, independent of if it
exists or not. ld64 only looks at this flag if it uses LTO. If the dylib
exists, all is well. If it doesn't, and LTO is not being used, all is well too.
If ld64 does end up using LTO and the dylib does not exist, ld64 will print
something like
ld: could not process llvm bitcode object file, because foo/libLTO.dylib could not be loaded file 'test.o' for architecture x86_64
https://reviews.llvm.org/D26984
llvm-svn: 287685
2016-11-23 03:38:07 +08:00
|
|
|
// RUN: FileCheck -check-prefix=LINK_LTOLIB_PATH %s -input-file %t.log
|
2019-01-12 05:16:04 +08:00
|
|
|
|
|
|
|
|
|
|
|
// Check that -object_lto_path is passed correctly to ld64
|
|
|
|
// RUN: %clang -target x86_64-apple-darwin10 %s -flto=full -### 2>&1 | \
|
|
|
|
// RUN: FileCheck -check-prefix=FULL_LTO_OBJECT_PATH %s
|
2019-01-30 04:13:02 +08:00
|
|
|
// FULL_LTO_OBJECT_PATH: {{ld(.exe)?"}}
|
2019-01-12 05:16:04 +08:00
|
|
|
// FULL_LTO_OBJECT_PATH-SAME: "-object_path_lto" "{{[a-zA-Z0-9_\/]+\/cc\-[a-zA-Z0-9_]+.o}}"
|
|
|
|
// RUN: %clang -target x86_64-apple-darwin10 %s -flto=thin -### 2>&1 | \
|
|
|
|
// RUN: FileCheck -check-prefix=THIN_LTO_OBJECT_PATH %s
|
2019-01-30 04:13:02 +08:00
|
|
|
// THIN_LTO_OBJECT_PATH: {{ld(.exe)?"}}
|
2019-01-12 05:16:04 +08:00
|
|
|
// THIN_LTO_OBJECT_PATH-SAME: "-object_path_lto" "{{[a-zA-Z0-9_\/]+\/thinlto\-[a-zA-Z0-9_]+}}"
|