aboutsummaryrefslogtreecommitdiff
path: root/src/common/linux/synth_elf.cc
diff options
context:
space:
mode:
authorted.mielczarek@gmail.com <ted.mielczarek@gmail.com@4c0a9323-5329-0410-9bdc-e9ce6186880e>2013-03-29 15:06:29 +0000
committerted.mielczarek@gmail.com <ted.mielczarek@gmail.com@4c0a9323-5329-0410-9bdc-e9ce6186880e>2013-03-29 15:06:29 +0000
commit637c392d1c1ab10dd25426212674c771f65bb4bb (patch)
tree8bfb7020e4221e8044e6b5e234ba7183641dfe10 /src/common/linux/synth_elf.cc
parentGet the complete linux gate mapping instead of only one page (diff)
downloadbreakpad-637c392d1c1ab10dd25426212674c771f65bb4bb.tar.xz
Defer adding sections until ELF::Finish in synth_elf
A=Mike Hommey <mh@glandium.org> R=ted at https://breakpad.appspot.com/543002/ git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@1135 4c0a9323-5329-0410-9bdc-e9ce6186880e
Diffstat (limited to 'src/common/linux/synth_elf.cc')
-rw-r--r--src/common/linux/synth_elf.cc20
1 files changed, 14 insertions, 6 deletions
diff --git a/src/common/linux/synth_elf.cc b/src/common/linux/synth_elf.cc
index afaea022..66ba60a3 100644
--- a/src/common/linux/synth_elf.cc
+++ b/src/common/linux/synth_elf.cc
@@ -115,18 +115,22 @@ int ELF::AddSection(const string& name, const Section& section,
// sh_entsize
.Append(endianness(), addr_size_, entsize);
+ sections_.push_back(ElfSection(section, type, offset, offset_label));
+ return index;
+}
+
+void ELF::AppendSection(ElfSection &section) {
// NULL and NOBITS sections have no content, so they
// don't need to be written to the file.
- if (type == SHT_NULL) {
- offset_label = 0;
- } else if (type == SHT_NOBITS) {
- offset_label = offset;
+ if (section.type_ == SHT_NULL) {
+ section.offset_label_ = 0;
+ } else if (section.type_ == SHT_NOBITS) {
+ section.offset_label_ = section.offset_;
} else {
- Mark(&offset_label);
+ Mark(&section.offset_label_);
Append(section);
Align(4);
}
- return index;
}
void ELF::Finish() {
@@ -136,6 +140,10 @@ void ELF::Finish() {
AddSection(".shstrtab", section_header_strings_, SHT_STRTAB);
//printf("section_count_: %ld, sections_.size(): %ld\n",
// section_count_, sections_.size());
+ for (vector<ElfSection>::iterator it = sections_.begin();
+ it < sections_.end(); ++it) {
+ AppendSection(*it);
+ }
section_count_label_ = section_count_;
program_count_label_ = program_count_;
// TODO: allow adding entries to program header table