1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 // Pack relative relocations into a more compact form.
7 #ifndef TOOLS_RELOCATION_PACKER_SRC_PACKER_H_
8 #define TOOLS_RELOCATION_PACKER_SRC_PACKER_H_
15 namespace relocation_packer
{
17 // A RelocationPacker packs vectors of relocations into more
18 // compact forms, and unpacks them to reproduce the pre-packed data.
19 template <typename ELF
>
20 class RelocationPacker
{
22 // Pack relocations into a more compact form.
23 // |relocations| is a vector of relocation structs.
24 // |packed| is the vector of packed bytes into which relocations are packed.
25 static void PackRelocations(const std::vector
<typename
ELF::Rela
>& relocations
,
26 std::vector
<uint8_t>* packed
);
28 // Unpack relocations from their more compact form.
29 // |packed| is the vector of packed relocations.
30 // |relocations| is a vector of unpacked relocation structs.
31 static void UnpackRelocations(const std::vector
<uint8_t>& packed
,
32 std::vector
<typename
ELF::Rela
>* relocations
);
35 } // namespace relocation_packer
37 #endif // TOOLS_RELOCATION_PACKER_SRC_PACKER_H_