forked from OSchip/llvm-project
-pthread does not translate to -lpthread on Android.
There is no libpthread.so, and pthread interface is implemented in libc.so. This mirrors gcc behavior. llvm-svn: 209731
This commit is contained in:
parent
6b0beb0cbd
commit
152b023b97
|
@ -7169,8 +7169,9 @@ void gnutools::Link::ConstructJob(Compilation &C, const JobAction &JA,
|
|||
}
|
||||
AddRunTimeLibs(ToolChain, D, CmdArgs, Args);
|
||||
|
||||
if (Args.hasArg(options::OPT_pthread) ||
|
||||
Args.hasArg(options::OPT_pthreads) || UsedOpenMPLib != LibUnknown)
|
||||
if (!isAndroid &&
|
||||
(Args.hasArg(options::OPT_pthread) ||
|
||||
Args.hasArg(options::OPT_pthreads) || UsedOpenMPLib != LibUnknown))
|
||||
CmdArgs.push_back("-lpthread");
|
||||
|
||||
CmdArgs.push_back("-lc");
|
||||
|
|
|
@ -820,6 +820,81 @@
|
|||
// CHECK-ANDROID-32: "-dynamic-linker" "/system/bin/linker"
|
||||
// CHECK-ANDROID-64: "-dynamic-linker" "/system/bin/linker64"
|
||||
//
|
||||
// Test that -pthread does not add -lpthread on Android.
|
||||
// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
|
||||
// RUN: --target=arm-linux-androideabi -pthread \
|
||||
// RUN: --sysroot=%S/Inputs/basic_android_tree/sysroot \
|
||||
// RUN: | FileCheck --check-prefix=CHECK-ANDROID-PTHREAD %s
|
||||
// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
|
||||
// RUN: --target=arm-linux-android -pthread \
|
||||
// RUN: --sysroot=%S/Inputs/basic_android_tree/sysroot \
|
||||
// RUN: | FileCheck --check-prefix=CHECK-ANDROID-PTHREAD %s
|
||||
// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
|
||||
// RUN: --target=aarch64-linux-android -pthread \
|
||||
// RUN: --sysroot=%S/Inputs/basic_android_tree/sysroot \
|
||||
// RUN: | FileCheck --check-prefix=CHECK-ANDROID-PTHREAD %s
|
||||
// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
|
||||
// RUN: --target=arm64-linux-android -pthread \
|
||||
// RUN: --sysroot=%S/Inputs/basic_android_tree/sysroot \
|
||||
// RUN: | FileCheck --check-prefix=CHECK-ANDROID-PTHREAD %s
|
||||
// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
|
||||
// RUN: --target=mipsel-linux-android -pthread \
|
||||
// RUN: --sysroot=%S/Inputs/basic_android_tree/sysroot \
|
||||
// RUN: | FileCheck --check-prefix=CHECK-ANDROID-PTHREAD %s
|
||||
// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
|
||||
// RUN: --target=mips64el-linux-android -pthread \
|
||||
// RUN: --sysroot=%S/Inputs/basic_android_tree/sysroot \
|
||||
// RUN: | FileCheck --check-prefix=CHECK-ANDROID-PTHREAD %s
|
||||
// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
|
||||
// RUN: --target=i686-linux-android -pthread \
|
||||
// RUN: --sysroot=%S/Inputs/basic_android_tree/sysroot \
|
||||
// RUN: | FileCheck --check-prefix=CHECK-ANDROID-PTHREAD %s
|
||||
// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
|
||||
// RUN: --target=x86_64-linux-android -pthread \
|
||||
// RUN: --sysroot=%S/Inputs/basic_android_tree/sysroot \
|
||||
// RUN: | FileCheck --check-prefix=CHECK-ANDROID-PTHREAD %s
|
||||
// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
|
||||
// RUN: --target=arm-linux-androideabi -pthread \
|
||||
// RUN: --sysroot=%S/Inputs/basic_android_tree/sysroot \
|
||||
// RUN: -shared \
|
||||
// RUN: | FileCheck --check-prefix=CHECK-ANDROID-PTHREAD %s
|
||||
// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
|
||||
// RUN: --target=arm-linux-android -pthread \
|
||||
// RUN: --sysroot=%S/Inputs/basic_android_tree/sysroot \
|
||||
// RUN: -shared \
|
||||
// RUN: | FileCheck --check-prefix=CHECK-ANDROID-PTHREAD %s
|
||||
// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
|
||||
// RUN: --target=aarch64-linux-android -pthread \
|
||||
// RUN: --sysroot=%S/Inputs/basic_android_tree/sysroot \
|
||||
// RUN: -shared \
|
||||
// RUN: | FileCheck --check-prefix=CHECK-ANDROID-PTHREAD %s
|
||||
// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
|
||||
// RUN: --target=arm64-linux-android -pthread \
|
||||
// RUN: --sysroot=%S/Inputs/basic_android_tree/sysroot \
|
||||
// RUN: -shared \
|
||||
// RUN: | FileCheck --check-prefix=CHECK-ANDROID-PTHREAD %s
|
||||
// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
|
||||
// RUN: --target=mipsel-linux-android -pthread \
|
||||
// RUN: --sysroot=%S/Inputs/basic_android_tree/sysroot \
|
||||
// RUN: -shared \
|
||||
// RUN: | FileCheck --check-prefix=CHECK-ANDROID-PTHREAD %s
|
||||
// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
|
||||
// RUN: --target=mips64el-linux-android -pthread \
|
||||
// RUN: --sysroot=%S/Inputs/basic_android_tree/sysroot \
|
||||
// RUN: -shared \
|
||||
// RUN: | FileCheck --check-prefix=CHECK-ANDROID-PTHREAD %s
|
||||
// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
|
||||
// RUN: --target=i686-linux-android -pthread \
|
||||
// RUN: --sysroot=%S/Inputs/basic_android_tree/sysroot \
|
||||
// RUN: -shared \
|
||||
// RUN: | FileCheck --check-prefix=CHECK-ANDROID-PTHREAD %s
|
||||
// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
|
||||
// RUN: --target=x86_64-linux-android -pthread \
|
||||
// RUN: --sysroot=%S/Inputs/basic_android_tree/sysroot \
|
||||
// RUN: -shared \
|
||||
// RUN: | FileCheck --check-prefix=CHECK-ANDROID-PTHREAD %s
|
||||
// CHECK-ANDROID-PTHREAD-NOT: -lpthread
|
||||
//
|
||||
// Check linker invocation on Debian 6 MIPS 32/64-bit.
|
||||
// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
|
||||
// RUN: --target=mipsel-linux-gnu \
|
||||
|
|
Loading…
Reference in New Issue