]> granicus.if.org Git - clang/commitdiff
[CodeGen] Treat auto-generated __dso_handle symbol as HiddenVisibility
authorReid Kleckner <rnk@google.com>
Mon, 13 Feb 2017 18:49:21 +0000 (18:49 +0000)
committerReid Kleckner <rnk@google.com>
Mon, 13 Feb 2017 18:49:21 +0000 (18:49 +0000)
Fixes https://bugs.llvm.org/show_bug.cgi?id=31932

Based on a patch by Roland McGrath

Reviewed By: phosek

Differential Revision: https://reviews.llvm.org/D29843

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@294978 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/ItaniumCXXABI.cpp
test/CodeGenCXX/global-init.cpp
test/OpenMP/threadprivate_codegen.cpp

index 74aabeb253fe027a38bb79555a7037ff0fc208b0..6a5fd1916b9ecaeaf185a8600fff7c330699fe1c 100644 (file)
@@ -2162,7 +2162,9 @@ static void emitGlobalDtorWithCXAAtExit(CodeGenFunction &CGF,
 
   // Create a variable that binds the atexit to this shared object.
   llvm::Constant *handle =
-    CGF.CGM.CreateRuntimeVariable(CGF.Int8Ty, "__dso_handle");
+      CGF.CGM.CreateRuntimeVariable(CGF.Int8Ty, "__dso_handle");
+  auto *GV = cast<llvm::GlobalValue>(handle->stripPointerCasts());
+  GV->setVisibility(llvm::GlobalValue::HiddenVisibility);
 
   llvm::Value *args[] = {
     llvm::ConstantExpr::getBitCast(dtor, dtorTy),
index 291b43cac0a00f4e4e58ae52f99359b30b5062aa..f96e6032ff5808e73a3782571e9b205e172ced74 100644 (file)
@@ -15,7 +15,7 @@ struct C { void *field; };
 
 struct D { ~D(); };
 
-// CHECK: @__dso_handle = external global i8
+// CHECK: @__dso_handle = external hidden global i8
 // CHECK: @c = global %struct.C zeroinitializer, align 8
 
 // PR6205: The casts should not require global initializers
index 318415761ac7786afafe1ddcf4676d6ada4a06fd..3785b70c19baeb9aa234ce5f64fafbcfd00f664f 100644 (file)
@@ -176,7 +176,7 @@ struct S5 {
 // CHECK-TLS-DAG:  [[ST_S4_ST:@.+]] = linkonce_odr thread_local global %struct.S4 zeroinitializer
 // CHECK-TLS-DAG:  [[ST_S4_ST_GUARD:@_ZGVN2STI2S4E2stE]] = linkonce_odr thread_local global i64 0
 // CHECK-TLS-DAG:  @__tls_guard = internal thread_local global i8 0
-// CHECK-TLS-DAG:  @__dso_handle = external global i8
+// CHECK-TLS-DAG:  @__dso_handle = external hidden global i8
 // CHECK-TLS-DAG:  [[GS1_TLS_INIT:@_ZTHL3gs1]] = internal alias void (), void ()* @__tls_init
 // CHECK-TLS-DAG:  [[ARR_X_TLS_INIT:@_ZTH5arr_x]] = alias void (), void ()* @__tls_init