paludis  Version 2.6.0
elf_relocation_section.hh
1 /* vim: set sw=4 sts=4 et foldmethod=syntax : */
2 
3 /*
4  * Copyright (c) 2007 Tiziano Müller
5  * Copyright (c) 2007 David Leverton
6  *
7  * This file is part of the Paludis package manager. Paludis is free software;
8  * you can redistribute it and/or modify it under the terms of the GNU General
9  * Public License version 2, as published by the Free Software Foundation.
10  *
11  * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY
12  * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
13  * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
14  * details.
15  *
16  * You should have received a copy of the GNU General Public License along with
17  * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
18  * Place, Suite 330, Boston, MA 02111-1307 USA
19  */
20 
21 #ifndef PALUDIS_GUARD_PALUDIS_UTIL_ELF_RELOCATION_SECTION_HH
22 #define PALUDIS_GUARD_PALUDIS_UTIL_ELF_RELOCATION_SECTION_HH 1
23 
24 #include <paludis/util/elf_sections.hh>
25 #include <paludis/util/pimp.hh>
26 #include <paludis/util/wrapped_forward_iterator-fwd.hh>
27 
28 #include <iosfwd>
29 
30 namespace paludis
31 {
32  template <typename ElfType_>
34  {
35  private:
36  typename ElfType_::Relocation _my_relocation;
37 
38  public:
39  RelocationEntry(const typename ElfType_::Relocation &);
40  ~RelocationEntry();
41 
42  typename ElfType_::RelocationOffset get_offset() const
43  {
44  return _my_relocation.r_offset;
45  }
46 
47  typename ElfType_::RelocationInfo get_info() const
48  {
49  return _my_relocation.r_info;
50  }
51  };
52 
53  template <typename ElfType_>
55  {
56  private:
57  typename ElfType_::RelocationA _my_relocation;
58 
59  public:
60  RelocationAEntry(const typename ElfType_::RelocationA &);
62 
63  typename ElfType_::RelocationOffset get_offset() const
64  {
65  return _my_relocation.r_offset;
66  }
67 
68  typename ElfType_::RelocationInfo get_info() const
69  {
70  return _my_relocation.r_info;
71  }
72 
73  typename ElfType_::RelocationAddend get_addend() const
74  {
75  return _my_relocation.r_addend;
76  }
77  };
78 
79  template <typename ElfType_>
80  struct Relocation
81  {
82  typedef typename ElfType_::Relocation Type;
84  const static std::string type_name;
85  };
86 
87  template <typename ElfType_>
88  struct RelocationA
89  {
90  typedef typename ElfType_::RelocationA Type;
92  const static std::string type_name;
93  };
94 
95  template <typename ElfType_, typename Relocation_>
97 
98  template <typename ElfType_, typename Relocation_>
100  public Section<ElfType_>,
101  public paludis::ImplementAcceptMethods<Section<ElfType_>, RelocationSection<ElfType_, Relocation_> >
102  {
103  private:
105 
106  public:
107  RelocationSection(typename ElfType_::Word, const typename ElfType_::SectionHeader &, std::istream &, bool);
108  virtual ~RelocationSection();
109 
110  virtual std::string get_type() const
111  {
112  return Relocation_::type_name;
113  }
114 
117  RelocationIterator relocation_begin() const;
118  RelocationIterator relocation_end() const;
119  };
120 }
121 
122 #endif
123 
Definition: pimp.hh:51
Definition: about_metadata-fwd.hh:23
Definition: visitor-fwd.hh:52
Definition: elf_relocation_section.hh:99
Definition: elf_sections.hh:32
Definition: elf_relocation_section.hh:54
Definition: elf_relocation_section.hh:96
Definition: wrapped_forward_iterator-fwd.hh:26
Definition: elf_relocation_section.hh:88
Definition: elf_relocation_section.hh:80
Definition: elf_relocation_section.hh:33