Read the alignment only when used.

The rest of the header was already read lazily, no point in having align be
special.

llvm-svn: 245863
This commit is contained in:
Rafael Espindola 2015-08-24 19:28:31 +00:00
parent 32fd189de2
commit c5c82916e4
2 changed files with 2 additions and 5 deletions

View File

@ -20,7 +20,6 @@ template <class ELFT>
SectionChunk<ELFT>::SectionChunk(object::ELFFile<ELFT> *Obj,
const Elf_Shdr *Header)
: Obj(Obj), Header(Header) {
Align = Header->sh_addralign;
}
template <class ELFT> void SectionChunk<ELFT>::writeTo(uint8_t *Buf) {

View File

@ -23,6 +23,7 @@ template <class ELFT> class SectionChunk {
typedef llvm::object::Elf_Shdr_Impl<ELFT> Elf_Shdr;
typedef llvm::object::Elf_Rel_Impl<ELFT, true> Elf_Rela;
typedef llvm::object::Elf_Rel_Impl<ELFT, false> Elf_Rel;
typedef typename llvm::object::ELFFile<ELFT>::uintX_t uintX_t;
public:
SectionChunk(llvm::object::ELFFile<ELFT> *Obj, const Elf_Shdr *Header);
@ -39,7 +40,7 @@ public:
// The writer sets and uses the addresses.
uint64_t getOutputSectionOff() { return OutputSectionOff; }
uint32_t getAlign() { return Align; }
uintX_t getAlign() { return Header->sh_addralign; }
void setOutputSectionOff(uint64_t V) { OutputSectionOff = V; }
private:
@ -47,9 +48,6 @@ private:
// to. The writer sets a value.
uint64_t OutputSectionOff = 0;
// The alignment of this chunk. The writer uses the value.
uint32_t Align = 1;
// A file this chunk was created from.
llvm::object::ELFFile<ELFT> *Obj;