diff options
author | Rafael Espindola <rafael.espindola@gmail.com> | 2010-10-05 15:11:03 +0000 |
---|---|---|
committer | Rafael Espindola <rafael.espindola@gmail.com> | 2010-10-05 15:11:03 +0000 |
commit | 8f413fa9c00dbaea000ddfe265ab5edd285ea3ab (patch) | |
tree | 56e968732b36096ce5c5e50c111bafb847603348 /lib/MC/MCELFStreamer.cpp | |
parent | 4a12f2277315eda5fc5eed138365ff92f7f4e8a8 (diff) |
On ELF we need to know which symbols are used in relocations to decide if
they should be in the symbol table or not. Instead of "guessing", just compute
the symbol table after the relocations are known.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@115619 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/MC/MCELFStreamer.cpp')
-rw-r--r-- | lib/MC/MCELFStreamer.cpp | 51 |
1 files changed, 0 insertions, 51 deletions
diff --git a/lib/MC/MCELFStreamer.cpp b/lib/MC/MCELFStreamer.cpp index ecc72c26b7..b63bedc703 100644 --- a/lib/MC/MCELFStreamer.cpp +++ b/lib/MC/MCELFStreamer.cpp @@ -156,22 +156,6 @@ void MCELFStreamer::InitSections() { SetSectionText(); } -static bool isSymbolLinkerVisible(const MCAssembler &Asm, - const MCSymbolData &Data) { - const MCSymbol &Symbol = Data.getSymbol(); - // Absolute temporary labels are never visible. - if (!Symbol.isInSection()) - return false; - - if (Asm.getBackend().doesSectionRequireSymbols(Symbol.getSection())) - return true; - - if (!Data.isExternal()) - return false; - - return Asm.isSymbolLinkerVisible(Symbol); -} - void MCELFStreamer::EmitLabel(MCSymbol *Symbol) { assert(Symbol->isUndefined() && "Cannot define a symbol twice!"); @@ -179,11 +163,6 @@ void MCELFStreamer::EmitLabel(MCSymbol *Symbol) { MCSymbolData &SD = getAssembler().getOrCreateSymbolData(*Symbol); - // We have to create a new fragment if this is an atom defining symbol, - // fragments cannot span atoms. - if (isSymbolLinkerVisible(getAssembler(), SD)) - new MCDataFragment(getCurrentSectionData()); - // FIXME: This is wasteful, we don't necessarily need to create a data // fragment. Instead, we should mark the symbol as pointing into the data // fragment if it exists, otherwise we should just queue the label and set its @@ -520,36 +499,6 @@ void MCELFStreamer::Finish() { SectData.setAlignment(ByteAlignment); } - // FIXME: We create more atoms than it is necessary. Some relocations to - // merge sections can be implemented with section address + offset, - // figure out which ones and why. - - // First, scan the symbol table to build a lookup table from fragments to - // defining symbols. - DenseMap<const MCFragment*, MCSymbolData*> DefiningSymbolMap; - for (MCAssembler::symbol_iterator it = getAssembler().symbol_begin(), - ie = getAssembler().symbol_end(); it != ie; ++it) { - if (isSymbolLinkerVisible(getAssembler(), *it) && - it->getFragment()) { - // An atom defining symbol should never be internal to a fragment. - assert(it->getOffset() == 0 && "Invalid offset in atom defining symbol!"); - DefiningSymbolMap[it->getFragment()] = it; - } - } - - // Set the fragment atom associations by tracking the last seen atom defining - // symbol. - for (MCAssembler::iterator it = getAssembler().begin(), - ie = getAssembler().end(); it != ie; ++it) { - MCSymbolData *CurrentAtom = 0; - for (MCSectionData::iterator it2 = it->begin(), - ie2 = it->end(); it2 != ie2; ++it2) { - if (MCSymbolData *SD = DefiningSymbolMap.lookup(it2)) - CurrentAtom = SD; - it2->setAtom(CurrentAtom); - } - } - this->MCObjectStreamer::Finish(); } |