[cfe-commits] r163777 - in /cfe/trunk: lib/Driver/Tools.cpp test/Driver/openbsd.c
Eric Christopher
echristo at apple.com
Wed Sep 12 23:32:34 PDT 2012
Author: echristo
Date: Thu Sep 13 01:32:34 2012
New Revision: 163777
URL: http://llvm.org/viewvc/llvm-project?rev=163777&view=rev
Log:
Properly link libpthread_p when using profiling on OpenBSD.
Patch by Brad Smith.
Modified:
cfe/trunk/lib/Driver/Tools.cpp
cfe/trunk/test/Driver/openbsd.c
Modified: cfe/trunk/lib/Driver/Tools.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=163777&r1=163776&r2=163777&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/Tools.cpp (original)
+++ cfe/trunk/lib/Driver/Tools.cpp Thu Sep 13 01:32:34 2012
@@ -4943,14 +4943,21 @@
// the default system libraries. Just mimic this for now.
CmdArgs.push_back("-lgcc");
- 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))
+ if (Args.hasArg(options::OPT_pg))
CmdArgs.push_back("-lc_p");
else
CmdArgs.push_back("-lc");
}
+
CmdArgs.push_back("-lgcc");
}
Modified: cfe/trunk/test/Driver/openbsd.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/openbsd.c?rev=163777&r1=163776&r2=163777&view=diff
==============================================================================
--- cfe/trunk/test/Driver/openbsd.c (original)
+++ cfe/trunk/test/Driver/openbsd.c Thu Sep 13 01:32:34 2012
@@ -1,5 +1,9 @@
-// RUN: %clang -no-canonical-prefixes -ccc-clang-archs "" -target i686-pc-openbsd %s -### 2> %t.log
-// RUN: FileCheck -input-file %t.log %s
+// RUN: %clang -no-canonical-prefixes -ccc-clang-archs "" -target i686-pc-openbsd %s -### 2>&1 \
+// RUN: | FileCheck --check-prefix=CHECK-LD %s
+// CHECK-LD: clang{{.*}}" "-cc1" "-triple" "i686-pc-openbsd"
+// CHECK-LD: ld{{.*}}" "-e" "__start" "--eh-frame-hdr" "-Bdynamic" "-dynamic-linker" "{{.*}}ld.so" "-o" "a.out" "{{.*}}crt0.o" "{{.*}}crtbegin.o" "{{.*}}.o" "-lgcc" "-lc" "-lgcc" "{{.*}}crtend.o"
-// CHECK: clang{{.*}}" "-cc1" "-triple" "i686-pc-openbsd"
-// CHECK: ld{{.*}}" "-e" "__start" "--eh-frame-hdr" "-Bdynamic" "-dynamic-linker" "{{.*}}ld.so" "-o" "a.out" "{{.*}}crt0.o" "{{.*}}crtbegin.o" "{{.*}}.o" "-lgcc" "-lc" "-lgcc" "{{.*}}crtend.o"
+// RUN: %clang -no-canonical-prefixes -ccc-clang-archs "" -target i686-pc-openbsd -pg -pthread %s -### 2>&1 \
+// RUN: | FileCheck --check-prefix=CHECK-PG %s
+// CHECK-PG: clang{{.*}}" "-cc1" "-triple" "i686-pc-openbsd"
+// CHECK-PG: ld{{.*}}" "-e" "__start" "--eh-frame-hdr" "-Bdynamic" "-dynamic-linker" "{{.*}}ld.so" "-o" "a.out" "{{.*}}crt0.o" "{{.*}}crtbegin.o" "{{.*}}.o" "-lgcc" "-lpthread_p" "-lc_p" "-lgcc" "{{.*}}crtend.o"
More information about the cfe-commits
mailing list