summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYaron Keren <yaron.keren@gmail.com>2015-09-03 20:33:29 +0000
committerYaron Keren <yaron.keren@gmail.com>2015-09-03 20:33:29 +0000
commit5bfa1084b17215aad54b21bdd0d1acbce87cf7a6 (patch)
tree005ee5569fb9b45d359f0f27da03fe0d618e69af
parent34812ba258215e598c84b1fdbb110b90ead35b46 (diff)
downloadbcm5719-llvm-5bfa1084b17215aad54b21bdd0d1acbce87cf7a6.tar.gz
bcm5719-llvm-5bfa1084b17215aad54b21bdd0d1acbce87cf7a6.zip
Fix PR23472þ by emitting initialized variable and its guard in the same COMDAT only for ELF objects.
http://llvm.org/pr23472 Reviewed by Reid Kleckner. llvm-svn: 246803
-rw-r--r--clang/lib/CodeGen/ItaniumCXXABI.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/clang/lib/CodeGen/ItaniumCXXABI.cpp b/clang/lib/CodeGen/ItaniumCXXABI.cpp
index 751c4727948..9fa4f06338a 100644
--- a/clang/lib/CodeGen/ItaniumCXXABI.cpp
+++ b/clang/lib/CodeGen/ItaniumCXXABI.cpp
@@ -1823,10 +1823,12 @@ void ItaniumCXXABI::EmitGuardedInit(CodeGenFunction &CGF,
// If the variable is thread-local, so is its guard variable.
guard->setThreadLocalMode(var->getThreadLocalMode());
- // The ABI says: It is suggested that it be emitted in the same COMDAT group
- // as the associated data object
+ // The ABI says: "It is suggested that it be emitted in the same COMDAT
+ // group as the associated data object." In practice, this doesn't work for
+ // non-ELF object formats, so only do it for ELF.
llvm::Comdat *C = var->getComdat();
- if (!D.isLocalVarDecl() && C) {
+ if (!D.isLocalVarDecl() && C &&
+ CGM.getTarget().getTriple().isOSBinFormatELF()) {
guard->setComdat(C);
CGF.CurFn->setComdat(C);
} else if (CGM.supportsCOMDAT() && guard->isWeakForLinker()) {
OpenPOWER on IntegriCloud