[PATCH] D156955: [OpenMP] Fix the linkage for kernel environment global variable
Shilei Tian via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Aug 2 17:29:37 PDT 2023
tianshilei1992 created this revision.
tianshilei1992 added reviewers: jdoerfert, jhuber6.
Herald added subscribers: sunshaoce, guansong, hiraditya, yaxunl.
Herald added a project: All.
tianshilei1992 requested review of this revision.
Herald added subscribers: llvm-commits, jplehr, sstefan1.
Herald added a project: LLVM.
This patch fixes the issue that multiple definition of kernel environment global
variables can occur because of wrong linkage.
Fixes #64284.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D156955
Files:
llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp
Index: llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp
===================================================================
--- llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp
+++ llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp
@@ -4040,7 +4040,7 @@
ConstantStruct::get(DynamicEnvironment, {DebugIndentionLevelVal});
Constant *DynamicEnvironmentGV = new GlobalVariable(
M, DynamicEnvironment, /* IsConstant */ false,
- GlobalValue::InternalLinkage, DynamicEnvironmentInitializer,
+ GlobalValue::WeakODRLinkage, DynamicEnvironmentInitializer,
DynamicEnvironmentName,
/* InsertBefore */ nullptr, llvm::GlobalValue::NotThreadLocal,
DL.getDefaultGlobalsAddressSpace());
@@ -4062,7 +4062,7 @@
});
Twine KernelEnvironmentName = KernelName + "_kernel_environment";
Constant *KernelEnvironmentGV = new GlobalVariable(
- M, KernelEnvironment, /* IsConstant */ true, GlobalValue::ExternalLinkage,
+ M, KernelEnvironment, /* IsConstant */ true, GlobalValue::WeakODRLinkage,
KernelEnvironmentInitializer, KernelEnvironmentName,
/* InsertBefore */ nullptr, llvm::GlobalValue::NotThreadLocal,
DL.getDefaultGlobalsAddressSpace());
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D156955.546654.patch
Type: text/x-patch
Size: 1208 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230803/fd877358/attachment.bin>
More information about the llvm-commits
mailing list