Summary:
This eliminates a linker error the user might otherwise see about how
using the 'atomics' feature requires --shared-memory.
Reviewers: sbc100, aheejin
Subscribers: dschuff, jgravelle-google, sunfish, jfb, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D59721
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@356817
91177308-0d34-0410-b5e6-
96231b3b80d8
if (ToolChain.ShouldLinkCXXStdlib(Args))
ToolChain.AddCXXStdlibLibArgs(Args, CmdArgs);
- if (Args.hasArg(options::OPT_pthread))
+ if (Args.hasArg(options::OPT_pthread)) {
CmdArgs.push_back("-lpthread");
+ CmdArgs.push_back("--shared-memory");
+ }
CmdArgs.push_back("-lc");
AddRunTimeLibs(ToolChain, ToolChain.getDriver(), CmdArgs, Args);
// Thread-related command line tests.
-// '-pthread' sets '-target-feature +atomics'
+// '-pthread' sets '-target-feature +atomics' and '--shared-memory'
// RUN: %clang -### -no-canonical-prefixes -target wasm32-unknown-unknown --sysroot=/foo %s -pthread 2>&1 | FileCheck -check-prefix=PTHREAD %s
// PTHREAD: clang{{.*}}" "-cc1" {{.*}} "-target-feature" "+atomics"
+// PTHREAD: wasm-ld{{.*}}" "-lpthread" "--shared-memory"
// '-pthread' not allowed with '-mno-atomics'
// RUN: %clang -### -no-canonical-prefixes -target wasm32-unknown-unknown --sysroot=/foo %s -pthread -mno-atomics 2>&1 | FileCheck -check-prefix=PTHREAD_NO_ATOMICS %s