[PATCH] D44964: Change order of libclang_rt.profile link for freebsd

Tom Rix via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Mar 27 15:41:50 PDT 2018


trixirt created this revision.
trixirt added reviewers: emaste, rsmith.
Herald added a subscriber: cfe-commits.

clang -static -coverage foo.c  fails because the -lclang_rt.profile-*.a has a dependency on libc but is placed after libc in the link line.
This change place -lclang_rt.profile before -lc.


Repository:
  rC Clang

https://reviews.llvm.org/D44964

Files:
  lib/Driver/ToolChains/FreeBSD.cpp


Index: lib/Driver/ToolChains/FreeBSD.cpp
===================================================================
--- lib/Driver/ToolChains/FreeBSD.cpp
+++ lib/Driver/ToolChains/FreeBSD.cpp
@@ -262,6 +262,8 @@
   bool NeedsXRayDeps = addXRayRuntime(ToolChain, Args, CmdArgs);
   AddLinkerInputs(ToolChain, Inputs, Args, CmdArgs, JA);
 
+  ToolChain.addProfileRTLibs(Args, CmdArgs);
+
   if (!Args.hasArg(options::OPT_nostdlib, options::OPT_nodefaultlibs)) {
     addOpenMPRuntime(CmdArgs, ToolChain, Args);
     if (D.CCCIsCXX()) {
@@ -329,8 +331,6 @@
     CmdArgs.push_back(Args.MakeArgString(ToolChain.GetFilePath("crtn.o")));
   }
 
-  ToolChain.addProfileRTLibs(Args, CmdArgs);
-
   const char *Exec = Args.MakeArgString(getToolChain().GetLinkerPath());
   C.addCommand(llvm::make_unique<Command>(JA, *this, Exec, CmdArgs, Inputs));
 }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D44964.140012.patch
Type: text/x-patch
Size: 835 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20180327/69c0fc6e/attachment-0001.bin>


More information about the cfe-commits mailing list