Skip to content

Commit e3616b9

Browse files
artemcmAnthonyLatsis
authored andcommitted
[clang] Fix missing target info specifier on Global Variable linkage computation
A previous change (#10555) added support for querying 'isWeakImported' to be parameterized on the enclosing target version to match 'CheckAvailability' and 'getAvailability'. We missed passing in this parameter in the Clang module code-gen when querying linkage for a global variable. This change adds the missing parameter and removes the default parameter from the query in order to avoid this kind of bug in the future. Resolves rdar://154677999 (cherry picked from commit 69d0b90.) This change barely missed the `stable/21.x` cutoff; we only just realized we're missing it.)
1 parent 8e0781c commit e3616b9

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

clang/lib/CodeGen/CodeGenModule.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2989,7 +2989,7 @@ void CodeGenModule::SetInternalFunctionAttributes(GlobalDecl GD,
29892989
}
29902990

29912991
static void setLinkageForGV(llvm::GlobalValue *GV, const NamedDecl *ND,
2992-
VersionTuple EnclosingVersion = VersionTuple()) {
2992+
VersionTuple EnclosingVersion) {
29932993
// Set linkage and visibility in case we never see a definition.
29942994
LinkageInfo LV = ND->getLinkageAndVisibility();
29952995
// Don't set internal linkage on declarations.
@@ -5284,7 +5284,7 @@ CodeGenModule::GetOrCreateLLVMGlobal(StringRef MangledName, llvm::Type *Ty,
52845284

52855285
GV->setAlignment(getContext().getDeclAlign(D).getAsAlign());
52865286

5287-
setLinkageForGV(GV, D);
5287+
setLinkageForGV(GV, D, Target.getPlatformMinVersion());
52885288

52895289
if (D->getTLSKind()) {
52905290
if (D->getTLSKind() == VarDecl::TLS_Dynamic)

0 commit comments

Comments
 (0)