aboutsummaryrefslogtreecommitdiffstats
path: root/lib/CodeGen
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2009-01-15 20:18:42 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2009-01-15 20:18:42 +0000
commitbb46f52027416598a662dc1c58f48d9d56b1a65b (patch)
treeebdd7fc62b19bc9bdb7cc03563fd817d3943f17e /lib/CodeGen
parentf193ff05909c2de373032f773e76804474b1ef4e (diff)
downloadexternal_llvm-bb46f52027416598a662dc1c58f48d9d56b1a65b.zip
external_llvm-bb46f52027416598a662dc1c58f48d9d56b1a65b.tar.gz
external_llvm-bb46f52027416598a662dc1c58f48d9d56b1a65b.tar.bz2
Add the private linkage.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@62279 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen')
-rw-r--r--lib/CodeGen/AsmPrinter/AsmPrinter.cpp4
-rw-r--r--lib/CodeGen/AsmPrinter/DwarfWriter.cpp3
-rw-r--r--lib/CodeGen/ELFWriter.cpp5
-rw-r--r--lib/CodeGen/MachOWriter.cpp5
-rw-r--r--lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp2
5 files changed, 13 insertions, 6 deletions
diff --git a/lib/CodeGen/AsmPrinter/AsmPrinter.cpp b/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
index 6627543..5b665a0 100644
--- a/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
+++ b/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/lib/CodeGen/AsmPrinter/DwarfWriter.cpp b/lib/CodeGen/AsmPrinter/DwarfWriter.cpp
index 09d169b..02f27d1 100644
--- a/lib/CodeGen/AsmPrinter/DwarfWriter.cpp
+++ b/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/lib/CodeGen/ELFWriter.cpp b/lib/CodeGen/ELFWriter.cpp
index 5d2fca1..b698178 100644
--- a/lib/CodeGen/ELFWriter.cpp
+++ b/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/lib/CodeGen/MachOWriter.cpp b/lib/CodeGen/MachOWriter.cpp
index ae1f0d4..ef37db8 100644
--- a/lib/CodeGen/MachOWriter.cpp
+++ b/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/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp b/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp
index 60a4f61..49b7ad8 100644
--- a/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp
+++ b/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")) ||