[cfe-commits] [PATCH] Bitrig - multiple changes
David Hill
dhill at mindcry.org
Tue Oct 16 19:37:14 PDT 2012
How is this?
On Tue, Oct 16, 2012 at 05:24:59PM -0700, Eli Friedman wrote:
> On Mon, Oct 15, 2012 at 9:00 AM, David Hill <dhill at mindcry.org> wrote:
> > Ping. Can someone commit this?
>
> + if (Args.hasArg(options::OPT_pthread)) {
> + if (!Args.hasArg(options::OPT_shared) &&
> + Args.hasArg(options::OPT_pg))
>
> I'd like to see a driver test where the check for -shared matters.
>
> -Eli
-------------- next part --------------
diff --git a/lib/Driver/Tools.cpp b/lib/Driver/Tools.cpp
index 760fc8b..938f888 100644
--- a/lib/Driver/Tools.cpp
+++ b/lib/Driver/Tools.cpp
@@ -5160,8 +5160,14 @@ void bitrig::Link::ConstructJob(Compilation &C, const JobAction &JA,
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");
diff --git a/test/Driver/bitrig.c b/test/Driver/bitrig.c
index 6359bb4..3f62ab9 100644
--- a/test/Driver/bitrig.c
+++ b/test/Driver/bitrig.c
@@ -1,14 +1,24 @@
-// RUN: %clang -no-canonical-prefixes -ccc-clang-archs "" -target amd64-pc-bitrig %s -### 2>&1 \
+// RUN: %clang -no-canonical-prefixes -target amd64-pc-bitrig %s -### 2>&1 \
// RUN: | FileCheck --check-prefix=CHECK-LD-C %s
// CHECK-LD-C: clang{{.*}}" "-cc1" "-triple" "amd64-pc-bitrig"
// CHECK-LD-C: ld{{.*}}" {{.*}} "-lc" "-lclang_rt.amd64"
-// RUN: %clangxx -no-canonical-prefixes -ccc-clang-archs "" -target amd64-pc-bitrig %s -### 2>&1 \
+// RUN: %clang -no-canonical-prefixes -target amd64-pc-bitrig -pg -pthread %s -### 2>&1 \
+// RUN: | FileCheck --check-prefix=CHECK-PG %s
+// CHECK-PG: clang{{.*}}" "-cc1" "-triple" "amd64-pc-bitrig"
+// CHECK-PG: ld{{.*}}" "-e" "__start" "--eh-frame-hdr" "-Bdynamic" "-dynamic-linker" "{{.*}}ld.so" "-o" "a.out" "{{.*}}crt0.o" "{{.*}}crtbegin.o" "{{.*}}.o" "-lpthread_p" "-lc_p" "-lclang_rt.amd64"
+
+// RUN: %clang -no-canonical-prefixes -target amd64-pc-bitrig -shared -pg -pthread %s -### 2>&1 \
+// RUN: | FileCheck --check-prefix=CHECK-PG-SHARED %s
+// CHECK-PG-SHARED: clang{{.*}}" "-cc1" "-triple" "amd64-pc-bitrig"
+// CHECK-PG-SHARED: ld{{.*}}" "--eh-frame-hdr" "-Bdynamic" "-shared" "-o" "a.out" "{{.*}}crtbeginS.o" "{{.*}}.o" "-lpthread" "-lclang_rt.amd64" "{{.*}}crtendS.o"
+
+// RUN: %clangxx -no-canonical-prefixes -target amd64-pc-bitrig %s -### 2>&1 \
// RUN: | FileCheck --check-prefix=CHECK-LD-CXX %s
// CHECK-LD-CXX: clang{{.*}}" "-cc1" "-triple" "amd64-pc-bitrig"
// CHECK-LD-CXX: ld{{.*}}" {{.*}} "-lstdc++" "-lm" "-lc" "-lclang_rt.amd64"
-// RUN: %clangxx -stdlib=libc++ -no-canonical-prefixes -ccc-clang-archs "" -target amd64-pc-bitrig %s -### 2>&1 \
+// RUN: %clangxx -stdlib=libc++ -no-canonical-prefixes -target amd64-pc-bitrig %s -### 2>&1 \
// 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"
More information about the cfe-commits
mailing list