]> granicus.if.org Git - clang/commitdiff
The profile library must come before the C library so that it can use
authorChandler Carruth <chandlerc@gmail.com>
Mon, 24 Jun 2013 09:38:45 +0000 (09:38 +0000)
committerChandler Carruth <chandlerc@gmail.com>
Mon, 24 Jun 2013 09:38:45 +0000 (09:38 +0000)
atexit.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@184708 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Driver/Tools.cpp
test/Driver/coverage-ld.c

index 050db6c0b1b36e01ce000a168546a26bc7d2269c..794d3124f51d8e781a285ff247004b9b07cb19cd 100644 (file)
@@ -6206,6 +6206,9 @@ void gnutools::Link::ConstructJob(Compilation &C, const JobAction &JA,
   if (Sanitize.needsLsanRt())
     addLsanRTLinux(getToolChain(), Args, CmdArgs);
 
+  // The profile runtime also needs access to system libraries.
+  addProfileRTLinux(getToolChain(), Args, CmdArgs);
+
   if (D.CCCIsCXX &&
       !Args.hasArg(options::OPT_nostdlib) &&
       !Args.hasArg(options::OPT_nodefaultlibs)) {
@@ -6262,8 +6265,6 @@ void gnutools::Link::ConstructJob(Compilation &C, const JobAction &JA,
     }
   }
 
-  addProfileRTLinux(getToolChain(), Args, CmdArgs);
-
   C.addCommand(new Command(JA, *this, ToolChain.Linker.c_str(), CmdArgs));
 }
 
index 2ec0486c32b5063b1f617fd8561b8c8d3c3dc4a6..c8910c5c0fea7d5532ff26984c9d14ec8937566d 100644 (file)
@@ -7,7 +7,7 @@
 // RUN:   | FileCheck --check-prefix=CHECK-LINUX-I386 %s
 //
 // CHECK-LINUX-I386: "{{(.*[^-.0-9A-Z_a-z])?}}ld{{(.exe)?}}"
-// CHECK-LINUX-I386: "{{.*}}/Inputs/resource_dir/lib/linux/libclang_rt.profile-i386.a"
+// CHECK-LINUX-I386: "{{.*}}/Inputs/resource_dir/lib/linux/libclang_rt.profile-i386.a" {{.*}} "-lc"
 //
 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
 // RUN:     -target x86_64-unknown-linux --coverage \
@@ -16,4 +16,4 @@
 // RUN:   | FileCheck --check-prefix=CHECK-LINUX-X86-64 %s
 //
 // CHECK-LINUX-X86-64: "{{(.*[^-.0-9A-Z_a-z])?}}ld{{(.exe)?}}"
-// CHECK-LINUX-X86-64: "{{.*}}/Inputs/resource_dir/lib/linux/libclang_rt.profile-x86_64.a"
+// CHECK-LINUX-X86-64: "{{.*}}/Inputs/resource_dir/lib/linux/libclang_rt.profile-x86_64.a" {{.*}} "-lc"