aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2010-03-23 15:44:57 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2010-03-23 16:23:39 +0000
commit3dec9c48b1e0c0b79bdeb0afe4e4e8e8362cef88 (patch)
tree54249608e26bb4c5f83dc6defb6e21b04504e28d
parente60d4baa2ea2edcfe34f9f4aa1796c1b0e9c88d9 (diff)
downloadpaludis-3dec9c48b1e0c0b79bdeb0afe4e4e8e8362cef88.tar.gz
paludis-3dec9c48b1e0c0b79bdeb0afe4e4e8e8362cef88.tar.xz
move littlelf to paludis/util/
-rw-r--r--configure.ac1
-rw-r--r--paludis/util/elf.cc (renamed from src/clients/reconcilio/littlelf/elf.cc)73
-rw-r--r--paludis/util/elf.hh127
-rw-r--r--paludis/util/elf_dynamic_section.cc (renamed from src/clients/reconcilio/littlelf/elf_dynamic_section.cc)77
-rw-r--r--paludis/util/elf_dynamic_section.hh218
-rw-r--r--paludis/util/elf_relocation_section.cc (renamed from src/clients/reconcilio/littlelf/elf_relocation_section.cc)7
-rw-r--r--paludis/util/elf_relocation_section.hh123
-rw-r--r--paludis/util/elf_sections.cc (renamed from src/clients/reconcilio/littlelf/elf_sections.cc)5
-rw-r--r--paludis/util/elf_sections.hh147
-rw-r--r--paludis/util/elf_symbol_section.cc (renamed from src/clients/reconcilio/littlelf/elf_symbol_section.cc)87
-rw-r--r--paludis/util/elf_symbol_section.hh110
-rw-r--r--paludis/util/elf_types.hh90
-rw-r--r--paludis/util/files.m46
-rw-r--r--src/clients/reconcilio/Makefile.am3
-rw-r--r--src/clients/reconcilio/broken_linkage_finder/Makefile.am1
-rw-r--r--src/clients/reconcilio/broken_linkage_finder/elf_linkage_checker.cc10
-rw-r--r--src/clients/reconcilio/littlelf/Makefile.am22
-rw-r--r--src/clients/reconcilio/littlelf/elf.hh125
-rw-r--r--src/clients/reconcilio/littlelf/elf_dynamic_section.hh216
-rw-r--r--src/clients/reconcilio/littlelf/elf_relocation_section.hh120
-rw-r--r--src/clients/reconcilio/littlelf/elf_sections.hh144
-rw-r--r--src/clients/reconcilio/littlelf/elf_symbol_section.hh108
-rw-r--r--src/clients/reconcilio/littlelf/elf_types.hh86
23 files changed, 952 insertions, 954 deletions
diff --git a/configure.ac b/configure.ac
index 808669f..673ed02 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1647,7 +1647,6 @@ AC_OUTPUT(
src/clients/paludis/Makefile
src/clients/reconcilio/Makefile
src/clients/reconcilio/broken_linkage_finder/Makefile
- src/clients/reconcilio/littlelf/Makefile
src/output/Makefile
test/Makefile
vim/Makefile
diff --git a/src/clients/reconcilio/littlelf/elf.cc b/paludis/util/elf.cc
index f8aa2fa..7676911 100644
--- a/src/clients/reconcilio/littlelf/elf.cc
+++ b/paludis/util/elf.cc
@@ -20,11 +20,11 @@
#include "config.h"
-#include "elf.hh"
-#include "elf_dynamic_section.hh"
-#include "elf_relocation_section.hh"
-#include "elf_symbol_section.hh"
-#include "elf_types.hh"
+#include <paludis/util/elf.hh>
+#include <paludis/util/elf_dynamic_section.hh>
+#include <paludis/util/elf_relocation_section.hh>
+#include <paludis/util/elf_symbol_section.hh>
+#include <paludis/util/elf_types.hh>
#include <paludis/util/byte_swap.hh>
#include <paludis/util/make_shared_ptr.hh>
@@ -176,41 +176,44 @@ namespace
};
}
-namespace littlelf_internals
+namespace paludis
{
- template <typename ElfType_>
- class SectionNameResolvingVisitor
+ namespace littlelf_internals
{
- private:
- typename ElfObject<ElfType_>::SectionIterator _begin, _end;
+ template <typename ElfType_>
+ class SectionNameResolvingVisitor
+ {
+ private:
+ typename ElfObject<ElfType_>::SectionIterator _begin, _end;
- public:
- SectionNameResolvingVisitor(typename ElfObject<ElfType_>::SectionIterator begin, typename ElfObject<ElfType_>::SectionIterator end) :
- _begin(begin),
- _end(end)
- {
- }
+ public:
+ SectionNameResolvingVisitor(typename ElfObject<ElfType_>::SectionIterator begin, typename ElfObject<ElfType_>::SectionIterator end) :
+ _begin(begin),
+ _end(end)
+ {
+ }
- void visit(const Section<ElfType_> &)
- {
- }
+ void visit(const Section<ElfType_> &)
+ {
+ }
- void visit(const StringSection<ElfType_> & section)
- {
- for (typename ElfObject<ElfType_>::SectionIterator i = _begin; i != _end; ++i)
- try
- {
- i->resolve_section_name(section.get_string(i->get_name_index()));
- }
- catch (std::out_of_range &)
- {
- throw InvalidElfFileError(
- i->description() + " has out-of-range name index " +
- stringify(i->get_name_index()) + " for " + section.description() +
- " (max " + stringify(section.get_max_string()) + ")");
- }
- }
- };
+ void visit(const StringSection<ElfType_> & section)
+ {
+ for (typename ElfObject<ElfType_>::SectionIterator i = _begin; i != _end; ++i)
+ try
+ {
+ i->resolve_section_name(section.get_string(i->get_name_index()));
+ }
+ catch (std::out_of_range &)
+ {
+ throw InvalidElfFileError(
+ i->description() + " has out-of-range name index " +
+ stringify(i->get_name_index()) + " for " + section.description() +
+ " (max " + stringify(section.get_max_string()) + ")");
+ }
+ }
+ };
+ }
}
InvalidElfFileError::InvalidElfFileError(const InvalidElfFileError & other) :
diff --git a/paludis/util/elf.hh b/paludis/util/elf.hh
new file mode 100644
index 0000000..cc54e99
--- /dev/null
+++ b/paludis/util/elf.hh
@@ -0,0 +1,127 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 2007 Tiziano Müller
+ * Copyright (c) 2007 David Leverton
+ *
+ * This file is part of the Paludis package manager. Paludis is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU General
+ * Public License version 2, as published by the Free Software Foundation.
+ *
+ * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+ * Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#ifndef PALUDIS_GUARD_PALUDIS_UTIL_ELF_HH
+#define PALUDIS_GUARD_PALUDIS_UTIL_ELF_HH 1
+
+#include <paludis/util/elf_sections.hh>
+#include <paludis/util/exception.hh>
+#include <paludis/util/private_implementation_pattern.hh>
+#include <paludis/util/wrapped_forward_iterator-fwd.hh>
+#include <iosfwd>
+
+#include <elf.h>
+
+namespace paludis
+{
+ class InvalidElfFileError :
+ public paludis::Exception
+ {
+ public:
+ InvalidElfFileError(const InvalidElfFileError &);
+ InvalidElfFileError(const std::string &) throw ();
+ };
+
+ template <typename ElfType_>
+ struct ElfObjectSectionIteratorTag;
+
+ template <typename ElfType_>
+ class PALUDIS_VISIBLE ElfObject :
+ private paludis::PrivateImplementationPattern<ElfObject<ElfType_> >
+ {
+ using paludis::PrivateImplementationPattern<ElfObject>::_imp;
+
+ private:
+ typename ElfType_::Header _hdr;
+
+ public:
+ static bool is_valid_elf(std::istream & stream);
+ ElfObject(std::istream & stream);
+ ~ElfObject();
+
+ /**
+ * Returns e_type from the ELF header
+ */
+ unsigned int get_type() const
+ {
+ return _hdr.e_type;
+ }
+
+ /**
+ * Returns e_machine from the ELF header
+ */
+ unsigned int get_arch() const
+ {
+ return _hdr.e_machine;
+ }
+
+ /**
+ * Returns the OS ABI field from the ident field
+ */
+ unsigned char get_os_abi() const
+ {
+ return _hdr.e_ident[EI_OSABI];
+ }
+
+ /**
+ * Returns the OS ABI Version field from the ident field
+ */
+ unsigned char get_os_abi_version() const
+ {
+ return _hdr.e_ident[EI_ABIVERSION];
+ }
+
+ /**
+ * Returns the processor-specific flags
+ */
+ unsigned int get_flags() const
+ {
+ return _hdr.e_flags;
+ }
+
+ /**
+ * Returns whether this ELF file uses big-endian or little-endian
+ * Please note: If you didn't use is_valid_elf(...) to check whether
+ * this is an ELF object, this might be wrong
+ */
+ unsigned int is_big_endian() const
+ {
+ // We already checked in is_valid_elf_type whether it's valid or not
+ return (_hdr.e_ident[EI_DATA] == ELFDATA2MSB);
+ }
+
+ unsigned int get_number_of_sections() const
+ {
+ return _hdr.e_shnum;
+ }
+
+ typedef ElfObjectSectionIteratorTag<ElfType_> SectionIteratorTag;
+ typedef paludis::WrappedForwardIterator<SectionIteratorTag, Section<ElfType_> > SectionIterator;
+ SectionIterator section_begin() const;
+ SectionIterator section_end() const;
+
+ SectionIterator get_section_by_index(unsigned int index) const;
+
+ void resolve_all_strings();
+ };
+}
+
+#endif
+
diff --git a/src/clients/reconcilio/littlelf/elf_dynamic_section.cc b/paludis/util/elf_dynamic_section.cc
index 8b0fa0c..8df72f4 100644
--- a/src/clients/reconcilio/littlelf/elf_dynamic_section.cc
+++ b/paludis/util/elf_dynamic_section.cc
@@ -18,13 +18,13 @@
* Place, Suite 330, Boston, MA 02111-1307 USA
*/
-#include "elf_dynamic_section.hh"
-#include "elf_sections.hh"
-#include "elf_types.hh"
-#include "elf_relocation_section.hh"
-#include "elf_sections.hh"
-#include "elf_symbol_section.hh"
-#include "elf.hh"
+#include <paludis/util/elf_dynamic_section.hh>
+#include <paludis/util/elf_sections.hh>
+#include <paludis/util/elf_types.hh>
+#include <paludis/util/elf_relocation_section.hh>
+#include <paludis/util/elf_sections.hh>
+#include <paludis/util/elf_symbol_section.hh>
+#include <paludis/util/elf.hh>
#include <paludis/util/byte_swap.hh>
#include <paludis/util/clone-impl.hh>
@@ -63,43 +63,46 @@ namespace paludis
};
}
-namespace littlelf_internals
+namespace paludis
{
- template <typename ElfType_>
- class DynEntriesStringResolvingVisitor
+ namespace littlelf_internals
{
- private:
- const DynamicSection<ElfType_> & _dyn_section;
- const StringSection<ElfType_> & _string_section;
-
- public:
- DynEntriesStringResolvingVisitor(
- const DynamicSection<ElfType_> & dyn_section,
- const StringSection<ElfType_> & string_section) :
- _dyn_section(dyn_section),
- _string_section(string_section)
- {
- }
-
- void visit(DynamicEntry<ElfType_> &)
- {
- }
+ template <typename ElfType_>
+ class DynEntriesStringResolvingVisitor
+ {
+ private:
+ const DynamicSection<ElfType_> & _dyn_section;
+ const StringSection<ElfType_> & _string_section;
+
+ public:
+ DynEntriesStringResolvingVisitor(
+ const DynamicSection<ElfType_> & dyn_section,
+ const StringSection<ElfType_> & string_section) :
+ _dyn_section(dyn_section),
+ _string_section(string_section)
+ {
+ }
- void visit(DynamicEntryString<ElfType_> & entry)
- {
- try
+ void visit(DynamicEntry<ElfType_> &)
{
- entry.resolve_string(_string_section.get_string(entry.get_string_index()));
}
- catch (std::out_of_range &)
+
+ void visit(DynamicEntryString<ElfType_> & entry)
{
- throw InvalidElfFileError(
- entry.description() + " in " + _dyn_section.description() + " has out-of-range string index " +
- stringify(entry.get_string_index()) + " for " + _string_section.description() +
- " (max " + stringify(_string_section.get_max_string()) + ")");
+ try
+ {
+ entry.resolve_string(_string_section.get_string(entry.get_string_index()));
+ }
+ catch (std::out_of_range &)
+ {
+ throw InvalidElfFileError(
+ entry.description() + " in " + _dyn_section.description() + " has out-of-range string index " +
+ stringify(entry.get_string_index()) + " for " + _string_section.description() +
+ " (max " + stringify(_string_section.get_max_string()) + ")");
+ }
}
- }
- };
+ };
+ }
}
namespace
diff --git a/paludis/util/elf_dynamic_section.hh b/paludis/util/elf_dynamic_section.hh
new file mode 100644
index 0000000..b4e04f2
--- /dev/null
+++ b/paludis/util/elf_dynamic_section.hh
@@ -0,0 +1,218 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 2007 Tiziano Müller
+ * Copyright (c) 2007 David Leverton
+ *
+ * This file is part of the Paludis package manager. Paludis is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU General
+ * Public License version 2, as published by the Free Software Foundation.
+ *
+ * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+ * Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#ifndef PALUDIS_GUARD_PALUDIS_UTIL_ELF_DYNAMIC_SECTION_HH
+#define PALUDIS_GUARD_PALUDIS_UTIL_ELF_DYNAMIC_SECTION_HH 1
+
+#include <paludis/util/elf_sections.hh>
+#include <paludis/util/clone.hh>
+#include <paludis/util/instantiation_policy.hh>
+#include <paludis/util/private_implementation_pattern.hh>
+#include <paludis/util/wrapped_forward_iterator-fwd.hh>
+#include <paludis/util/simple_visitor.hh>
+#include <paludis/util/type_list.hh>
+#include <tr1/memory>
+#include <string>
+#include <iosfwd>
+
+namespace paludis
+{
+ template <typename ElfType_> class DynamicEntry;
+ template <typename ElfType_> class DynamicEntryUnknown;
+ template <typename ElfType_> class DynamicEntryValue;
+ template <typename ElfType_> class DynamicEntryPointer;
+ template <typename ElfType_> class DynamicEntryString;
+ template <typename ElfType_> class DynamicEntryFlag;
+
+ template <typename ElfType_>
+ class DynamicEntry :
+ public virtual paludis::DeclareAbstractAcceptMethods<DynamicEntry<ElfType_>, typename paludis::MakeTypeList<
+ DynamicEntryUnknown<ElfType_>,
+ DynamicEntryValue<ElfType_>,
+ DynamicEntryPointer<ElfType_>,
+ DynamicEntryString<ElfType_>,
+ DynamicEntryFlag<ElfType_>
+ >::Type>,
+ public virtual paludis::Cloneable<DynamicEntry<ElfType_> >
+ {
+ private:
+ std::string _tag_name;
+ typename ElfType_::Word _index;
+
+ public:
+ DynamicEntry(const std::string &);
+ ~DynamicEntry();
+ virtual void initialize(typename ElfType_::Word, const typename ElfType_::DynamicEntry & entry);
+
+ std::string tag_name() const
+ {
+ return _tag_name;
+ }
+
+ std::string description() const;
+ };
+
+ template <typename ElfType_>
+ class DynamicEntryUnknown :
+ public virtual DynamicEntry<ElfType_>,
+ public paludis::ImplementAcceptMethods<DynamicEntry<ElfType_>, DynamicEntryUnknown<ElfType_> >,
+ public paludis::CloneUsingThis<DynamicEntry<ElfType_>, DynamicEntryUnknown<ElfType_> >
+ {
+ public:
+ DynamicEntryUnknown();
+ virtual ~DynamicEntryUnknown();
+ };
+
+ template <typename ElfType_>
+ class DynamicEntryFlag :
+ public virtual DynamicEntry<ElfType_>,
+ public paludis::ImplementAcceptMethods<DynamicEntry<ElfType_>, DynamicEntryFlag<ElfType_> >,
+ public paludis::CloneUsingThis<DynamicEntry<ElfType_>, DynamicEntryFlag<ElfType_> >
+ {
+ public:
+ DynamicEntryFlag(const std::string &);
+ ~DynamicEntryFlag();
+ };
+
+ template <typename ElfType_>
+ class DynamicEntryValue :
+ public virtual DynamicEntry<ElfType_>,
+ public paludis::ImplementAcceptMethods<DynamicEntry<ElfType_>, DynamicEntryValue<ElfType_> >,
+ public paludis::CloneUsingThis<DynamicEntry<ElfType_>, DynamicEntryValue<ElfType_> >
+ {
+ private:
+ typename ElfType_::DynamicValue _value;
+
+ public:
+ DynamicEntryValue(const std::string &);
+ virtual ~DynamicEntryValue();
+ virtual void initialize(typename ElfType_::Word, const typename ElfType_::DynamicEntry & entry);
+
+ typename ElfType_::DynamicValue operator() () const
+ {
+ return _value;
+ }
+ };
+
+ template <typename ElfType_>
+ class DynamicEntryPointer :
+ public virtual DynamicEntry<ElfType_>,
+ public paludis::ImplementAcceptMethods<DynamicEntry<ElfType_>, DynamicEntryPointer<ElfType_> >,
+ public paludis::CloneUsingThis<DynamicEntry<ElfType_>, DynamicEntryPointer<ElfType_> >
+ {
+ private:
+ typename ElfType_::DynamicPointer _pointer;
+
+ public:
+ DynamicEntryPointer(const std::string &);
+ virtual ~DynamicEntryPointer();
+ virtual void initialize(typename ElfType_::Word, const typename ElfType_::DynamicEntry &);
+
+ typename ElfType_::DynamicPointer operator() () const
+ {
+ return _pointer;
+ }
+ };
+
+ namespace littlelf_internals
+ {
+ template <typename ElfType_> class DynEntriesStringResolvingVisitor;
+ }
+
+ template <typename ElfType_>
+ class DynamicEntryString :
+ public virtual DynamicEntry<ElfType_>,
+ public paludis::ImplementAcceptMethods<DynamicEntry<ElfType_>, DynamicEntryString<ElfType_> >,
+ public paludis::CloneUsingThis<DynamicEntry<ElfType_>, DynamicEntryString<ElfType_> >
+ {
+ friend class littlelf_internals::DynEntriesStringResolvingVisitor<ElfType_>;
+
+ private:
+ typename ElfType_::DynamicValue _value;
+ std::string _str;
+
+ public:
+ DynamicEntryString(const std::string &);
+ virtual ~DynamicEntryString();
+ virtual void initialize(typename ElfType_::Word, const typename ElfType_::DynamicEntry &);
+
+ std::string operator() () const
+ {
+ return _str;
+ }
+
+ private:
+ void resolve_string(std::string str)
+ {
+ _str = str;
+ }
+
+ typename ElfType_::DynamicValue get_string_index() const
+ {
+ return _value;
+ }
+ };
+
+ template <typename ElfType_>
+ class DynamicEntries :
+ public paludis::InstantiationPolicy<DynamicEntries<ElfType_>, paludis::instantiation_method::SingletonTag>,
+ private paludis::PrivateImplementationPattern<DynamicEntries<ElfType_> >
+ {
+ using paludis::PrivateImplementationPattern<DynamicEntries>::_imp;
+ friend class paludis::InstantiationPolicy<DynamicEntries, paludis::instantiation_method::SingletonTag>;
+
+ public:
+ void register_type(typename ElfType_::DynamicTag, std::tr1::shared_ptr<DynamicEntry<ElfType_> >);
+
+ std::tr1::shared_ptr<DynamicEntry<ElfType_> > get_entry(typename ElfType_::DynamicTag) const;
+ bool has_entry(typename ElfType_::DynamicTag) const;
+
+ private:
+ DynamicEntries();
+ ~DynamicEntries();
+ };
+
+ template <typename ElfType_>
+ struct DynamicSectionEntryIteratorTag;
+
+ template <typename ElfType_>
+ class PALUDIS_VISIBLE DynamicSection :
+ public Section<ElfType_>,
+ public paludis::ImplementAcceptMethods<Section<ElfType_>, DynamicSection<ElfType_> >,
+ private paludis::PrivateImplementationPattern<DynamicSection<ElfType_> >
+ {
+ using paludis::PrivateImplementationPattern<DynamicSection>::_imp;
+
+ public:
+ DynamicSection(typename ElfType_::Word, const typename ElfType_::SectionHeader &, std::istream &, bool);
+ virtual ~DynamicSection();
+
+ virtual std::string get_type() const;
+
+ void resolve_entry_names(Section<ElfType_> &);
+
+ typedef DynamicSectionEntryIteratorTag<ElfType_> EntryIteratorTag;
+ typedef paludis::WrappedForwardIterator<EntryIteratorTag, DynamicEntry<ElfType_> > EntryIterator;
+ EntryIterator entry_begin() const;
+ EntryIterator entry_end() const;
+ };
+}
+
+#endif
diff --git a/src/clients/reconcilio/littlelf/elf_relocation_section.cc b/paludis/util/elf_relocation_section.cc
index d7e9d15..35c1fab 100644
--- a/src/clients/reconcilio/littlelf/elf_relocation_section.cc
+++ b/paludis/util/elf_relocation_section.cc
@@ -18,10 +18,9 @@
* Place, Suite 330, Boston, MA 02111-1307 USA
*/
-#include "elf_relocation_section.hh"
-#include "elf_types.hh"
-#include "elf.hh"
-
+#include <paludis/util/elf_relocation_section.hh>
+#include <paludis/util/elf_types.hh>
+#include <paludis/util/elf.hh>
#include <paludis/util/byte_swap.hh>
#include <paludis/util/private_implementation_pattern-impl.hh>
#include <paludis/util/wrapped_forward_iterator-impl.hh>
diff --git a/paludis/util/elf_relocation_section.hh b/paludis/util/elf_relocation_section.hh
new file mode 100644
index 0000000..6b66b6d
--- /dev/null
+++ b/paludis/util/elf_relocation_section.hh
@@ -0,0 +1,123 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 2007 Tiziano Müller
+ * Copyright (c) 2007 David Leverton
+ *
+ * This file is part of the Paludis package manager. Paludis is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU General
+ * Public License version 2, as published by the Free Software Foundation.
+ *
+ * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+ * Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#ifndef PALUDIS_GUARD_PALUDIS_UTIL_ELF_RELOCATION_SECTION_HH
+#define PALUDIS_GUARD_PALUDIS_UTIL_ELF_RELOCATION_SECTION_HH 1
+
+#include <paludis/util/elf_sections.hh>
+#include <paludis/util/private_implementation_pattern.hh>
+#include <paludis/util/wrapped_forward_iterator-fwd.hh>
+
+#include <iosfwd>
+
+namespace paludis
+{
+ template <typename ElfType_>
+ class RelocationEntry
+ {
+ private:
+ typename ElfType_::Relocation _my_relocation;
+
+ public:
+ RelocationEntry(const typename ElfType_::Relocation &);
+ ~RelocationEntry();
+
+ typename ElfType_::RelocationOffset get_offset() const
+ {
+ return _my_relocation.r_offset;
+ }
+
+ typename ElfType_::RelocationInfo get_info() const
+ {
+ return _my_relocation.r_info;
+ }
+ };
+
+ template <typename ElfType_>
+ class RelocationAEntry
+ {
+ private:
+ typename ElfType_::RelocationA _my_relocation;
+
+ public:
+ RelocationAEntry(const typename ElfType_::RelocationA &);
+ ~RelocationAEntry();
+
+ typename ElfType_::RelocationOffset get_offset() const
+ {
+ return _my_relocation.r_offset;
+ }
+
+ typename ElfType_::RelocationInfo get_info() const
+ {
+ return _my_relocation.r_info;
+ }
+
+ typename ElfType_::RelocationAddend get_addend() const
+ {
+ return _my_relocation.r_addend;
+ }
+ };
+
+ template <typename ElfType_>
+ struct Relocation
+ {
+ typedef typename ElfType_::Relocation Type;
+ typedef RelocationEntry<ElfType_> Entry;
+ const static std::string type_name;
+ };
+
+ template <typename ElfType_>
+ struct RelocationA
+ {
+ typedef typename ElfType_::RelocationA Type;
+ typedef RelocationAEntry<ElfType_> Entry;
+ const static std::string type_name;
+ };
+
+ template <typename ElfType_, typename Relocation_>
+ struct RelocationSectionRelocationIteratorTag;
+
+ template <typename ElfType_, typename Relocation_>
+ class RelocationSection :
+ public Section<ElfType_>,
+ public paludis::ImplementAcceptMethods<Section<ElfType_>, RelocationSection<ElfType_, Relocation_> >,
+ private paludis::PrivateImplementationPattern<RelocationSection<ElfType_, Relocation_> >
+ {
+ using paludis::PrivateImplementationPattern<RelocationSection>::_imp;
+
+ public:
+ RelocationSection(typename ElfType_::Word, const typename ElfType_::SectionHeader &, std::istream &, bool);
+ virtual ~RelocationSection();
+
+ virtual std::string get_type() const
+ {
+ return Relocation_::type_name;
+ }
+
+ typedef RelocationSectionRelocationIteratorTag<ElfType_, Relocation_> RelocationIteratorTag;
+ typedef paludis::WrappedForwardIterator<RelocationIteratorTag, const typename Relocation_::Entry> RelocationIterator;
+ RelocationIterator relocation_begin() const;
+ RelocationIterator relocation_end() const;
+ };
+}
+
+#endif
+
diff --git a/src/clients/reconcilio/littlelf/elf_sections.cc b/paludis/util/elf_sections.cc
index 491c0a1..9ac1112 100644
--- a/src/clients/reconcilio/littlelf/elf_sections.cc
+++ b/paludis/util/elf_sections.cc
@@ -18,9 +18,8 @@
* Place, Suite 330, Boston, MA 02111-1307 USA
*/
-#include "elf_sections.hh"
-#include "elf_types.hh"
-
+#include <paludis/util/elf_sections.hh>
+#include <paludis/util/elf_types.hh>
#include <paludis/util/stringify.hh>
#include <istream>
diff --git a/paludis/util/elf_sections.hh b/paludis/util/elf_sections.hh
new file mode 100644
index 0000000..5095d23
--- /dev/null
+++ b/paludis/util/elf_sections.hh
@@ -0,0 +1,147 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 2007 Tiziano Müller
+ * Copyright (c) 2007 David Leverton
+ *
+ * This file is part of the Paludis package manager. Paludis is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU General
+ * Public License version 2, as published by the Free Software Foundation.
+ *
+ * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+ * Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#ifndef PALUDIS_GUARD_PALUDIS_UTIL_ELF_SECTIONS_HH
+#define PALUDIS_GUARD_PALUDIS_UTIL_ELF_SECTIONS_HH 1
+
+#include <string>
+#include <iosfwd>
+#include <paludis/util/simple_visitor.hh>
+#include <paludis/util/type_list.hh>
+
+namespace paludis
+{
+ template <typename ElfType_> class ElfObject;
+ template <typename ElfType_> class Section;
+ template <typename ElfType_> class StringSection;
+ template <typename ElfType_> class DynamicSection;
+ template <typename ElfType_> class SymbolSection;
+ template <typename ElfType_> class GenericSection;
+ template <typename ElfType_, class RelocationType_> class RelocationSection;
+
+ template <typename ElfType_> class Relocation;
+ template <typename ElfType_> class RelocationA;
+
+ namespace littlelf_internals
+ {
+ template <typename ElfType_> class SectionNameResolvingVisitor;
+ }
+
+ template <typename ElfType_>
+ class Section :
+ public virtual paludis::DeclareAbstractAcceptMethods<Section<ElfType_>, typename paludis::MakeTypeList<
+ StringSection<ElfType_>,
+ DynamicSection<ElfType_>,
+ SymbolSection<ElfType_>,
+ GenericSection<ElfType_>,
+ RelocationSection<ElfType_, Relocation<ElfType_> >,
+ RelocationSection<ElfType_, RelocationA<ElfType_> >
+ >::Type>
+ {
+ friend class littlelf_internals::SectionNameResolvingVisitor<ElfType_>;
+
+ private:
+ typename ElfType_::Word _index;
+ typename ElfType_::SectionHeader _shdr;
+ std::string _name;
+
+ protected:
+ void resolve_section_name(std::string name)
+ {
+ _name = name;
+ }
+
+ typename ElfType_::Word get_name_index() const
+ {
+ return _shdr.sh_name;
+ }
+
+ public:
+ Section(typename ElfType_::Word, const typename ElfType_::SectionHeader &);
+ virtual ~Section();
+
+ virtual typename ElfType_::Offset get_data_offset() const
+ {
+ return _shdr.sh_offset;
+ }
+
+ virtual std::string get_name() const
+ {
+ return _name;
+ }
+ virtual std::string get_type() const = 0;
+ typename ElfType_::Word get_index() const
+ {
+ return _index;
+ }
+
+ typename ElfType_::Word get_link_index() const
+ {
+ return _shdr.sh_link;
+ }
+
+ typename ElfType_::Address get_virtual_address() const
+ {
+ return _shdr.sh_addr;
+ }
+
+ typename ElfType_::SectionSize get_size() const
+ {
+ return _shdr.sh_size;
+ }
+
+ std::string description() const;
+ };
+
+
+ template <typename ElfType_>
+ class GenericSection :
+ public Section<ElfType_>,
+ public paludis::ImplementAcceptMethods<Section<ElfType_>, GenericSection<ElfType_> >
+ {
+ public:
+ GenericSection(typename ElfType_::Word, const typename ElfType_::SectionHeader &);
+ virtual ~GenericSection();
+ virtual std::string get_type() const;
+ };
+
+ template <typename ElfType_>
+ class StringSection :
+ public Section<ElfType_>,
+ public paludis::ImplementAcceptMethods<Section<ElfType_>, StringSection<ElfType_> >
+ {
+ private:
+ std::string _stringTable;
+
+ public:
+ StringSection(typename ElfType_::Word, const typename ElfType_::SectionHeader &, std::istream &, bool);
+ virtual ~StringSection();
+
+ std::string get_string(typename ElfType_::Word) const;
+ typename ElfType_::Word get_max_string() const
+ {
+ return _stringTable.length();
+ }
+
+ virtual std::string get_type() const;
+ };
+}
+
+#endif
diff --git a/src/clients/reconcilio/littlelf/elf_symbol_section.cc b/paludis/util/elf_symbol_section.cc
index 09e9ce1..3f558a7 100644
--- a/src/clients/reconcilio/littlelf/elf_symbol_section.cc
+++ b/paludis/util/elf_symbol_section.cc
@@ -18,12 +18,12 @@
* Place, Suite 330, Boston, MA 02111-1307 USA
*/
-#include "elf_symbol_section.hh"
-#include "elf_sections.hh"
-#include "elf_types.hh"
-#include "elf_relocation_section.hh"
-#include "elf_dynamic_section.hh"
-#include "elf.hh"
+#include <paludis/util/elf_symbol_section.hh>
+#include <paludis/util/elf_sections.hh>
+#include <paludis/util/elf_types.hh>
+#include <paludis/util/elf_relocation_section.hh>
+#include <paludis/util/elf_dynamic_section.hh>
+#include <paludis/util/elf.hh>
#include <paludis/util/byte_swap.hh>
#include <paludis/util/private_implementation_pattern-impl.hh>
@@ -69,46 +69,43 @@ namespace
};
}
-namespace littlelf_internals
+template <typename ElfType_>
+class littlelf_internals::SymbolStringResolvingVisitor
{
- template <typename ElfType_>
- class SymbolStringResolvingVisitor
- {
- private:
- const SymbolSection<ElfType_> & _sym_section;
- typename std::vector<Symbol<ElfType_> >::iterator _begin, _end;
-
- public:
- SymbolStringResolvingVisitor(const SymbolSection<ElfType_> & sym_section,
- typename std::vector<Symbol<ElfType_> >::iterator begin,
- typename std::vector<Symbol<ElfType_> >::iterator end) :
- _sym_section(sym_section),
- _begin(begin),
- _end(end)
- {
- }
-
- void visit(Section<ElfType_> &)
- {
- }
-
- void visit(StringSection<ElfType_> & string_section)
- {
- for (typename std::vector<Symbol<ElfType_> >::iterator i = _begin; i != _end; ++i)
- try
- {
- i->resolve_symbol(string_section.get_string(i->get_symbol_index()));
- }
- catch (std::out_of_range &)
- {
- throw InvalidElfFileError(
- "symbol " + stringify(i - _begin) + " in " + _sym_section.description() + " has out-of-range string index " +
- stringify(i->get_symbol_index()) + " for " + string_section.description() +
- " (max " + stringify(string_section.get_max_string()) + ")");
- }
- }
- };
-}
+ private:
+ const SymbolSection<ElfType_> & _sym_section;
+ typename std::vector<Symbol<ElfType_> >::iterator _begin, _end;
+
+ public:
+ SymbolStringResolvingVisitor(const SymbolSection<ElfType_> & sym_section,
+ typename std::vector<Symbol<ElfType_> >::iterator begin,
+ typename std::vector<Symbol<ElfType_> >::iterator end) :
+ _sym_section(sym_section),
+ _begin(begin),
+ _end(end)
+ {
+ }
+
+ void visit(Section<ElfType_> &)
+ {
+ }
+
+ void visit(StringSection<ElfType_> & string_section)
+ {
+ for (typename std::vector<Symbol<ElfType_> >::iterator i = _begin; i != _end; ++i)
+ try
+ {
+ i->resolve_symbol(string_section.get_string(i->get_symbol_index()));
+ }
+ catch (std::out_of_range &)
+ {
+ throw InvalidElfFileError(
+ "symbol " + stringify(i - _begin) + " in " + _sym_section.description() + " has out-of-range string index " +
+ stringify(i->get_symbol_index()) + " for " + string_section.description() +
+ " (max " + stringify(string_section.get_max_string()) + ")");
+ }
+ }
+};
template <typename ElfType_>
Symbol<ElfType_>::Symbol(const typename ElfType_::Symbol & my_symbol) :
diff --git a/paludis/util/elf_symbol_section.hh b/paludis/util/elf_symbol_section.hh
new file mode 100644
index 0000000..d7bc9cd
--- /dev/null
+++ b/paludis/util/elf_symbol_section.hh
@@ -0,0 +1,110 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 2007 Tiziano Müller
+ * Copyright (c) 2007 David Leverton
+ *
+ * This file is part of the Paludis package manager. Paludis is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU General
+ * Public License version 2, as published by the Free Software Foundation.
+ *
+ * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+ * Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#ifndef PALUDIS_GUARD_PALUDIS_UTIL_ELF_SYMBOL_SECTION_HH
+#define PALUDIS_GUARD_PALUDIS_UTIL_ELF_SYMBOL_SECTION_HH 1
+
+#include <paludis/util/elf_sections.hh>
+#include <paludis/util/private_implementation_pattern.hh>
+#include <paludis/util/wrapped_forward_iterator-fwd.hh>
+
+#include <iosfwd>
+
+namespace paludis
+{
+ namespace littlelf_internals
+ {
+ template <typename ElfType_> class SymbolStringResolvingVisitor;
+ }
+
+ template <typename ElfType_>
+ class Symbol
+ {
+ friend class littlelf_internals::SymbolStringResolvingVisitor<ElfType_>;
+
+ private:
+ typename ElfType_::Symbol _my_symbol;
+ std::string _symbol_name;
+ std::string _binding, _visibility;
+
+ protected:
+ void resolve_symbol(std::string symbol_name)
+ {
+ _symbol_name = symbol_name;
+ }
+
+ typename ElfType_::Word get_symbol_index() const
+ {
+ return _my_symbol.st_name;
+ }
+
+ public:
+ Symbol(const typename ElfType_::Symbol &);
+ ~Symbol();
+
+ std::string name() const
+ {
+ return _symbol_name;
+ }
+
+ std::string binding() const
+ {
+ return _binding;
+ }
+
+ std::string visibility() const
+ {
+ return _visibility;
+ }
+ };
+
+ template <typename ElfType_>
+ struct SymbolSectionSymbolIteratorTag;
+
+ template <typename ElfType_>
+ class SymbolSection :
+ public Section<ElfType_>,
+ public paludis::ImplementAcceptMethods<Section<ElfType_>, SymbolSection<ElfType_> >,
+ private paludis::PrivateImplementationPattern<SymbolSection<ElfType_> >
+ {
+ using paludis::PrivateImplementationPattern<SymbolSection>::_imp;
+
+ private:
+ std::string _type;
+
+ public:
+ SymbolSection(typename ElfType_::Word, const typename ElfType_::SectionHeader &, std::istream &, bool);
+ virtual ~SymbolSection();
+
+ virtual std::string get_type() const
+ {
+ return _type;
+ }
+
+ void resolve_symbols(Section<ElfType_> &);
+
+ typedef SymbolSectionSymbolIteratorTag<ElfType_> SymbolIteratorTag;
+ typedef paludis::WrappedForwardIterator<SymbolIteratorTag, const Symbol<ElfType_ > > SymbolIterator;
+ SymbolIterator symbol_begin() const;
+ SymbolIterator symbol_end() const;
+ };
+}
+
+#endif
diff --git a/paludis/util/elf_types.hh b/paludis/util/elf_types.hh
new file mode 100644
index 0000000..0973205
--- /dev/null
+++ b/paludis/util/elf_types.hh
@@ -0,0 +1,90 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 2007 Tiziano Müller
+ * Copyright (c) 2007 David Leverton
+ *
+ * This file is part of the Paludis package manager. Paludis is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU General
+ * Public License version 2, as published by the Free Software Foundation.
+ *
+ * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+ * Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#ifndef PALUDIS_GUARD_PALUDIS_UTIL_ELF_TYPES_HH
+#define PALUDIS_GUARD_PALUDIS_UTIL_ELF_TYPES_HH 1
+
+#include <elf.h>
+
+namespace paludis
+{
+ struct Elf32Type
+ {
+ enum {
+ elf_class = ELFCLASS32
+ };
+
+ typedef Elf32_Ehdr Header;
+ typedef Elf32_Shdr SectionHeader;
+ typedef Elf32_Sym Symbol;
+ typedef Elf32_Dyn DynamicEntry;
+ typedef Elf32_Rel Relocation;
+ typedef Elf32_Rela RelocationA;
+
+ typedef Elf32_Off Offset;
+ typedef Elf32_Half Half;
+ typedef Elf32_Word Word;
+ typedef Elf32_Addr Address;
+
+ typedef Elf32_Word DynamicValue;
+ typedef Elf32_Addr DynamicPointer;
+ typedef Elf32_Sword DynamicTag;
+
+ typedef Elf32_Addr RelocationOffset;
+ typedef Elf32_Word RelocationInfo;
+ typedef Elf32_Sword RelocationAddend;
+
+ typedef Elf32_Word SectionSize;
+ };
+
+ struct Elf64Type
+ {
+ enum {
+ elf_class = ELFCLASS64
+ };
+
+ typedef Elf64_Ehdr Header;
+ typedef Elf64_Shdr SectionHeader;
+ typedef Elf64_Sym Symbol;
+ typedef Elf64_Dyn DynamicEntry;
+ typedef Elf64_Rel Relocation;
+ typedef Elf64_Rela RelocationA;
+
+ typedef Elf64_Off Offset;
+ typedef Elf64_Half Half;
+ typedef Elf64_Word Word;
+ typedef Elf64_Xword Xword;
+ typedef Elf64_Sxword Sxword;
+ typedef Elf64_Addr Address;
+
+ typedef Elf64_Xword DynamicValue;
+ typedef Elf64_Addr DynamicPointer;
+ typedef Elf64_Sxword DynamicTag;
+
+ typedef Elf64_Addr RelocationOffset;
+ typedef Elf64_Xword RelocationInfo;
+ typedef Elf64_Sxword RelocationAddend;
+
+ typedef Elf64_Xword SectionSize;
+ };
+}
+
+#endif
+
diff --git a/paludis/util/files.m4 b/paludis/util/files.m4
index cf68c2b..6f58b2f 100644
--- a/paludis/util/files.m4
+++ b/paludis/util/files.m4
@@ -26,6 +26,12 @@ add(`destringify', `hh', `cc', `test')
add(`deferred_construction_ptr', `hh', `cc', `fwd', `test')
add(`dir_iterator', `hh', `cc', `fwd', `se', `test', `testscript')
add(`discard_output_stream', `hh', `cc')
+add(`elf', `hh', `cc')
+add(`elf_dynamic_section', `hh', `cc')
+add(`elf_relocation_section', `hh', `cc')
+add(`elf_sections', `hh', `cc')
+add(`elf_symbol_section', `hh', `cc')
+add(`elf_types', `hh')
add(`enum_iterator', `hh', `cc', `fwd', `test')
add(`exception', `hh', `cc')
add(`executor', `hh', `cc', `fwd')
diff --git a/src/clients/reconcilio/Makefile.am b/src/clients/reconcilio/Makefile.am
index 5960d17..d273d27 100644
--- a/src/clients/reconcilio/Makefile.am
+++ b/src/clients/reconcilio/Makefile.am
@@ -3,7 +3,7 @@ include $(top_srcdir)/misc/common-makefile.am
AM_CXXFLAGS = -I$(top_srcdir) -I$(top_srcdir)/src \
@PALUDIS_CXXFLAGS@ @PALUDIS_CXXFLAGS_VISIBILITY@
-SUBDIRS = littlelf broken_linkage_finder .
+SUBDIRS = broken_linkage_finder .
bin_PROGRAMS = reconcilio
noinst_PROGRAMS = man-reconcilio
@@ -33,7 +33,6 @@ reconcilio_SOURCES = \
reconcilio_LDADD = \
broken_linkage_finder/libbrokenlinkagefinder.a \
- littlelf/liblittlelf.a \
$(top_builddir)/paludis/libpaludis_@PALUDIS_PC_SLOT@.la \
$(top_builddir)/paludis/args/libpaludisargs_@PALUDIS_PC_SLOT@.la \
$(top_builddir)/paludis/util/libpaludisutil_@PALUDIS_PC_SLOT@.la \
diff --git a/src/clients/reconcilio/broken_linkage_finder/Makefile.am b/src/clients/reconcilio/broken_linkage_finder/Makefile.am
index 2b932ae..f9eb301 100644
--- a/src/clients/reconcilio/broken_linkage_finder/Makefile.am
+++ b/src/clients/reconcilio/broken_linkage_finder/Makefile.am
@@ -22,7 +22,6 @@ EXTRA_DIST = \
configuration_TEST_SOURCES = configuration_TEST.cc
configuration_TEST_LDADD = \
libbrokenlinkagefinder.a \
- $(top_builddir)/src/clients/reconcilio/littlelf/liblittlelf.a \
$(top_builddir)/paludis/libpaludis_@PALUDIS_PC_SLOT@.la \
$(top_builddir)/paludis/util/libpaludisutil_@PALUDIS_PC_SLOT@.la \
$(top_builddir)/paludis/util/test_extras.o \
diff --git a/src/clients/reconcilio/broken_linkage_finder/elf_linkage_checker.cc b/src/clients/reconcilio/broken_linkage_finder/elf_linkage_checker.cc
index c51602c..b5eb101 100644
--- a/src/clients/reconcilio/broken_linkage_finder/elf_linkage_checker.cc
+++ b/src/clients/reconcilio/broken_linkage_finder/elf_linkage_checker.cc
@@ -19,11 +19,11 @@
#include "elf_linkage_checker.hh"
-#include <src/clients/reconcilio/littlelf/elf.hh>
-#include <src/clients/reconcilio/littlelf/elf_dynamic_section.hh>
-#include <src/clients/reconcilio/littlelf/elf_types.hh>
-#include <src/clients/reconcilio/littlelf/elf_relocation_section.hh>
-#include <src/clients/reconcilio/littlelf/elf_symbol_section.hh>
+#include <paludis/util/elf.hh>
+#include <paludis/util/elf_dynamic_section.hh>
+#include <paludis/util/elf_types.hh>
+#include <paludis/util/elf_relocation_section.hh>
+#include <paludis/util/elf_symbol_section.hh>
#include <paludis/util/realpath.hh>
#include <paludis/util/fs_entry.hh>
diff --git a/src/clients/reconcilio/littlelf/Makefile.am b/src/clients/reconcilio/littlelf/Makefile.am
deleted file mode 100644
index 570454d..0000000
--- a/src/clients/reconcilio/littlelf/Makefile.am
+++ /dev/null
@@ -1,22 +0,0 @@
-include $(top_srcdir)/misc/common-makefile.am
-
-AM_CXXFLAGS = -I$(top_srcdir) @PALUDIS_CXXFLAGS@ @PALUDIS_CXXFLAGS_NO_WOLD_STYLE_CAST@ @PALUDIS_CXXFLAGS_VISIBILITY@
-
-SUBDIRS = .
-
-noinst_LIBRARIES = liblittlelf.a
-
-liblittlelf_a_SOURCES = \
- elf.cc elf.hh \
- elf_sections.cc elf_sections.hh \
- elf_dynamic_section.cc elf_dynamic_section.hh \
- elf_relocation_section.cc elf_relocation_section.hh \
- elf_symbol_section.cc elf_symbol_section.hh \
- elf_types.hh
-
-TESTS =
-check_PROGRAMS = $(TESTS)
-
-EXTRA_DIST = \
- $(TESTS)
-
diff --git a/src/clients/reconcilio/littlelf/elf.hh b/src/clients/reconcilio/littlelf/elf.hh
deleted file mode 100644
index 3d2aa9d..0000000
--- a/src/clients/reconcilio/littlelf/elf.hh
+++ /dev/null
@@ -1,125 +0,0 @@
-/* vim: set sw=4 sts=4 et foldmethod=syntax : */
-
-/*
- * Copyright (c) 2007 Tiziano Müller
- * Copyright (c) 2007 David Leverton
- *
- * This file is part of the Paludis package manager. Paludis is free software;
- * you can redistribute it and/or modify it under the terms of the GNU General
- * Public License version 2, as published by the Free Software Foundation.
- *
- * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
- * details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
- * Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-#ifndef ELF_HH_
-#define ELF_HH_
-
-#include "elf_sections.hh"
-
-#include <paludis/util/exception.hh>
-#include <paludis/util/private_implementation_pattern.hh>
-#include <paludis/util/wrapped_forward_iterator-fwd.hh>
-#include <iosfwd>
-
-#include <elf.h>
-
-class InvalidElfFileError :
- public paludis::Exception
-{
- public:
- InvalidElfFileError(const InvalidElfFileError &);
- InvalidElfFileError(const std::string &) throw ();
-};
-
-template <typename ElfType_>
-struct ElfObjectSectionIteratorTag;
-
-template <typename ElfType_>
-class ElfObject :
- private paludis::PrivateImplementationPattern<ElfObject<ElfType_> >
-{
- using paludis::PrivateImplementationPattern<ElfObject>::_imp;
-
- private:
- typename ElfType_::Header _hdr;
-
- public:
- static bool is_valid_elf(std::istream & stream);
- ElfObject(std::istream & stream);
- ~ElfObject();
-
- /**
- * Returns e_type from the ELF header
- */
- unsigned int get_type() const
- {
- return _hdr.e_type;
- }
-
- /**
- * Returns e_machine from the ELF header
- */
- unsigned int get_arch() const
- {
- return _hdr.e_machine;
- }
-
- /**
- * Returns the OS ABI field from the ident field
- */
- unsigned char get_os_abi() const
- {
- return _hdr.e_ident[EI_OSABI];
- }
-
- /**
- * Returns the OS ABI Version field from the ident field
- */
- unsigned char get_os_abi_version() const
- {
- return _hdr.e_ident[EI_ABIVERSION];
- }
-
- /**
- * Returns the processor-specific flags
- */
- unsigned int get_flags() const
- {
- return _hdr.e_flags;
- }
-
- /**
- * Returns whether this ELF file uses big-endian or little-endian
- * Please note: If you didn't use is_valid_elf(...) to check whether
- * this is an ELF object, this might be wrong
- */
- unsigned int is_big_endian() const
- {
- // We already checked in is_valid_elf_type whether it's valid or not
- return (_hdr.e_ident[EI_DATA] == ELFDATA2MSB);
- }
-
- unsigned int get_number_of_sections() const
- {
- return _hdr.e_shnum;
- }
-
- typedef ElfObjectSectionIteratorTag<ElfType_> SectionIteratorTag;
- typedef paludis::WrappedForwardIterator<SectionIteratorTag, Section<ElfType_> > SectionIterator;
- SectionIterator section_begin() const;
- SectionIterator section_end() const;
-
- SectionIterator get_section_by_index(unsigned int index) const;
-
- void resolve_all_strings();
-};
-
-
-#endif /*ELF_HH_*/
diff --git a/src/clients/reconcilio/littlelf/elf_dynamic_section.hh b/src/clients/reconcilio/littlelf/elf_dynamic_section.hh
deleted file mode 100644
index 8108c23..0000000
--- a/src/clients/reconcilio/littlelf/elf_dynamic_section.hh
+++ /dev/null
@@ -1,216 +0,0 @@
-/* vim: set sw=4 sts=4 et foldmethod=syntax : */
-
-/*
- * Copyright (c) 2007 Tiziano Müller
- * Copyright (c) 2007 David Leverton
- *
- * This file is part of the Paludis package manager. Paludis is free software;
- * you can redistribute it and/or modify it under the terms of the GNU General
- * Public License version 2, as published by the Free Software Foundation.
- *
- * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
- * details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
- * Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-#ifndef ELFDYNAMICSECTION_HH_
-#define ELFDYNAMICSECTION_HH_
-
-#include "elf_sections.hh"
-
-#include <paludis/util/clone.hh>
-#include <paludis/util/instantiation_policy.hh>
-#include <paludis/util/private_implementation_pattern.hh>
-#include <paludis/util/wrapped_forward_iterator-fwd.hh>
-#include <paludis/util/simple_visitor.hh>
-#include <paludis/util/type_list.hh>
-#include <tr1/memory>
-#include <string>
-#include <iosfwd>
-
-template <typename ElfType_> class DynamicEntry;
-template <typename ElfType_> class DynamicEntryUnknown;
-template <typename ElfType_> class DynamicEntryValue;
-template <typename ElfType_> class DynamicEntryPointer;
-template <typename ElfType_> class DynamicEntryString;
-template <typename ElfType_> class DynamicEntryFlag;
-
-template <typename ElfType_>
-class DynamicEntry :
- public virtual paludis::DeclareAbstractAcceptMethods<DynamicEntry<ElfType_>, typename paludis::MakeTypeList<
- DynamicEntryUnknown<ElfType_>,
- DynamicEntryValue<ElfType_>,
- DynamicEntryPointer<ElfType_>,
- DynamicEntryString<ElfType_>,
- DynamicEntryFlag<ElfType_>
- >::Type>,
- public virtual paludis::Cloneable<DynamicEntry<ElfType_> >
-{
- private:
- std::string _tag_name;
- typename ElfType_::Word _index;
-
- public:
- DynamicEntry(const std::string &);
- ~DynamicEntry();
- virtual void initialize(typename ElfType_::Word, const typename ElfType_::DynamicEntry & entry);
-
- std::string tag_name() const
- {
- return _tag_name;
- }
-
- std::string description() const;
-};
-
-template <typename ElfType_>
-class DynamicEntryUnknown :
- public virtual DynamicEntry<ElfType_>,
- public paludis::ImplementAcceptMethods<DynamicEntry<ElfType_>, DynamicEntryUnknown<ElfType_> >,
- public paludis::CloneUsingThis<DynamicEntry<ElfType_>, DynamicEntryUnknown<ElfType_> >
-{
- public:
- DynamicEntryUnknown();
- virtual ~DynamicEntryUnknown();
-};
-
-template <typename ElfType_>
-class DynamicEntryFlag :
- public virtual DynamicEntry<ElfType_>,
- public paludis::ImplementAcceptMethods<DynamicEntry<ElfType_>, DynamicEntryFlag<ElfType_> >,
- public paludis::CloneUsingThis<DynamicEntry<ElfType_>, DynamicEntryFlag<ElfType_> >
-{
- public:
- DynamicEntryFlag(const std::string &);
- ~DynamicEntryFlag();
-};
-
-template <typename ElfType_>
-class DynamicEntryValue :
- public virtual DynamicEntry<ElfType_>,
- public paludis::ImplementAcceptMethods<DynamicEntry<ElfType_>, DynamicEntryValue<ElfType_> >,
- public paludis::CloneUsingThis<DynamicEntry<ElfType_>, DynamicEntryValue<ElfType_> >
-{
- private:
- typename ElfType_::DynamicValue _value;
-
- public:
- DynamicEntryValue(const std::string &);
- virtual ~DynamicEntryValue();
- virtual void initialize(typename ElfType_::Word, const typename ElfType_::DynamicEntry & entry);
-
- typename ElfType_::DynamicValue operator() () const
- {
- return _value;
- }
-};
-
-template <typename ElfType_>
-class DynamicEntryPointer :
- public virtual DynamicEntry<ElfType_>,
- public paludis::ImplementAcceptMethods<DynamicEntry<ElfType_>, DynamicEntryPointer<ElfType_> >,
- public paludis::CloneUsingThis<DynamicEntry<ElfType_>, DynamicEntryPointer<ElfType_> >
-{
- private:
- typename ElfType_::DynamicPointer _pointer;
-
- public:
- DynamicEntryPointer(const std::string &);
- virtual ~DynamicEntryPointer();
- virtual void initialize(typename ElfType_::Word, const typename ElfType_::DynamicEntry &);
-
- typename ElfType_::DynamicPointer operator() () const
- {
- return _pointer;
- }
-};
-
-namespace littlelf_internals
-{
- template <typename ElfType_> class DynEntriesStringResolvingVisitor;
-}
-
-template <typename ElfType_>
-class DynamicEntryString :
- public virtual DynamicEntry<ElfType_>,
- public paludis::ImplementAcceptMethods<DynamicEntry<ElfType_>, DynamicEntryString<ElfType_> >,
- public paludis::CloneUsingThis<DynamicEntry<ElfType_>, DynamicEntryString<ElfType_> >
-{
- friend class littlelf_internals::DynEntriesStringResolvingVisitor<ElfType_>;
-
- private:
- typename ElfType_::DynamicValue _value;
- std::string _str;
-
- public:
- DynamicEntryString(const std::string &);
- virtual ~DynamicEntryString();
- virtual void initialize(typename ElfType_::Word, const typename ElfType_::DynamicEntry &);
-
- std::string operator() () const
- {
- return _str;
- }
-
- private:
- void resolve_string(std::string str)
- {
- _str = str;
- }
-
- typename ElfType_::DynamicValue get_string_index() const
- {
- return _value;
- }
-};
-
-template <typename ElfType_>
-class DynamicEntries :
- public paludis::InstantiationPolicy<DynamicEntries<ElfType_>, paludis::instantiation_method::SingletonTag>,
- private paludis::PrivateImplementationPattern<DynamicEntries<ElfType_> >
-{
- using paludis::PrivateImplementationPattern<DynamicEntries>::_imp;
- friend class paludis::InstantiationPolicy<DynamicEntries, paludis::instantiation_method::SingletonTag>;
-
- public:
- void register_type(typename ElfType_::DynamicTag, std::tr1::shared_ptr<DynamicEntry<ElfType_> >);
-
- std::tr1::shared_ptr<DynamicEntry<ElfType_> > get_entry(typename ElfType_::DynamicTag) const;
- bool has_entry(typename ElfType_::DynamicTag) const;
-
- private:
- DynamicEntries();
- ~DynamicEntries();
-};
-
-template <typename ElfType_>
-struct DynamicSectionEntryIteratorTag;
-
-template <typename ElfType_>
-class DynamicSection :
- public Section<ElfType_>,
- public paludis::ImplementAcceptMethods<Section<ElfType_>, DynamicSection<ElfType_> >,
- private paludis::PrivateImplementationPattern<DynamicSection<ElfType_> >
-{
- using paludis::PrivateImplementationPattern<DynamicSection>::_imp;
-
- public:
- DynamicSection(typename ElfType_::Word, const typename ElfType_::SectionHeader &, std::istream &, bool);
- virtual ~DynamicSection();
-
- virtual std::string get_type() const;
-
- void resolve_entry_names(Section<ElfType_> &);
-
- typedef DynamicSectionEntryIteratorTag<ElfType_> EntryIteratorTag;
- typedef paludis::WrappedForwardIterator<EntryIteratorTag, DynamicEntry<ElfType_> > EntryIterator;
- EntryIterator entry_begin() const;
- EntryIterator entry_end() const;
-};
-
-#endif /*ELFDYNAMICSECTION_HH_*/
diff --git a/src/clients/reconcilio/littlelf/elf_relocation_section.hh b/src/clients/reconcilio/littlelf/elf_relocation_section.hh
deleted file mode 100644
index 1878f71..0000000
--- a/src/clients/reconcilio/littlelf/elf_relocation_section.hh
+++ /dev/null
@@ -1,120 +0,0 @@
-/* vim: set sw=4 sts=4 et foldmethod=syntax : */
-
-/*
- * Copyright (c) 2007 Tiziano Müller
- * Copyright (c) 2007 David Leverton
- *
- * This file is part of the Paludis package manager. Paludis is free software;
- * you can redistribute it and/or modify it under the terms of the GNU General
- * Public License version 2, as published by the Free Software Foundation.
- *
- * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
- * details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
- * Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-#ifndef ELFRELOCATIONSECTION_HH_
-#define ELFRELOCATIONSECTION_HH_
-
-#include "elf_sections.hh"
-
-#include <paludis/util/private_implementation_pattern.hh>
-#include <paludis/util/wrapped_forward_iterator-fwd.hh>
-
-#include <iosfwd>
-
-template <typename ElfType_>
-class RelocationEntry
-{
- private:
- typename ElfType_::Relocation _my_relocation;
-
- public:
- RelocationEntry(const typename ElfType_::Relocation &);
- ~RelocationEntry();
-
- typename ElfType_::RelocationOffset get_offset() const
- {
- return _my_relocation.r_offset;
- }
-
- typename ElfType_::RelocationInfo get_info() const
- {
- return _my_relocation.r_info;
- }
-};
-
-template <typename ElfType_>
-class RelocationAEntry
-{
- private:
- typename ElfType_::RelocationA _my_relocation;
-
- public:
- RelocationAEntry(const typename ElfType_::RelocationA &);
- ~RelocationAEntry();
-
- typename ElfType_::RelocationOffset get_offset() const
- {
- return _my_relocation.r_offset;
- }
-
- typename ElfType_::RelocationInfo get_info() const
- {
- return _my_relocation.r_info;
- }
-
- typename ElfType_::RelocationAddend get_addend() const
- {
- return _my_relocation.r_addend;
- }
-};
-
-template <typename ElfType_>
-struct Relocation
-{
- typedef typename ElfType_::Relocation Type;
- typedef RelocationEntry<ElfType_> Entry;
- const static std::string type_name;
-};
-
-template <typename ElfType_>
-struct RelocationA
-{
- typedef typename ElfType_::RelocationA Type;
- typedef RelocationAEntry<ElfType_> Entry;
- const static std::string type_name;
-};
-
-template <typename ElfType_, typename Relocation_>
-struct RelocationSectionRelocationIteratorTag;
-
-template <typename ElfType_, typename Relocation_>
-class RelocationSection :
- public Section<ElfType_>,
- public paludis::ImplementAcceptMethods<Section<ElfType_>, RelocationSection<ElfType_, Relocation_> >,
- private paludis::PrivateImplementationPattern<RelocationSection<ElfType_, Relocation_> >
-{
- using paludis::PrivateImplementationPattern<RelocationSection>::_imp;
-
- public:
- RelocationSection(typename ElfType_::Word, const typename ElfType_::SectionHeader &, std::istream &, bool);
- virtual ~RelocationSection();
-
- virtual std::string get_type() const
- {
- return Relocation_::type_name;
- }
-
- typedef RelocationSectionRelocationIteratorTag<ElfType_, Relocation_> RelocationIteratorTag;
- typedef paludis::WrappedForwardIterator<RelocationIteratorTag, const typename Relocation_::Entry> RelocationIterator;
- RelocationIterator relocation_begin() const;
- RelocationIterator relocation_end() const;
-};
-
-#endif /*ELFRELOCATIONSECTION_HH_*/
diff --git a/src/clients/reconcilio/littlelf/elf_sections.hh b/src/clients/reconcilio/littlelf/elf_sections.hh
deleted file mode 100644
index 2dfee56..0000000
--- a/src/clients/reconcilio/littlelf/elf_sections.hh
+++ /dev/null
@@ -1,144 +0,0 @@
-/* vim: set sw=4 sts=4 et foldmethod=syntax : */
-
-/*
- * Copyright (c) 2007 Tiziano Müller
- * Copyright (c) 2007 David Leverton
- *
- * This file is part of the Paludis package manager. Paludis is free software;
- * you can redistribute it and/or modify it under the terms of the GNU General
- * Public License version 2, as published by the Free Software Foundation.
- *
- * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
- * details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
- * Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-#ifndef ELFSECTIONS_HH_
-#define ELFSECTIONS_HH_
-
-#include <string>
-#include <iosfwd>
-#include <paludis/util/simple_visitor.hh>
-#include <paludis/util/type_list.hh>
-
-template <typename ElfType_> class ElfObject;
-template <typename ElfType_> class Section;
-template <typename ElfType_> class StringSection;
-template <typename ElfType_> class DynamicSection;
-template <typename ElfType_> class SymbolSection;
-template <typename ElfType_> class GenericSection;
-template <typename ElfType_, class RelocationType_> class RelocationSection;
-
-template <typename ElfType_> class Relocation;
-template <typename ElfType_> class RelocationA;
-
-namespace littlelf_internals
-{
- template <typename ElfType_> class SectionNameResolvingVisitor;
-}
-
-template <typename ElfType_>
-class Section :
- public virtual paludis::DeclareAbstractAcceptMethods<Section<ElfType_>, typename paludis::MakeTypeList<
- StringSection<ElfType_>,
- DynamicSection<ElfType_>,
- SymbolSection<ElfType_>,
- GenericSection<ElfType_>,
- RelocationSection<ElfType_, Relocation<ElfType_> >,
- RelocationSection<ElfType_, RelocationA<ElfType_> >
- >::Type>
-{
- friend class littlelf_internals::SectionNameResolvingVisitor<ElfType_>;
-
- private:
- typename ElfType_::Word _index;
- typename ElfType_::SectionHeader _shdr;
- std::string _name;
-
- protected:
- void resolve_section_name(std::string name)
- {
- _name = name;
- }
-
- typename ElfType_::Word get_name_index() const
- {
- return _shdr.sh_name;
- }
-
- public:
- Section(typename ElfType_::Word, const typename ElfType_::SectionHeader &);
- virtual ~Section();
-
- virtual typename ElfType_::Offset get_data_offset() const
- {
- return _shdr.sh_offset;
- }
-
- virtual std::string get_name() const
- {
- return _name;
- }
- virtual std::string get_type() const = 0;
- typename ElfType_::Word get_index() const
- {
- return _index;
- }
-
- typename ElfType_::Word get_link_index() const
- {
- return _shdr.sh_link;
- }
-
- typename ElfType_::Address get_virtual_address() const
- {
- return _shdr.sh_addr;
- }
-
- typename ElfType_::SectionSize get_size() const
- {
- return _shdr.sh_size;
- }
-
- std::string description() const;
-};
-
-
-template <typename ElfType_>
-class GenericSection :
- public Section<ElfType_>,
- public paludis::ImplementAcceptMethods<Section<ElfType_>, GenericSection<ElfType_> >
-{
- public:
- GenericSection(typename ElfType_::Word, const typename ElfType_::SectionHeader &);
- virtual ~GenericSection();
- virtual std::string get_type() const;
-};
-
-template <typename ElfType_>
-class StringSection :
- public Section<ElfType_>,
- public paludis::ImplementAcceptMethods<Section<ElfType_>, StringSection<ElfType_> >
-{
- private:
- std::string _stringTable;
-
- public:
- StringSection(typename ElfType_::Word, const typename ElfType_::SectionHeader &, std::istream &, bool);
- virtual ~StringSection();
-
- std::string get_string(typename ElfType_::Word) const;
- typename ElfType_::Word get_max_string() const
- {
- return _stringTable.length();
- }
-
- virtual std::string get_type() const;
-};
-
-#endif /*ELFSECTIONS_HH_*/
diff --git a/src/clients/reconcilio/littlelf/elf_symbol_section.hh b/src/clients/reconcilio/littlelf/elf_symbol_section.hh
deleted file mode 100644
index cefe3fe..0000000
--- a/src/clients/reconcilio/littlelf/elf_symbol_section.hh
+++ /dev/null
@@ -1,108 +0,0 @@
-/* vim: set sw=4 sts=4 et foldmethod=syntax : */
-
-/*
- * Copyright (c) 2007 Tiziano Müller
- * Copyright (c) 2007 David Leverton
- *
- * This file is part of the Paludis package manager. Paludis is free software;
- * you can redistribute it and/or modify it under the terms of the GNU General
- * Public License version 2, as published by the Free Software Foundation.
- *
- * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
- * details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
- * Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-#ifndef ELFSYMBOLSECTION_HH_
-#define ELFSYMBOLSECTION_HH_
-
-#include "elf_sections.hh"
-
-#include <paludis/util/private_implementation_pattern.hh>
-#include <paludis/util/wrapped_forward_iterator-fwd.hh>
-
-#include <iosfwd>
-
-namespace littlelf_internals
-{
- template <typename ElfType_> class SymbolStringResolvingVisitor;
-}
-
-template <typename ElfType_>
-class Symbol
-{
- friend class littlelf_internals::SymbolStringResolvingVisitor<ElfType_>;
-
- private:
- typename ElfType_::Symbol _my_symbol;
- std::string _symbol_name;
- std::string _binding, _visibility;
-
- protected:
- void resolve_symbol(std::string symbol_name)
- {
- _symbol_name = symbol_name;
- }
-
- typename ElfType_::Word get_symbol_index() const
- {
- return _my_symbol.st_name;
- }
-
- public:
- Symbol(const typename ElfType_::Symbol &);
- ~Symbol();
-
- std::string name() const
- {
- return _symbol_name;
- }
-
- std::string binding() const
- {
- return _binding;
- }
-
- std::string visibility() const
- {
- return _visibility;
- }
-};
-
-template <typename ElfType_>
-struct SymbolSectionSymbolIteratorTag;
-
-template <typename ElfType_>
-class SymbolSection :
- public Section<ElfType_>,
- public paludis::ImplementAcceptMethods<Section<ElfType_>, SymbolSection<ElfType_> >,
- private paludis::PrivateImplementationPattern<SymbolSection<ElfType_> >
-{
- using paludis::PrivateImplementationPattern<SymbolSection>::_imp;
-
- private:
- std::string _type;
-
- public:
- SymbolSection(typename ElfType_::Word, const typename ElfType_::SectionHeader &, std::istream &, bool);
- virtual ~SymbolSection();
-
- virtual std::string get_type() const
- {
- return _type;
- }
-
- void resolve_symbols(Section<ElfType_> &);
-
- typedef SymbolSectionSymbolIteratorTag<ElfType_> SymbolIteratorTag;
- typedef paludis::WrappedForwardIterator<SymbolIteratorTag, const Symbol<ElfType_ > > SymbolIterator;
- SymbolIterator symbol_begin() const;
- SymbolIterator symbol_end() const;
-};
-
-#endif /*ELFSYMBOLSECTION_HH_*/
diff --git a/src/clients/reconcilio/littlelf/elf_types.hh b/src/clients/reconcilio/littlelf/elf_types.hh
deleted file mode 100644
index 266b320..0000000
--- a/src/clients/reconcilio/littlelf/elf_types.hh
+++ /dev/null
@@ -1,86 +0,0 @@
-/* vim: set sw=4 sts=4 et foldmethod=syntax : */
-
-/*
- * Copyright (c) 2007 Tiziano Müller
- * Copyright (c) 2007 David Leverton
- *
- * This file is part of the Paludis package manager. Paludis is free software;
- * you can redistribute it and/or modify it under the terms of the GNU General
- * Public License version 2, as published by the Free Software Foundation.
- *
- * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
- * details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
- * Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-#ifndef ELFTYPES_HH_
-#define ELFTYPES_HH_
-
-#include <elf.h>
-
-struct Elf32Type
-{
- enum {
- elf_class = ELFCLASS32
- };
-
- typedef Elf32_Ehdr Header;
- typedef Elf32_Shdr SectionHeader;
- typedef Elf32_Sym Symbol;
- typedef Elf32_Dyn DynamicEntry;
- typedef Elf32_Rel Relocation;
- typedef Elf32_Rela RelocationA;
-
- typedef Elf32_Off Offset;
- typedef Elf32_Half Half;
- typedef Elf32_Word Word;
- typedef Elf32_Addr Address;
-
- typedef Elf32_Word DynamicValue;
- typedef Elf32_Addr DynamicPointer;
- typedef Elf32_Sword DynamicTag;
-
- typedef Elf32_Addr RelocationOffset;
- typedef Elf32_Word RelocationInfo;
- typedef Elf32_Sword RelocationAddend;
-
- typedef Elf32_Word SectionSize;
-};
-
-struct Elf64Type
-{
- enum {
- elf_class = ELFCLASS64
- };
-
- typedef Elf64_Ehdr Header;
- typedef Elf64_Shdr SectionHeader;
- typedef Elf64_Sym Symbol;
- typedef Elf64_Dyn DynamicEntry;
- typedef Elf64_Rel Relocation;
- typedef Elf64_Rela RelocationA;
-
- typedef Elf64_Off Offset;
- typedef Elf64_Half Half;
- typedef Elf64_Word Word;
- typedef Elf64_Xword Xword;
- typedef Elf64_Sxword Sxword;
- typedef Elf64_Addr Address;
-
- typedef Elf64_Xword DynamicValue;
- typedef Elf64_Addr DynamicPointer;
- typedef Elf64_Sxword DynamicTag;
-
- typedef Elf64_Addr RelocationOffset;
- typedef Elf64_Xword RelocationInfo;
- typedef Elf64_Sxword RelocationAddend;
-
- typedef Elf64_Xword SectionSize;
-};
-
-#endif /*ELFTYPES_HH_*/