ObjectReader.h revision 533eae20118036f425f27bf0536ef0ccbb090b65
1//===- ObjectReader.h -----------------------------------------------------===// 2// 3// The MCLinker Project 4// 5// This file is distributed under the University of Illinois Open Source 6// License. See LICENSE.TXT for details. 7// 8//===----------------------------------------------------------------------===// 9#ifndef MCLD_LD_OBJECTREADER_H 10#define MCLD_LD_OBJECTREADER_H 11#include "mcld/LD/LDReader.h" 12#include <llvm/Support/system_error.h> 13#include <mcld/ADT/HashTable.h> 14#include <mcld/ADT/StringHash.h> 15#include <mcld/LD/ResolveInfo.h> 16 17namespace mcld { 18 19class Module; 20class Input; 21 22/** \class ObjectReader 23 * \brief ObjectReader provides an common interface for different object 24 * formats. 25 */ 26class ObjectReader : public LDReader 27{ 28protected: 29 typedef HashTable<ResolveInfo, hash::StringHash<hash::DJB> > GroupSignatureMap; 30 31protected: 32 ObjectReader() 33 { } 34 35public: 36 virtual ~ObjectReader() { f_GroupSignatureMap.clear(); } 37 38 virtual bool readHeader(Input& pFile) = 0; 39 40 virtual bool readSymbols(Input& pFile) = 0; 41 42 virtual bool readSections(Input& pFile) = 0; 43 44 /// readRelocations - read relocation sections 45 /// 46 /// This function should be called after symbol resolution. 47 virtual bool readRelocations(Input& pFile) = 0; 48 49 GroupSignatureMap& signatures() 50 { return f_GroupSignatureMap; } 51 52 const GroupSignatureMap& signatures() const 53 { return f_GroupSignatureMap; } 54 55protected: 56 GroupSignatureMap f_GroupSignatureMap; 57 58}; 59 60} // namespace of mcld 61 62#endif 63 64