ELFSectionProgBits.hxx revision 74f7a939f44d926babd52f59978e6b093e4bb2d0
1#ifndef ELF_SECTION_PROGBITS_HXX
2#define ELF_SECTION_PROGBITS_HXX
3
4#include "ELFTypes.h"
5
6#include <llvm/Support/Format.h>
7#include <llvm/Support/raw_ostream.h>
8
9#include "utils/raw_ostream.h"
10
11template <unsigned Bitwidth>
12template <typename Archiver>
13ELFSectionProgBits<Bitwidth> *
14ELFSectionProgBits<Bitwidth>::read(Archiver &AR,
15                                   ELFObjectTy const *owner,
16                                   ELFSectionHeaderTy const *sh) {
17
18  llvm::OwningPtr<ELFSectionProgBits> result(new ELFSectionProgBits());
19
20  // FIXME: We should add extra space for stub.
21  if (!result->chunk.allocate(sh->getSize())) {
22    return NULL;
23  }
24
25  result->sh = sh;
26
27  return result.take();
28}
29
30#endif // ELF_SECTION_PROGBITS_HXX
31