AVR: Add predefined version AVR and emit TLS globals as regular ones (#3420)

The AVR target on LLVM and AVR-GCC does not have support for TLS, so
it is necessary to emit global variables as NotThreadLocal.
This commit is contained in:
Ernesto Castellotti 2020-05-08 22:47:10 +02:00 committed by GitHub
parent 920fe2cff7
commit c40bbbc320
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 21 additions and 3 deletions

View file

@ -1755,10 +1755,11 @@ 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.
// No TLS support for WebAssembly and AVR; spare users from having to add
// __gshared everywhere.
const auto arch = global.params.targetTriple->getArch();
if (arch == llvm::Triple::wasm32 || arch == llvm::Triple::wasm64)
if (arch == llvm::Triple::wasm32 || arch == llvm::Triple::wasm64 ||
arch == llvm::Triple::avr)
isThreadLocal = false;
llvm::GlobalVariable *existing =