Header(Hdr), File(File), Repl(this) {
// The ELF spec states that a value of 0 means the section has
// no alignment constraits.
- uint64_t V = std::max<uint64_t>(Header->sh_addralign, 1);
+ uint64_t V = std::max<uint64_t>(Hdr->sh_addralign, 1);
if (!isPowerOf2_64(V))
fatal(getFilename(File) + ": section sh_addralign is not a power of 2");
// shouldn't be significant in ELF.) We need to be able to read both.
ArrayRef<uint8_t> Buf; // Compressed data
size_t Size; // Uncompressed size
- if (Header->sh_flags & SHF_COMPRESSED)
+ if (getFlags() & SHF_COMPRESSED)
std::tie(Buf, Size) = getElfCompressedData(Data);
else
std::tie(Buf, Size) = getRawCompressedData(Data);
template <class ELFT>
InputSectionBase<ELFT> *InputSection<ELFT>::getRelocatedSection() {
- assert(this->Header->sh_type == SHT_RELA || this->Header->sh_type == SHT_REL);
+ assert(this->getType() == SHT_RELA || this->getType() == SHT_REL);
ArrayRef<InputSectionBase<ELFT> *> Sections = this->File->getSections();
- return Sections[this->Header->sh_info];
+ return Sections[this->getInfo()];
}
template <class ELFT> void InputSection<ELFT>::addThunk(const Thunk<ELFT> *T) {
// vector only for SHF_ALLOC'ed sections. For other sections,
// we handle relocations directly here.
auto *IS = dyn_cast<InputSection<ELFT>>(this);
- if (IS && !(IS->Header->sh_flags & SHF_ALLOC)) {
+ if (IS && !(IS->getFlags() & SHF_ALLOC)) {
for (const Elf_Shdr *RelSec : IS->RelocSections) {
if (RelSec->sh_type == SHT_RELA)
IS->relocateNonAlloc(Buf, IS->File->getObj().relas(RelSec));
}
template <class ELFT> void InputSection<ELFT>::writeTo(uint8_t *Buf) {
- if (this->Header->sh_type == SHT_NOBITS)
+ if (this->getType() == SHT_NOBITS)
return;
ELFFile<ELFT> &EObj = this->File->getObj();
// If -r is given, then an InputSection may be a relocation section.
- if (this->Header->sh_type == SHT_RELA) {
+ if (this->getType() == SHT_RELA) {
copyRelocations(Buf + OutSecOff, EObj.relas(this->Header));
return;
}
- if (this->Header->sh_type == SHT_REL) {
+ if (this->getType() == SHT_REL) {
copyRelocations(Buf + OutSecOff, EObj.rels(this->Header));
return;
}
template <class ELFT> void MergeInputSection<ELFT>::splitIntoPieces() {
ArrayRef<uint8_t> Data = this->Data;
- uintX_t EntSize = this->Header->sh_entsize;
- if (this->Header->sh_flags & SHF_STRINGS)
+ uintX_t EntSize = this->getEntsize();
+ if (this->getFlags() & SHF_STRINGS)
this->Pieces = splitStrings(Data, EntSize);
else
this->Pieces = splitNonStrings(Data, EntSize);