mirror of
https://github.com/ldc-developers/ldc.git
synced 2025-05-02 16:11:08 +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::StringRef mangledName,
|
||||
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 =
|
||||
module.getGlobalVariable(mangledName, /*AllowInternal=*/true);
|
||||
if (existing) {
|
||||
|
@ -1785,9 +1791,8 @@ llvm::GlobalVariable *declareGlobal(const Loc &loc, llvm::Module &module,
|
|||
// command line.
|
||||
const auto tlsModel =
|
||||
isThreadLocal
|
||||
? (global.params.targetTriple->getArch() == llvm::Triple::ppc
|
||||
? llvm::GlobalVariable::LocalExecTLSModel
|
||||
: clThreadModel.getValue())
|
||||
? (arch == llvm::Triple::ppc ? llvm::GlobalVariable::LocalExecTLSModel
|
||||
: clThreadModel.getValue())
|
||||
: llvm::GlobalVariable::NotThreadLocal;
|
||||
|
||||
return new llvm::GlobalVariable(module, type, isConstant,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue