[llvm-branch-commits] [cfe-branch] r287579 - [LTO] Merge r285254 into 3.9.1 (Darwin clang driver always pass -lto_library)

Mehdi Amini via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Mon Nov 21 13:27:59 PST 2016


Author: mehdi_amini
Date: Mon Nov 21 15:27:58 2016
New Revision: 287579

URL: http://llvm.org/viewvc/llvm-project?rev=287579&view=rev
Log:
[LTO] Merge r285254 into 3.9.1 (Darwin clang driver always pass -lto_library)

See: https://llvm.org/PR30840


Modified:
    cfe/branches/release_39/lib/Driver/Tools.cpp
    cfe/branches/release_39/test/Driver/darwin-ld-lto.c

Modified: cfe/branches/release_39/lib/Driver/Tools.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/release_39/lib/Driver/Tools.cpp?rev=287579&r1=287578&r2=287579&view=diff
==============================================================================
--- cfe/branches/release_39/lib/Driver/Tools.cpp (original)
+++ cfe/branches/release_39/lib/Driver/Tools.cpp Mon Nov 21 15:27:58 2016
@@ -7637,22 +7637,22 @@ void darwin::Linker::AddLinkArgs(Compila
       CmdArgs.push_back("-object_path_lto");
       CmdArgs.push_back(TmpPath);
     }
+  }
 
-    // Use -lto_library option to specify the libLTO.dylib path. Try to find
-    // it in clang installed libraries. If not found, the option is not used
-    // and 'ld' will use its default mechanism to search for libLTO.dylib.
-    if (Version[0] >= 133) {
-      // Search for libLTO in <InstalledDir>/../lib/libLTO.dylib
-      StringRef P = llvm::sys::path::parent_path(D.getInstalledDir());
-      SmallString<128> LibLTOPath(P);
-      llvm::sys::path::append(LibLTOPath, "lib");
-      llvm::sys::path::append(LibLTOPath, "libLTO.dylib");
-      if (llvm::sys::fs::exists(LibLTOPath)) {
-        CmdArgs.push_back("-lto_library");
-        CmdArgs.push_back(C.getArgs().MakeArgString(LibLTOPath));
-      } else {
-        D.Diag(diag::warn_drv_lto_libpath);
-      }
+  // Use -lto_library option to specify the libLTO.dylib path. Try to find
+  // it in clang installed libraries. If not found, the option is not used
+  // and 'ld' will use its default mechanism to search for libLTO.dylib.
+  if (Version[0] >= 133) {
+    // Search for libLTO in <InstalledDir>/../lib/libLTO.dylib
+    StringRef P = llvm::sys::path::parent_path(D.getInstalledDir());
+    SmallString<128> LibLTOPath(P);
+    llvm::sys::path::append(LibLTOPath, "lib");
+    llvm::sys::path::append(LibLTOPath, "libLTO.dylib");
+    if (llvm::sys::fs::exists(LibLTOPath)) {
+      CmdArgs.push_back("-lto_library");
+      CmdArgs.push_back(C.getArgs().MakeArgString(LibLTOPath));
+    } else {
+      D.Diag(diag::warn_drv_lto_libpath);
     }
   }
 

Modified: cfe/branches/release_39/test/Driver/darwin-ld-lto.c
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/release_39/test/Driver/darwin-ld-lto.c?rev=287579&r1=287578&r2=287579&view=diff
==============================================================================
--- cfe/branches/release_39/test/Driver/darwin-ld-lto.c (original)
+++ cfe/branches/release_39/test/Driver/darwin-ld-lto.c Mon Nov 21 15:27:58 2016
@@ -3,22 +3,21 @@
 // Check that ld gets "-lto_library" and warnings about libLTO.dylib path.
 
 // RUN: %clang -target x86_64-apple-darwin10 -### %s \
-// RUN:   -mlinker-version=133 -flto 2> %t.log
-// RUN: cat %t.log
-// RUN: FileCheck -check-prefix=LINK_LTOLIB_PATH %s < %t.log
+// RUN:   -ccc-install-dir %T/bin -mlinker-version=133 2> %t.log
+// RUN: FileCheck -check-prefix=LINK_LTOLIB_PATH %s -input-file %t.log
 //
 // LINK_LTOLIB_PATH: {{ld(.exe)?"}}
 // LINK_LTOLIB_PATH: "-lto_library"
 
 // RUN: %clang -target x86_64-apple-darwin10 -### %s \
-// RUN:   -ccc-install-dir %S/dummytestdir -mlinker-version=133 -flto 2> %t.log
+// RUN:   -ccc-install-dir %S/dummytestdir -mlinker-version=133 2> %t.log
 // RUN: cat %t.log
 // RUN: FileCheck -check-prefix=LINK_LTOLIB_PATH_WRN %s < %t.log
 //
 // LINK_LTOLIB_PATH_WRN: warning: libLTO.dylib relative to clang installed dir not found; using 'ld' default search path instead
 
 // RUN: %clang -target x86_64-apple-darwin10 -### %s \
-// RUN:   -ccc-install-dir %S/dummytestdir -mlinker-version=133 -Wno-liblto -flto 2> %t.log
+// RUN:   -ccc-install-dir %S/dummytestdir -mlinker-version=133 -Wno-liblto 2> %t.log
 // RUN: cat %t.log
 // RUN: FileCheck -check-prefix=LINK_LTOLIB_PATH_NOWRN %s < %t.log
 //




More information about the llvm-branch-commits mailing list