diff options
Diffstat (limited to 'lib/Target/CBackend/CBackend.cpp')
-rw-r--r-- | lib/Target/CBackend/CBackend.cpp | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/lib/Target/CBackend/CBackend.cpp b/lib/Target/CBackend/CBackend.cpp index 1246621608..fcfda5d15a 100644 --- a/lib/Target/CBackend/CBackend.cpp +++ b/lib/Target/CBackend/CBackend.cpp @@ -156,8 +156,8 @@ static string makeNameProper(string x) { string CWriter::getValueName(const Value *V) { if (V->hasName()) { // Print out the label if it exists... if (isa<GlobalValue>(V) && // Do not mangle globals... - cast<GlobalValue>(V)->hasExternalLinkage() && // Unless it's internal or - !MangledGlobals.count(V)) // Unless the name would collide if we don't + cast<GlobalValue>(V)->hasExternalLinkage())// && // Unless it's internal or + //!MangledGlobals.count(V)) // Unless the name would collide if we don't return makeNameProper(V->getName()); return "l" + utostr(V->getType()->getUniqueID()) + "_" + @@ -567,8 +567,12 @@ void CWriter::printModule(Module *M) { Out << "\n/* Function Declarations */\n"; needsMalloc = true; for (Module::iterator I = M->begin(), E = M->end(); I != E; ++I) { - printFunctionSignature(I, true); - Out << ";\n"; + // If the function is external and the name collides don't print it. + // Sometimes the bytecode likes to have multiple "declerations" for external functions + if (I->hasInternalLinkage() || !MangledGlobals.count(I)){ + printFunctionSignature(I, true); + Out << ";\n"; + } } } |