[Openmp-commits] [PATCH] D117231: [Libomptarget] Fix multiply defined symbol during linking

Joseph Huber via Phabricator via Openmp-commits openmp-commits at lists.llvm.org
Thu Jan 13 08:41:10 PST 2022

jhuber6 created this revision.
jhuber6 added reviewers: jdoerfert, JonChesterfield.
jhuber6 requested review of this revision.
Herald added subscribers: openmp-commits, sstefan1.
Herald added a project: OpenMP.

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

  rG LLVM Github Monorepo



Index: openmp/libomptarget/DeviceRTL/src/Configuration.cpp
--- openmp/libomptarget/DeviceRTL/src/Configuration.cpp
+++ openmp/libomptarget/DeviceRTL/src/Configuration.cpp
@@ -24,7 +24,7 @@
 // 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;

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D117231.399684.patch
Type: text/x-patch
Size: 580 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/openmp-commits/attachments/20220113/e6e7ef99/attachment-0001.bin>

More information about the Openmp-commits mailing list