aboutsummaryrefslogtreecommitdiffstats
path: root/lib/CodeGen/ELFCodeEmitter.cpp
diff options
context:
space:
mode:
authorBruno Cardoso Lopes <bruno.cardoso@gmail.com>2009-07-27 18:54:47 +0000
committerBruno Cardoso Lopes <bruno.cardoso@gmail.com>2009-07-27 18:54:47 +0000
commit746e3bb3547d848af86c4d677dfdc2c4481c7518 (patch)
tree0122a9f049cefc91a94df18373d68f2f96c66811 /lib/CodeGen/ELFCodeEmitter.cpp
parente0f21bd47f3fed91124e3d8187e1bf8a66c6aef3 (diff)
downloadexternal_llvm-746e3bb3547d848af86c4d677dfdc2c4481c7518.zip
external_llvm-746e3bb3547d848af86c4d677dfdc2c4481c7518.tar.gz
external_llvm-746e3bb3547d848af86c4d677dfdc2c4481c7518.tar.bz2
Handle external symbols for ELF and add some static methods to ELFSym
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@77232 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/ELFCodeEmitter.cpp')
-rw-r--r--lib/CodeGen/ELFCodeEmitter.cpp15
1 files changed, 6 insertions, 9 deletions
diff --git a/lib/CodeGen/ELFCodeEmitter.cpp b/lib/CodeGen/ELFCodeEmitter.cpp
index 1c27428..a62a884 100644
--- a/lib/CodeGen/ELFCodeEmitter.cpp
+++ b/lib/CodeGen/ELFCodeEmitter.cpp
@@ -69,16 +69,11 @@ void ELFCodeEmitter::startFunction(MachineFunction &MF) {
bool ELFCodeEmitter::finishFunction(MachineFunction &MF) {
// Add a symbol to represent the function.
const Function *F = MF.getFunction();
- ELFSym *FnSym = new ELFSym(F);
- FnSym->setType(ELFSym::STT_FUNC);
- FnSym->setBind(EW.getGlobalELFBinding(F));
- FnSym->setVisibility(EW.getGlobalELFVisibility(F));
+ ELFSym *FnSym = ELFSym::getGV(F, EW.getGlobalELFBinding(F), ELFSym::STT_FUNC,
+ EW.getGlobalELFVisibility(F));
FnSym->SectionIdx = ES->SectionIdx;
FnSym->Size = ES->getCurrentPCOffset()-FnStartOff;
-
- // keep track of the emitted function leaving its symbol index as zero
- // to be patched up later when emitting the symbol table
- EW.setGlobalSymLookup(F, 0);
+ EW.addGlobalSymbol(F);
// Offset from start of Section
FnSym->Value = FnStartOff;
@@ -108,7 +103,9 @@ bool ELFCodeEmitter::finishFunction(MachineFunction &MF) {
MachineRelocation &MR = Relocations[i];
intptr_t Addr;
if (MR.isGlobalValue()) {
- EW.PendingGlobals.insert(MR.getGlobalValue());
+ EW.addGlobalSymbol(MR.getGlobalValue());
+ } else if (MR.isExternalSymbol()) {
+ EW.addExternalSymbol(MR.getExternalSymbol());
} else if (MR.isBasicBlock()) {
Addr = getMachineBasicBlockAddress(MR.getBasicBlock());
MR.setConstantVal(ES->SectionIdx);