Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(60)

Side by Side Diff: tools/relocation_packer/src/elf_file.h

Issue 650293006: Tidy ELF section rewriting internal interface. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | tools/relocation_packer/src/elf_file.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // ELF shared object file updates handler. 5 // ELF shared object file updates handler.
6 // 6 //
7 // Provides functions to remove relative relocations from the .rel.dyn 7 // Provides functions to remove relative relocations from the .rel.dyn
8 // or .rela.dyn sections and pack into .android.rel.dyn or .android.rela.dyn, 8 // or .rela.dyn sections and pack into .android.rel.dyn or .android.rela.dyn,
9 // and unpack to return the file to its pre-packed state. 9 // and unpack to return the file to its pre-packed state.
10 // 10 //
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 93
94 private: 94 private:
95 // Load a new ElfFile from a filedescriptor. If flushing, the file must 95 // Load a new ElfFile from a filedescriptor. If flushing, the file must
96 // be open for read/write. Returns true on successful ELF file load. 96 // be open for read/write. Returns true on successful ELF file load.
97 // |fd| is an open file descriptor for the shared object. 97 // |fd| is an open file descriptor for the shared object.
98 bool Load(); 98 bool Load();
99 99
100 // Templated packer, helper for PackRelocations(). Rel type is one of 100 // Templated packer, helper for PackRelocations(). Rel type is one of
101 // ELF::Rel or ELF::Rela. 101 // ELF::Rel or ELF::Rela.
102 template <typename Rel> 102 template <typename Rel>
103 bool PackTypedRelocations(const std::vector<Rel>& relocations, 103 bool PackTypedRelocations(const std::vector<Rel>& relocations);
104 Elf_Data* data);
105 104
106 // Templated unpacker, helper for UnpackRelocations(). Rel type is one of 105 // Templated unpacker, helper for UnpackRelocations(). Rel type is one of
107 // ELF::Rel or ELF::Rela. 106 // ELF::Rel or ELF::Rela.
108 template <typename Rel> 107 template <typename Rel>
109 bool UnpackTypedRelocations(const std::vector<uint8_t>& packed, 108 bool UnpackTypedRelocations(const std::vector<uint8_t>& packed);
110 Elf_Data* data);
111 109
112 // Write ELF file changes. 110 // Write ELF file changes.
113 void Flush(); 111 void Flush();
114 112
115 // File descriptor opened on the shared object. 113 // File descriptor opened on the shared object.
116 int fd_; 114 int fd_;
117 115
118 // If set, pad rather than shrink .rel.dyn or .rela.dyn. Primarily for 116 // If set, pad rather than shrink .rel.dyn or .rela.dyn. Primarily for
119 // debugging, allows packing to be checked without affecting load addresses. 117 // debugging, allows packing to be checked without affecting load addresses.
120 bool is_padding_relocations_; 118 bool is_padding_relocations_;
121 119
122 // Libelf handle, assigned by Load(). 120 // Libelf handle, assigned by Load().
123 Elf* elf_; 121 Elf* elf_;
124 122
125 // Sections that we manipulate, assigned by Load(). 123 // Sections that we manipulate, assigned by Load().
126 Elf_Scn* relocations_section_; 124 Elf_Scn* relocations_section_;
127 Elf_Scn* dynamic_section_; 125 Elf_Scn* dynamic_section_;
128 Elf_Scn* android_relocations_section_; 126 Elf_Scn* android_relocations_section_;
129 127
130 // Relocation type found, assigned by Load(). 128 // Relocation type found, assigned by Load().
131 enum { NONE = 0, REL, RELA } relocations_type_; 129 enum { NONE = 0, REL, RELA } relocations_type_;
132 }; 130 };
133 131
134 } // namespace relocation_packer 132 } // namespace relocation_packer
135 133
136 #endif // TOOLS_RELOCATION_PACKER_SRC_ELF_FILE_H_ 134 #endif // TOOLS_RELOCATION_PACKER_SRC_ELF_FILE_H_
OLDNEW
« no previous file with comments | « no previous file | tools/relocation_packer/src/elf_file.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698