[PATCH] D44805: Set dso_local on __ImageBase

Rafael Avila de Espindola via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Mar 22 13:50:25 PDT 2018


espindola created this revision.
espindola added reviewers: echristo, rnk.

https://reviews.llvm.org/D44805

Files:
  lib/CodeGen/MicrosoftCXXABI.cpp
  test/CodeGenCXX/dllexport.cpp


Index: test/CodeGenCXX/dllexport.cpp
===================================================================
--- test/CodeGenCXX/dllexport.cpp
+++ test/CodeGenCXX/dllexport.cpp
@@ -43,6 +43,8 @@
 
 // GNU-DAG: @_ZTVN10__cxxabiv117__class_type_infoE = external dso_local global
 
+// M64-DAG: @__ImageBase = external dso_local constant i8
+
 // dllexport implies a definition.
 // MSC-DAG: @"?GlobalDef@@3HA" = dso_local dllexport global i32 0, align 4
 // GNU-DAG: @GlobalDef            = dso_local dllexport global i32 0, align 4
Index: lib/CodeGen/MicrosoftCXXABI.cpp
===================================================================
--- lib/CodeGen/MicrosoftCXXABI.cpp
+++ lib/CodeGen/MicrosoftCXXABI.cpp
@@ -523,10 +523,12 @@
     if (llvm::GlobalVariable *GV = CGM.getModule().getNamedGlobal(Name))
       return GV;
 
-    return new llvm::GlobalVariable(CGM.getModule(), CGM.Int8Ty,
-                                    /*isConstant=*/true,
-                                    llvm::GlobalValue::ExternalLinkage,
-                                    /*Initializer=*/nullptr, Name);
+    auto *GV = new llvm::GlobalVariable(CGM.getModule(), CGM.Int8Ty,
+                                        /*isConstant=*/true,
+                                        llvm::GlobalValue::ExternalLinkage,
+                                        /*Initializer=*/nullptr, Name);
+    CGM.setDSOLocal(GV);
+    return GV;
   }
 
   llvm::Constant *getImageRelativeConstant(llvm::Constant *PtrVal) {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D44805.139505.patch
Type: text/x-patch
Size: 1489 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20180322/f3563e9b/attachment.bin>


More information about the cfe-commits mailing list