From fb27fd5f88b0fc72cc7ffc49f132bda7da9c4d2c Mon Sep 17 00:00:00 2001 From: Jordan Rupprecht Date: Mon, 10 Oct 2022 11:40:45 -0700 Subject: 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). --- llvm/lib/LTO/LTO.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'llvm/lib/LTO/LTO.cpp') 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(&GV)) GO->setComdat(nullptr); -- cgit v1.1