Make some parts of ELF more (pointer) aligned.
I am not aware of any problem at the moment, but better
be safe than sorry. I have noticed that we align less
when comparing our output with output of other tools.
Bug: 20556771
Change-Id: I904e66f5b7776f64cc90ec2802ddb2c630b64d08
diff --git a/compiler/elf_builder.h b/compiler/elf_builder.h
index fa69434..bbd962f 100644
--- a/compiler/elf_builder.h
+++ b/compiler/elf_builder.h
@@ -310,7 +310,7 @@
SymtabSection(const std::string& name, Elf_Word type, Elf_Word flags,
StrtabSection* strtab)
- : Section(name, type, flags, strtab, 0, sizeof(Elf_Word), sizeof(Elf_Sym)),
+ : Section(name, type, flags, strtab, 0, sizeof(Elf_Off), sizeof(Elf_Sym)),
strtab_(strtab) {
}
@@ -677,7 +677,7 @@
// Collect section headers into continuous array for convenience.
section_headers.push_back(*header);
}
- Elf_Off section_headers_offset = RoundUp(file_offset, sizeof(Elf_Word));
+ Elf_Off section_headers_offset = RoundUp(file_offset, sizeof(Elf_Off));
// Create program headers now that we know the layout of the whole file.
// Each segment contains one or more sections which are mapped together.
@@ -713,7 +713,7 @@
}
DCHECK_EQ(program_headers[0].p_type, 0u); // Check placeholder.
program_headers[0] = MakeProgramHeader(PT_PHDR, PF_R,
- kProgramHeadersOffset, program_headers.size() * sizeof(Elf_Phdr), sizeof(Elf_Word));
+ kProgramHeadersOffset, program_headers.size() * sizeof(Elf_Phdr), sizeof(Elf_Off));
CHECK_LE(program_headers.size(), kMaxProgramHeaders);
// Create the main ELF header.