From 746e3bb3547d848af86c4d677dfdc2c4481c7518 Mon Sep 17 00:00:00 2001 From: Bruno Cardoso Lopes Date: Mon, 27 Jul 2009 18:54:47 +0000 Subject: 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 --- lib/CodeGen/ELFCodeEmitter.cpp | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) (limited to 'lib/CodeGen/ELFCodeEmitter.cpp') 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); -- cgit v1.1