Skip to content

Commit 0cf4cb4

Browse files
committed
Revert "[clang] Fix FIXME in dynamic initializer emission, NFCI"
This reverts commit 601645c. This change wasn't NFC in practice, see #110232 for details.
1 parent cc3cc5e commit 0cf4cb4

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

clang/lib/CodeGen/CGDeclCXX.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -640,13 +640,13 @@ CodeGenModule::EmitCXXGlobalVarDeclInitFunc(const VarDecl *D,
640640
addUsedGlobal(COMDATKey);
641641
}
642642

643-
// If comdats are in use and supported, place the initializer function into
644-
// the comdat group of the global. In the MS ABI, initializers are mangled
645-
// and have their own comdat, so we don't include them in the group for
646-
// consistency with MSVC.
643+
// If we used a COMDAT key for the global ctor, the init function can be
644+
// discarded if the global ctor entry is discarded.
645+
// FIXME: Do we need to restrict this to ELF and Wasm?
647646
llvm::Comdat *C = Addr->getComdat();
648-
if (COMDATKey && C && getTriple().supportsCOMDAT() &&
649-
!getTarget().getCXXABI().isMicrosoft()) {
647+
if (COMDATKey && C &&
648+
(getTarget().getTriple().isOSBinFormatELF() ||
649+
getTarget().getTriple().isOSBinFormatWasm())) {
650650
Fn->setComdat(C);
651651
}
652652
} else {

0 commit comments

Comments
 (0)