From cdb42a4cc4239c0b592fc82021c945ce02ebe5cc Mon Sep 17 00:00:00 2001 From: Sriraman Tallam Date: Thu, 11 Mar 2021 20:05:37 -0800 Subject: Disable unique linkage suffixes ifor global vars until demanglers can be fixed. D96109 added support for unique internal linkage names for both internal linkage functions and global variables. There was a lot of discussion on how to get the demangling right for functions but I completely missed the point that demanglers do not support suffixes for global vars. For example: $ c++filt _ZL3foo foo $ c++filt _ZL3foo.uniq.123 _ZL3foo.uniq.123 The demangling for functions works as expected. I am not sure of the impact of this. I don't understand how debuggers and other tools depend on the correctness of global variable demangling so I am pre-emptively disabling it until we can get the demangling support added. Importantly, uniquefying global variables is not needed right now as we do not do profile attribution to global vars based on sampling. It was added for completeness and so this feature is not exactly missed. Differential Revision: https://reviews.llvm.org/D98392 --- clang/lib/CodeGen/CodeGenModule.cpp | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) (limited to 'clang/lib/CodeGen/CodeGenModule.cpp') diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp index 4bf339786d42..250946bd56dd 100644 --- a/clang/lib/CodeGen/CodeGenModule.cpp +++ b/clang/lib/CodeGen/CodeGenModule.cpp @@ -1175,18 +1175,13 @@ static void AppendTargetMangling(const CodeGenModule &CGM, } } -// Returns true if GD is a function/var decl with internal linkage and +// Returns true if GD is a function decl with internal linkage and // needs a unique suffix after the mangled name. static bool isUniqueInternalLinkageDecl(GlobalDecl GD, CodeGenModule &CGM) { const Decl *D = GD.getDecl(); - if (!CGM.getModuleNameHash().empty() && - ((isa(D) && - CGM.getFunctionLinkage(GD) == llvm::GlobalValue::InternalLinkage) || - (isa(D) && CGM.getContext().GetGVALinkageForVariable( - cast(D)) == GVA_Internal))) - return true; - return false; + return !CGM.getModuleNameHash().empty() && isa(D) && + (CGM.getFunctionLinkage(GD) == llvm::GlobalValue::InternalLinkage); } static std::string getMangledNameImpl(CodeGenModule &CGM, GlobalDecl GD, -- cgit v1.2.3