r294978 - [CodeGen] Treat auto-generated __dso_handle symbol as HiddenVisibility

Reid Kleckner via cfe-commits cfe-commits at lists.llvm.org
Mon Feb 13 10:49:22 PST 2017


Author: rnk
Date: Mon Feb 13 12:49:21 2017
New Revision: 294978

URL: http://llvm.org/viewvc/llvm-project?rev=294978&view=rev
Log:
[CodeGen] Treat auto-generated __dso_handle symbol as HiddenVisibility

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

Modified:
    cfe/trunk/lib/CodeGen/ItaniumCXXABI.cpp
    cfe/trunk/test/CodeGenCXX/global-init.cpp
    cfe/trunk/test/OpenMP/threadprivate_codegen.cpp

Modified: cfe/trunk/lib/CodeGen/ItaniumCXXABI.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/ItaniumCXXABI.cpp?rev=294978&r1=294977&r2=294978&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/ItaniumCXXABI.cpp (original)
+++ cfe/trunk/lib/CodeGen/ItaniumCXXABI.cpp Mon Feb 13 12:49:21 2017
@@ -2162,7 +2162,9 @@ static void emitGlobalDtorWithCXAAtExit(
 
   // 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),

Modified: cfe/trunk/test/CodeGenCXX/global-init.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/global-init.cpp?rev=294978&r1=294977&r2=294978&view=diff
==============================================================================
--- cfe/trunk/test/CodeGenCXX/global-init.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/global-init.cpp Mon Feb 13 12:49:21 2017
@@ -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

Modified: cfe/trunk/test/OpenMP/threadprivate_codegen.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/OpenMP/threadprivate_codegen.cpp?rev=294978&r1=294977&r2=294978&view=diff
==============================================================================
--- cfe/trunk/test/OpenMP/threadprivate_codegen.cpp (original)
+++ cfe/trunk/test/OpenMP/threadprivate_codegen.cpp Mon Feb 13 12:49:21 2017
@@ -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
 




More information about the cfe-commits mailing list