forked from OSchip/llvm-project
Properly link libpthread_p when using profiling on OpenBSD.
Patch by Brad Smith. llvm-svn: 163777
This commit is contained in:
parent
4a7a5610ce
commit
17674ec8c6
|
@ -4943,14 +4943,21 @@ void openbsd::Link::ConstructJob(Compilation &C, const JobAction &JA,
|
|||
// 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");
|
||||
}
|
||||
|
||||
|
|
|
@ -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"
|
||||
|
|
Loading…
Reference in New Issue