[Openmp-commits] [openmp] 4746e38 - [Libomptarget] Fix multiply defined symbol during linking
Joseph Huber via Openmp-commits
openmp-commits at lists.llvm.org
Thu Jan 13 08:57:41 PST 2022
Author: Joseph Huber
Date: 2022-01-13T11:57:33-05:00
New Revision: 4746e38f67a98344011e0c615a9b4c7c2f223d4e
URL: https://github.com/llvm/llvm-project/commit/4746e38f67a98344011e0c615a9b4c7c2f223d4e
DIFF: https://github.com/llvm/llvm-project/commit/4746e38f67a98344011e0c615a9b4c7c2f223d4e.diff
LOG: [Libomptarget] Fix multiply defined symbol during linking
This patch adds the `weak` identifier to the openmp device environment
variable. The changes introduced in https://reviews.llvm.org/D117211
result in multiply defined symbols. Because the symbol is potentially
included multiple times for each offloading file we will get symbol
colisions, and because it needs to have external visiblity it should be
weak.
Reviewed By: JonChesterfield
Differential Revision: https://reviews.llvm.org/D117231
Added:
Modified:
openmp/libomptarget/DeviceRTL/src/Configuration.cpp
openmp/libomptarget/deviceRTLs/amdgcn/src/target_impl.h
Removed:
################################################################################
diff --git a/openmp/libomptarget/DeviceRTL/src/Configuration.cpp b/openmp/libomptarget/DeviceRTL/src/Configuration.cpp
index ae819a9bb93d0..ee8a98d703618 100644
--- a/openmp/libomptarget/DeviceRTL/src/Configuration.cpp
+++ b/openmp/libomptarget/DeviceRTL/src/Configuration.cpp
@@ -24,7 +24,7 @@ extern uint32_t __omp_rtl_debug_kind; // defined by CGOpenMPRuntimeGPU
// TODO: We want to change the name as soon as the old runtime is gone.
DeviceEnvironmentTy CONSTANT(omptarget_device_environment)
- __attribute__((used, retain));
+ __attribute__((used, retain, weak));
uint32_t config::getDebugKind() {
return __omp_rtl_debug_kind & omptarget_device_environment.DebugKind;
diff --git a/openmp/libomptarget/deviceRTLs/amdgcn/src/target_impl.h b/openmp/libomptarget/deviceRTLs/amdgcn/src/target_impl.h
index 2fe1ebd54673d..1303258f17494 100644
--- a/openmp/libomptarget/deviceRTLs/amdgcn/src/target_impl.h
+++ b/openmp/libomptarget/deviceRTLs/amdgcn/src/target_impl.h
@@ -32,6 +32,7 @@ typedef uint64_t __kmpc_impl_lanemask_t;
#define ALIGN(N) __attribute__((aligned(N)))
#define PLUGIN_ACCESSIBLE \
__attribute__((used)) /* Don't discard values the plugin reads */ \
+ __attribute__((weak)) /* We may have multiple definitions */ \
__attribute__((retain)) /* Also needed to keep values alive */ \
__attribute__((visibility("default"))) /* Access via SHT_HASH */ \
__attribute__((section(".data"))) /* Not .bss, can write before load */
More information about the Openmp-commits
mailing list