Bug 628618 part 4 - Initially set an address for the fake phdr ElfSection. r=tglek,a=sdwilsh

This commit is contained in:
Mike Hommey 2011-01-28 09:22:58 +01:00
Родитель f7c4f106f0
Коммит 276396ec0a
1 изменённых файлов: 2 добавлений и 1 удалений

Просмотреть файл

@ -229,6 +229,7 @@ Elf::Elf(std::ifstream &file)
// Fake section for program headers
s.sh_offset = ehdr->e_phoff;
s.sh_addr = ehdr->e_phoff;
s.sh_entsize = Elf_Phdr::size(e_ident[EI_CLASS]);
s.sh_size = s.sh_entsize * ehdr->e_phnum;
phdr_section = new ElfSection(s, NULL, NULL);
@ -269,7 +270,7 @@ Elf::Elf(std::ifstream &file)
if ((phdr.p_type == PT_LOAD) && (phdr.p_offset == 0)) {
// Use a fake section for ehdr and phdr
ehdr->getShdr().sh_addr = phdr.p_vaddr;
phdr_section->getShdr().sh_addr = phdr.p_vaddr + ehdr->e_ehsize;
phdr_section->getShdr().sh_addr += phdr.p_vaddr;
segment->addSection(ehdr);
segment->addSection(phdr_section);
ehdr->markDirty();