1//===- ELFSegmentFactory.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_ELFSEGMENT_FACTORY_H 10#define MCLD_ELFSEGMENT_FACTORY_H 11#ifdef ENABLE_UNITTEST 12#include <gtest.h> 13#endif 14#include <mcld/Support/GCFactory.h> 15#include <mcld/LD/ELFSegment.h> 16 17namespace mcld 18{ 19 20/** \class ELFSegmentFactory 21 * \brief provide the interface to create and delete an ELFSegment 22 */ 23class ELFSegmentFactory : public GCFactory<ELFSegment, 0> 24{ 25public: 26 /// ELFSegmentFactory - the factory of ELFSegment 27 /// pNum is the magic number of the ELF segments in the output 28 ELFSegmentFactory(size_t pNum); 29 ~ELFSegmentFactory(); 30 31 /// produce - produce an empty ELF segment information. 32 /// this function will create an ELF segment 33 /// @param pType - p_type in ELF program header 34 ELFSegment* produce(uint32_t pType, uint32_t pFlag = llvm::ELF::PF_R); 35 36 ELFSegment* 37 find(uint32_t pType, uint32_t pFlagSet, uint32_t pFlagClear); 38 39 const ELFSegment* 40 find(uint32_t pType, uint32_t pFlagSet, uint32_t pFlagClear) const; 41}; 42 43} // namespace of mcld 44 45#endif 46 47