diff options
author | Fangrui Song <i@maskray.me> | 2022-10-19 11:24:12 -0700 |
---|---|---|
committer | Fangrui Song <i@maskray.me> | 2022-10-19 11:24:12 -0700 |
commit | c80b12d352d5c88cd812bf2707672f11b3010984 (patch) | |
tree | e73388c17462b18982e898282126df7cf686334f /llvm/lib/LTO/LTO.cpp | |
parent | 26eb2c6b42f7cd10b54399e2b7c69a25560e23a0 (diff) | |
download | llvm-c80b12d352d5c88cd812bf2707672f11b3010984.zip llvm-c80b12d352d5c88cd812bf2707672f11b3010984.tar.gz llvm-c80b12d352d5c88cd812bf2707672f11b3010984.tar.bz2 |
Revert D135427 "[LTO] Make local linkage GlobalValue in non-prevailing COMDAT available_externally"
This reverts commit 8ef3fd8d59ba0100bc6e83350ab1e978536aa531.
I mentioned that GlobalAlias was not handled. It turns out GlobalAlias has to be handled in the same patch (as opposed to in a follow-up),
as otherwise clang codegen of C5/D5 constructor/destructor would regress (https://reviews.llvm.org/D135427#3869003).
Diffstat (limited to 'llvm/lib/LTO/LTO.cpp')
-rw-r--r-- | llvm/lib/LTO/LTO.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/llvm/lib/LTO/LTO.cpp b/llvm/lib/LTO/LTO.cpp index dc28b68..286d3ca 100644 --- a/llvm/lib/LTO/LTO.cpp +++ b/llvm/lib/LTO/LTO.cpp @@ -712,11 +712,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); |