mirror of
https://github.com/ldc-developers/ldc.git
synced 2025-05-04 00:55:49 +03:00
WebAssembly: Emit all TLS globals as regular __gshared globals
This commit is contained in:
parent
00a270e76f
commit
0563aedad3
1 changed files with 8 additions and 3 deletions
|
@ -1755,6 +1755,12 @@ llvm::GlobalVariable *declareGlobal(const Loc &loc, llvm::Module &module,
|
||||||
llvm::Type *type,
|
llvm::Type *type,
|
||||||
llvm::StringRef mangledName,
|
llvm::StringRef mangledName,
|
||||||
bool isConstant, bool isThreadLocal) {
|
bool isConstant, bool isThreadLocal) {
|
||||||
|
// No TLS support for WebAssembly; spare users from having to add __gshared
|
||||||
|
// everywhere.
|
||||||
|
const auto arch = global.params.targetTriple->getArch();
|
||||||
|
if (arch == llvm::Triple::wasm32 || arch == llvm::Triple::wasm64)
|
||||||
|
isThreadLocal = false;
|
||||||
|
|
||||||
llvm::GlobalVariable *existing =
|
llvm::GlobalVariable *existing =
|
||||||
module.getGlobalVariable(mangledName, /*AllowInternal=*/true);
|
module.getGlobalVariable(mangledName, /*AllowInternal=*/true);
|
||||||
if (existing) {
|
if (existing) {
|
||||||
|
@ -1785,8 +1791,7 @@ llvm::GlobalVariable *declareGlobal(const Loc &loc, llvm::Module &module,
|
||||||
// command line.
|
// command line.
|
||||||
const auto tlsModel =
|
const auto tlsModel =
|
||||||
isThreadLocal
|
isThreadLocal
|
||||||
? (global.params.targetTriple->getArch() == llvm::Triple::ppc
|
? (arch == llvm::Triple::ppc ? llvm::GlobalVariable::LocalExecTLSModel
|
||||||
? llvm::GlobalVariable::LocalExecTLSModel
|
|
||||||
: clThreadModel.getValue())
|
: clThreadModel.getValue())
|
||||||
: llvm::GlobalVariable::NotThreadLocal;
|
: llvm::GlobalVariable::NotThreadLocal;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue