diff --git a/include/llvm/Target/Mangler.h b/include/llvm/Target/Mangler.h index 2b7d192e1e2..a9f3576559d 100644 --- a/include/llvm/Target/Mangler.h +++ b/include/llvm/Target/Mangler.h @@ -25,6 +25,7 @@ class GlobalValue; template class SmallVectorImpl; class MCContext; class MCSymbol; +class TargetData; class Mangler { public: @@ -36,6 +37,7 @@ public: private: MCContext &Context; + const TargetData &TD; /// AnonGlobalIDs - We need to give global values the same name every time /// they are mangled. This keeps track of the number we give to anonymous @@ -48,7 +50,8 @@ private: unsigned NextAnonGlobalID; public: - Mangler(MCContext &context) : Context(context), NextAnonGlobalID(1) {} + Mangler(MCContext &context, const TargetData &td) + : Context(context), TD(td), NextAnonGlobalID(1) {} /// getSymbol - Return the MCSymbol for the specified global value. This /// symbol is the main label that is the address of the global. diff --git a/lib/CodeGen/AsmPrinter/AsmPrinter.cpp b/lib/CodeGen/AsmPrinter/AsmPrinter.cpp index 0a283931eda..68da74581b9 100644 --- a/lib/CodeGen/AsmPrinter/AsmPrinter.cpp +++ b/lib/CodeGen/AsmPrinter/AsmPrinter.cpp @@ -104,7 +104,7 @@ bool AsmPrinter::doInitialization(Module &M) { const_cast(getObjFileLowering()) .Initialize(OutContext, TM); - Mang = new Mangler(OutContext); + Mang = new Mangler(OutContext, *TM.getTargetData()); // Allow the target to emit any magic that it wants at the start of the file. EmitStartOfAsmFile(M); diff --git a/lib/CodeGen/ELFWriter.cpp b/lib/CodeGen/ELFWriter.cpp index d73581a3377..eda167cb54a 100644 --- a/lib/CodeGen/ELFWriter.cpp +++ b/lib/CodeGen/ELFWriter.cpp @@ -109,7 +109,7 @@ bool ELFWriter::doInitialization(Module &M) { // Initialize TargetLoweringObjectFile. const_cast(TLOF).Initialize(OutContext, TM); - Mang = new Mangler(OutContext); + Mang = new Mangler(OutContext, *TM.getTargetData()); // ELF Header // ---------- diff --git a/lib/Target/CBackend/CBackend.cpp b/lib/Target/CBackend/CBackend.cpp index 6b9ae4fc0d1..b1ba0d2b9fd 100644 --- a/lib/Target/CBackend/CBackend.cpp +++ b/lib/Target/CBackend/CBackend.cpp @@ -1734,7 +1734,7 @@ bool CWriter::doInitialization(Module &M) { #endif TAsm = new CBEMCAsmInfo(); TCtx = new MCContext(*TAsm); - Mang = new Mangler(*TCtx); + Mang = new Mangler(*TCtx, *TD); // Keep track of which functions are static ctors/dtors so they can have // an attribute added to their prototypes. diff --git a/tools/lto/LTOCodeGenerator.cpp b/tools/lto/LTOCodeGenerator.cpp index acce071ba5d..15753d350ff 100644 --- a/tools/lto/LTOCodeGenerator.cpp +++ b/tools/lto/LTOCodeGenerator.cpp @@ -322,7 +322,7 @@ void LTOCodeGenerator::applyScopeRestrictions() { // mark which symbols can not be internalized if (!_mustPreserveSymbols.empty()) { MCContext Context(*_target->getMCAsmInfo()); - Mangler mangler(Context); + Mangler mangler(Context, *_target->getTargetData()); std::vector mustPreserveList; for (Module::iterator f = mergedModule->begin(), e = mergedModule->end(); f != e; ++f) { diff --git a/tools/lto/LTOModule.cpp b/tools/lto/LTOModule.cpp index 4617d93200f..08576abac45 100644 --- a/tools/lto/LTOModule.cpp +++ b/tools/lto/LTOModule.cpp @@ -439,7 +439,7 @@ void LTOModule::lazyParseSymbols() // Use mangler to add GlobalPrefix to names to match linker names. MCContext Context(*_target->getMCAsmInfo()); - Mangler mangler(Context); + Mangler mangler(Context, *_target->getTargetData()); // add functions for (Module::iterator f = _module->begin(); f != _module->end(); ++f) {