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