From: Rafael Espindola Date: Fri, 23 Mar 2018 01:36:23 +0000 (+0000) Subject: Bring r328238 back with a fix. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=bb7269ae797f282e27e47eb4ebedfa6abe826e9e;p=clang Bring r328238 back with a fix. The issues was that we were setting hidden visibility if, when processing a hidden class, we found out that we needed to emit a reference to a vtable provided by the standard library. Original message: Set dso_local on vtables. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@328288 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/CodeGen/ItaniumCXXABI.cpp b/lib/CodeGen/ItaniumCXXABI.cpp index debdf99b42..20021808f7 100644 --- a/lib/CodeGen/ItaniumCXXABI.cpp +++ b/lib/CodeGen/ItaniumCXXABI.cpp @@ -2948,6 +2948,7 @@ void ItaniumRTTIBuilder::BuildVTablePointer(const Type *Ty) { llvm::Constant *VTable = CGM.getModule().getOrInsertGlobal(VTableName, CGM.Int8PtrTy); + CGM.setDSOLocal(cast(VTable->stripPointerCasts())); llvm::Type *PtrDiffTy = CGM.getTypes().ConvertType(CGM.getContext().getPointerDiffType()); diff --git a/test/CodeGenCXX/dllexport.cpp b/test/CodeGenCXX/dllexport.cpp index d7a7be8170..b867662e09 100644 --- a/test/CodeGenCXX/dllexport.cpp +++ b/test/CodeGenCXX/dllexport.cpp @@ -43,6 +43,8 @@ __declspec(dllexport) extern int ExternGlobalDecl; // M64-DAG: @__ImageBase = external dso_local constant i8 +// GNU-DAG: @_ZTVN10__cxxabiv117__class_type_infoE = external dso_local global + // 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