MCObjectSymbolizer: Switch from IntervalMap to sorted vector, following r182625.

This removes the need for the missing SectionRef operator< workaround, and fixes
an IntervalMap assert about alignment on MSVC.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@182949 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Ahmed Bougacha
2013-05-30 18:18:36 +00:00
parent 964722ca40
commit b54d29735a
2 changed files with 54 additions and 17 deletions

View File

@@ -15,10 +15,10 @@
#ifndef LLVM_MC_MCOBJECTSYMBOLIZER_H
#define LLVM_MC_MCOBJECTSYMBOLIZER_H
#include "llvm/ADT/IntervalMap.h"
#include "llvm/ADT/DenseMap.h"
#include "llvm/MC/MCSymbolizer.h"
#include "llvm/Object/ObjectFile.h"
#include <vector>
namespace llvm {
@@ -33,12 +33,8 @@ protected:
const object::ObjectFile *Obj;
typedef DenseMap<uint64_t, object::RelocationRef> AddrToRelocMap;
// FIXME: Working around a missing SectionRef operator!= by storing
// DataRefImpl.p instead of SectionRef. Feel free to improve!
typedef IntervalMap<uint64_t, uintptr_t> AddrToSectionMap;
AddrToSectionMap::Allocator AddrToSectionAllocator;
AddrToSectionMap AddrToSection;
typedef std::vector<object::SectionRef> SortedSectionList;
SortedSectionList SortedSections;
// Map a load address to the first relocation that applies there. As far as I
// know, if there are several relocations at the exact same address, they are
@@ -48,6 +44,11 @@ protected:
// relocation (referencing the subtrahend symbol).
AddrToRelocMap AddrToReloc;
// Helpers around SortedSections.
SortedSectionList::const_iterator findSectionContaining(uint64_t Addr) const;
void insertSection(object::SectionRef Section);
MCObjectSymbolizer(MCContext &Ctx, OwningPtr<MCRelocationInfo> &RelInfo,
const object::ObjectFile *Obj);