[cfe-commits] r144869 - in /cfe/trunk: lib/Driver/ToolChains.cpp lib/Driver/Tools.cpp runtime/compiler-rt/Makefile

Daniel Dunbar daniel at zuster.org
Wed Nov 16 16:36:57 PST 2011


Author: ddunbar
Date: Wed Nov 16 18:36:57 2011
New Revision: 144869

URL: http://llvm.org/viewvc/llvm-project?rev=144869&view=rev
Log:
clang/Darwin: Use the compiler-rt provided profile library.

Modified:
    cfe/trunk/lib/Driver/ToolChains.cpp
    cfe/trunk/lib/Driver/Tools.cpp
    cfe/trunk/runtime/compiler-rt/Makefile

Modified: cfe/trunk/lib/Driver/ToolChains.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains.cpp?rev=144869&r1=144868&r2=144869&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/ToolChains.cpp (original)
+++ cfe/trunk/lib/Driver/ToolChains.cpp Wed Nov 16 18:36:57 2011
@@ -454,6 +454,19 @@
     return;
   }
 
+  // If we are building profile support, link that library in.
+  if (Args.hasArg(options::OPT_fprofile_arcs) ||
+      Args.hasArg(options::OPT_fprofile_generate) ||
+      Args.hasArg(options::OPT_fcreate_profile) ||
+      Args.hasArg(options::OPT_coverage)) {
+    // Select the appropriate runtime library for the target.
+    if (isTargetIPhoneOS()) {
+      AddLinkRuntimeLib(Args, CmdArgs, "libclang_rt.profile_ios.a");
+    } else {
+      AddLinkRuntimeLib(Args, CmdArgs, "libclang_rt.profile_osx.a");
+    }
+  }
+
   // Otherwise link libSystem, then the dynamic runtime library, and finally any
   // target specific static runtime library.
   CmdArgs.push_back("-lSystem");

Modified: cfe/trunk/lib/Driver/Tools.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=144869&r1=144868&r2=144869&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/Tools.cpp (original)
+++ cfe/trunk/lib/Driver/Tools.cpp Wed Nov 16 18:36:57 2011
@@ -160,13 +160,6 @@
   std::string ProfileRT =
     std::string(TC.getDriver().Dir) + "/../lib/libprofile_rt.a";
 
-  if (Triple.isOSDarwin()) {
-    // On Darwin, if the static library doesn't exist try the dylib.
-    bool Exists;
-    if (llvm::sys::fs::exists(ProfileRT, Exists) || !Exists)
-      ProfileRT.replace(ProfileRT.size() - 1, 1, "dylib");
-  }
-
   CmdArgs.push_back(Args.MakeArgString(ProfileRT));
 }
 
@@ -3589,8 +3582,6 @@
     // endfile_spec is empty.
   }
 
-  addProfileRT(getToolChain(), Args, CmdArgs, getToolChain().getTriple());
-
   Args.AddAllArgs(CmdArgs, options::OPT_T_Group);
   Args.AddAllArgs(CmdArgs, options::OPT_F);
 

Modified: cfe/trunk/runtime/compiler-rt/Makefile
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/runtime/compiler-rt/Makefile?rev=144869&r1=144868&r2=144869&view=diff
==============================================================================
--- cfe/trunk/runtime/compiler-rt/Makefile (original)
+++ cfe/trunk/runtime/compiler-rt/Makefile Wed Nov 16 18:36:57 2011
@@ -76,7 +76,9 @@
 RuntimeDirs :=
 ifeq ($(OS),Darwin)
 RuntimeDirs += darwin
-RuntimeLibrary.darwin.Configs := eprintf 10.4 osx ios cc_kext
+RuntimeLibrary.darwin.Configs := \
+	eprintf 10.4 osx ios cc_kext \
+	profile_osx profile_ios
 
 # On Darwin, fake Clang into using the iOS assembler (since compiler-rt wants to
 # build ARM bits).





More information about the cfe-commits mailing list