Skip to content

Commit

Permalink
cg: Emit external weak linakge for global variables.
Browse files Browse the repository at this point in the history
  • Loading branch information
Jezurko authored and xlauko committed Oct 7, 2024
1 parent c1830ac commit 0a01243
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions lib/vast/Dialect/Core/Linkage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,13 @@ namespace vast::core {
return GlobalLinkageKind::ExternalWeakLinkage;
}
}
if (const auto *var = llvm::dyn_cast< clang::VarDecl >(decl)) {
if (!var->hasDefinition() && var->isExternallyVisible()
&& (var->hasAttr< clang::WeakAttr >() || var->isWeakImported()))
{
return core::GlobalLinkageKind::ExternalWeakLinkage;
}
}

if (decl->hasAttr< clang::WeakAttr >()) {
if (is_constant)
Expand Down

0 comments on commit 0a01243

Please sign in to comment.