aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/LTO/LTO.cpp
diff options
context:
space:
mode:
authorJordan Rupprecht <rupprecht@google.com>2022-10-10 11:40:45 -0700
committerJordan Rupprecht <rupprecht@google.com>2022-10-10 11:40:45 -0700
commitfb27fd5f88b0fc72cc7ffc49f132bda7da9c4d2c (patch)
tree0f1321c308b844af13570d210ac700118ee3b9c0 /llvm/lib/LTO/LTO.cpp
parent438e59182b0c2e44c263f5bacc1add0e514354f8 (diff)
downloadllvm-fb27fd5f88b0fc72cc7ffc49f132bda7da9c4d2c.zip
llvm-fb27fd5f88b0fc72cc7ffc49f132bda7da9c4d2c.tar.gz
llvm-fb27fd5f88b0fc72cc7ffc49f132bda7da9c4d2c.tar.bz2
Revert "[LTO] Make local linkage GlobalValue in non-prevailing COMDAT available_externally"
This reverts commit 4fbe33593c8132fdc48647c06f4d1455bfff1c88. It causes linking errors, with details provided internally. (Hopefully the author/reviewers will be able to upstream the internal repro).
Diffstat (limited to 'llvm/lib/LTO/LTO.cpp')
-rw-r--r--llvm/lib/LTO/LTO.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/llvm/lib/LTO/LTO.cpp b/llvm/lib/LTO/LTO.cpp
index 0ce8519..10ca98f 100644
--- a/llvm/lib/LTO/LTO.cpp
+++ b/llvm/lib/LTO/LTO.cpp
@@ -696,11 +696,11 @@ handleNonPrevailingComdat(GlobalValue &GV,
if (!NonPrevailingComdats.count(C))
return;
- // Additionally need to drop all global values from the comdat to
- // available_externally, to satisfy the COMDAT requirement that all members
- // are discarded as a unit. The non-local linkage global values avoid
- // duplicate definition linker errors.
- GV.setLinkage(GlobalValue::AvailableExternallyLinkage);
+ // Additionally need to drop externally visible global values from the comdat
+ // to available_externally, so that there aren't multiply defined linker
+ // errors.
+ if (!GV.hasLocalLinkage())
+ GV.setLinkage(GlobalValue::AvailableExternallyLinkage);
if (auto GO = dyn_cast<GlobalObject>(&GV))
GO->setComdat(nullptr);