diff options
| author | Rafael Espindola <rafael.espindola@gmail.com> | 2009-01-15 20:18:42 +0000 |
|---|---|---|
| committer | Rafael Espindola <rafael.espindola@gmail.com> | 2009-01-15 20:18:42 +0000 |
| commit | 6de96a1b5d77b13719760d0143ef48e8670b6e20 (patch) | |
| tree | ab6f61642a2e971790afdd47c806735afb828cdf /llvm/lib/CodeGen | |
| parent | 7ffcf93b2450ca373cdf3147744a029e9b00e095 (diff) | |
| download | bcm5719-llvm-6de96a1b5d77b13719760d0143ef48e8670b6e20.tar.gz bcm5719-llvm-6de96a1b5d77b13719760d0143ef48e8670b6e20.zip | |
Add the private linkage.
llvm-svn: 62279
Diffstat (limited to 'llvm/lib/CodeGen')
| -rw-r--r-- | llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp | 4 | ||||
| -rw-r--r-- | llvm/lib/CodeGen/AsmPrinter/DwarfWriter.cpp | 3 | ||||
| -rw-r--r-- | llvm/lib/CodeGen/ELFWriter.cpp | 5 | ||||
| -rw-r--r-- | llvm/lib/CodeGen/MachOWriter.cpp | 5 | ||||
| -rw-r--r-- | llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp | 2 |
5 files changed, 13 insertions, 6 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp b/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp index 6627543a856..5b665a0c221 100644 --- a/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp +++ b/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp @@ -139,7 +139,7 @@ void AsmPrinter::getAnalysisUsage(AnalysisUsage &AU) const { } bool AsmPrinter::doInitialization(Module &M) { - Mang = new Mangler(M, TAI->getGlobalPrefix()); + Mang = new Mangler(M, TAI->getGlobalPrefix(), TAI->getPrivateGlobalPrefix()); GCModuleInfo *MI = getAnalysisToUpdate<GCModuleInfo>(); assert(MI && "AsmPrinter didn't require GCModuleInfo?"); @@ -199,7 +199,7 @@ bool AsmPrinter::doFinalization(Module &M) { O << "\t.globl\t" << Name << '\n'; else if (I->hasWeakLinkage()) O << TAI->getWeakRefDirective() << Name << '\n'; - else if (!I->hasInternalLinkage()) + else if (!I->hasLocalLinkage()) assert(0 && "Invalid alias linkage"); printVisibility(Name, I->getVisibility()); diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfWriter.cpp b/llvm/lib/CodeGen/AsmPrinter/DwarfWriter.cpp index 09d169b6f33..02f27d181a9 100644 --- a/llvm/lib/CodeGen/AsmPrinter/DwarfWriter.cpp +++ b/llvm/lib/CodeGen/AsmPrinter/DwarfWriter.cpp @@ -3272,7 +3272,8 @@ private: // Externally visible entry into the functions eh frame info. // If the corresponding function is static, this should not be // externally visible. - if (linkage != Function::InternalLinkage) { + if (linkage != Function::InternalLinkage && + linkage != Function::PrivateLinkage) { if (const char *GlobalEHDirective = TAI->getGlobalEHDirective()) O << GlobalEHDirective << EHFrameInfo.FnName << "\n"; } diff --git a/llvm/lib/CodeGen/ELFWriter.cpp b/llvm/lib/CodeGen/ELFWriter.cpp index 5d2fca134e6..b698178d780 100644 --- a/llvm/lib/CodeGen/ELFWriter.cpp +++ b/llvm/lib/CodeGen/ELFWriter.cpp @@ -174,6 +174,8 @@ bool ELFCodeEmitter::finishFunction(MachineFunction &F) { case GlobalValue::WeakLinkage: FnSym.SetBind(ELFWriter::ELFSym::STB_WEAK); break; + case GlobalValue::PrivateLinkage: + assert (0 && "PrivateLinkage should not be in the symbol table."); case GlobalValue::InternalLinkage: FnSym.SetBind(ELFWriter::ELFSym::STB_LOCAL); break; @@ -329,7 +331,8 @@ void ELFWriter::EmitGlobal(GlobalVariable *GV) { // Set the idx of the .bss section BSSSym.SectionIdx = BSSSection.SectionIdx; - SymbolTable.push_back(BSSSym); + if (!GV->hasPrivateLinkage()) + SymbolTable.push_back(BSSSym); // Reserve space in the .bss section for this symbol. BSSSection.Size += Size; diff --git a/llvm/lib/CodeGen/MachOWriter.cpp b/llvm/lib/CodeGen/MachOWriter.cpp index ae1f0d4b045..ef37db8ac9d 100644 --- a/llvm/lib/CodeGen/MachOWriter.cpp +++ b/llvm/lib/CodeGen/MachOWriter.cpp @@ -371,7 +371,7 @@ void MachOWriter::AddSymbolToSection(MachOSection *Sec, GlobalVariable *GV) { SecDataOut.outbyte(0); } // Globals without external linkage apparently do not go in the symbol table. - if (GV->getLinkage() != GlobalValue::InternalLinkage) { + if (!GV->hasLocalLinkage()) { MachOSym Sym(GV, Mang->getValueName(GV), Sec->Index, TM); Sym.n_value = Sec->size; SymbolTable.push_back(Sym); @@ -959,6 +959,9 @@ MachOSym::MachOSym(const GlobalValue *gv, std::string name, uint8_t sect, GVName = TAI->getGlobalPrefix() + name; n_type |= GV->hasHiddenVisibility() ? N_PEXT : N_EXT; break; + case GlobalValue::PrivateLinkage: + GVName = TAI->getPrivateGlobalPrefix() + name; + break; case GlobalValue::InternalLinkage: GVName = TAI->getGlobalPrefix() + name; break; diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp index 60a4f61d256..49b7ad80a28 100644 --- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp @@ -4276,7 +4276,7 @@ void SelectionDAGLowering::visitCall(CallInst &I) { // Check for well-known libc/libm calls. If the function is internal, it // can't be a library call. unsigned NameLen = F->getNameLen(); - if (!F->hasInternalLinkage() && NameLen) { + if (!F->hasLocalLinkage() && NameLen) { const char *NameStr = F->getNameStart(); if (NameStr[0] == 'c' && ((NameLen == 8 && !strcmp(NameStr, "copysign")) || |

