[cfe-commits] r166483 - in /cfe/trunk: lib/Driver/Tools.cpp test/Driver/bitrig.c

Rafael Espindola rafael.espindola at gmail.com
Tue Oct 23 10:07:31 PDT 2012


Author: rafael
Date: Tue Oct 23 12:07:31 2012
New Revision: 166483

URL: http://llvm.org/viewvc/llvm-project?rev=166483&view=rev
Log:
Handle -pthread, -pg and -shared correctly on bitrig.
Patch by David Hill.

Modified:
    cfe/trunk/lib/Driver/Tools.cpp
    cfe/trunk/test/Driver/bitrig.c

Modified: cfe/trunk/lib/Driver/Tools.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=166483&r1=166482&r2=166483&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/Tools.cpp (original)
+++ cfe/trunk/lib/Driver/Tools.cpp Tue Oct 23 12:07:31 2012
@@ -5177,8 +5177,14 @@
         CmdArgs.push_back("-lm");
     }
 
-    if (Args.hasArg(options::OPT_pthread))
-      CmdArgs.push_back("-lpthread");
+    if (Args.hasArg(options::OPT_pthread)) {
+      if (!Args.hasArg(options::OPT_shared) &&
+          Args.hasArg(options::OPT_pg))
+        CmdArgs.push_back("-lpthread_p");
+      else
+        CmdArgs.push_back("-lpthread");
+    }
+
     if (!Args.hasArg(options::OPT_shared)) {
       if (Args.hasArg(options::OPT_pg))
         CmdArgs.push_back("-lc_p");

Modified: cfe/trunk/test/Driver/bitrig.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/bitrig.c?rev=166483&r1=166482&r2=166483&view=diff
==============================================================================
--- cfe/trunk/test/Driver/bitrig.c (original)
+++ cfe/trunk/test/Driver/bitrig.c Tue Oct 23 12:07:31 2012
@@ -12,3 +12,18 @@
 // RUN:   | FileCheck --check-prefix=CHECK-LD-CXX-STDLIB %s
 // CHECK-LD-CXX-STDLIB: clang{{.*}}" "-cc1" "-triple" "amd64-pc-bitrig"
 // CHECK-LD-CXX-STDLIB: ld{{.*}}" {{.*}} "-lc++" "-lcxxrt" "-lgcc" "-lm" "-lc" "-lclang_rt.amd64"
+
+// RUN: %clang -no-canonical-prefixes -target amd64-pc-bitrig -pthread %s -### 2>&1 \
+// RUN:   | FileCheck --check-prefix=CHECK-PTHREAD %s
+// CHECK-PTHREAD: clang{{.*}}" "-cc1" "-triple" "amd64-pc-bitrig"
+// CHECK-PTHREAD: ld{{.*}}" {{.*}} "{{.*}}crtbegin.o" {{.*}}.o" "-lpthread" "-lc" "-lclang_rt.amd64" "{{.*}}crtend.o"
+
+// RUN: %clang -no-canonical-prefixes -target amd64-pc-bitrig -pg -pthread %s -### 2>&1 \
+// RUN:   | FileCheck --check-prefix=CHECK-PG-PTHREAD %s
+// CHECK-PG-PTHREAD: clang{{.*}}" "-cc1" "-triple" "amd64-pc-bitrig"
+// CHECK-PG-PTHREAD: ld{{.*}}" {{.*}} "{{.*}}crtbegin.o" {{.*}}.o" "-lpthread_p" "-lc_p" "-lclang_rt.amd64" "{{.*}}crtend.o"
+
+// RUN: %clang -no-canonical-prefixes -target amd64-pc-bitrig -shared -pg -pthread %s -### 2>&1 \
+// RUN:   | FileCheck --check-prefix=CHECK-PG-PTHREAD-SHARED %s
+// CHECK-PG-PTHREAD-SHARED: clang{{.*}}" "-cc1" "-triple" "amd64-pc-bitrig"
+// CHECK-PG-PTHREAD-SHARED: ld{{.*}}" {{.*}} "{{.*}}crtbeginS.o" {{.*}}.o" "-lpthread" "-lclang_rt.amd64" "{{.*}}crtendS.o"





More information about the cfe-commits mailing list