@@ -136,8 +136,8 @@ class ElfFile
136136 bool operator ()(const Elf_Phdr & x, const Elf_Phdr & y)
137137 {
138138 // A PHDR comes before everything else.
139- if (y.p_type == PT_PHDR) return false ;
140- if (x.p_type == PT_PHDR) return true ;
139+ if (elfFile-> rdi ( y.p_type ) == PT_PHDR) return false ;
140+ if (elfFile-> rdi ( x.p_type ) == PT_PHDR) return true ;
141141
142142 // Sort non-PHDRs by address.
143143 return elfFile->rdi (x.p_paddr ) < elfFile->rdi (y.p_paddr );
@@ -453,7 +453,7 @@ unsigned int ElfFile<ElfFileParamNames>::getPageSize() const
453453 // Architectures (and ABIs) can have different minimum section alignment
454454 // requirements. There is no authoritative list of these values. The
455455 // current list is extracted from GNU gold's source code (abi_pagesize).
456- switch (hdr->e_machine ) {
456+ switch (rdi ( hdr->e_machine ) ) {
457457 case EM_SPARC:
458458 case EM_MIPS:
459459 case EM_PPC:
@@ -665,7 +665,7 @@ void ElfFile<ElfFileParamNames>::writeReplacedSections(Elf_Off & curOff,
665665 for (auto & i : replacedSections) {
666666 std::string sectionName = i.first ;
667667 Elf_Shdr & shdr = findSection (sectionName);
668- if (shdr.sh_type != SHT_NOBITS)
668+ if (rdi ( shdr.sh_type ) != SHT_NOBITS)
669669 memset (contents + rdi (shdr.sh_offset ), ' X' , rdi (shdr.sh_size ));
670670 }
671671
@@ -778,9 +778,9 @@ void ElfFile<ElfFileParamNames>::rewriteSectionsLibrary()
778778 /* Some sections may already be replaced so account for that */
779779 unsigned int i = 1 ;
780780 Elf_Addr pht_size = sizeof (Elf_Ehdr) + (phdrs.size () + num_notes + 1 )*sizeof (Elf_Phdr);
781- while ( shdrs[i].sh_offset <= pht_size && i < rdi (hdr->e_shnum ) ) {
781+ while ( rdi ( shdrs[i].sh_offset ) <= pht_size && i < rdi (hdr->e_shnum ) ) {
782782 if (not haveReplacedSection (getSectionName (shdrs[i])))
783- replaceSection (getSectionName (shdrs[i]), shdrs[i].sh_size );
783+ replaceSection (getSectionName (shdrs[i]), rdi ( shdrs[i].sh_size ) );
784784 i++;
785785 }
786786
@@ -835,7 +835,7 @@ void ElfFile<ElfFileParamNames>::rewriteSectionsLibrary()
835835 assert (curOff == startOffset + neededSpace);
836836
837837 /* Write out the updated program and section headers */
838- rewriteHeaders (hdr->e_phoff );
838+ rewriteHeaders (rdi ( hdr->e_phoff ) );
839839}
840840
841841
0 commit comments