Changeset View
Changeset View
Standalone View
Standalone View
ELF/SyntheticSections.cpp
Show First 20 Lines • Show All 1,196 Lines • ▼ Show 20 Lines | |||||
} | } | ||||
RelocationBaseSection::RelocationBaseSection(StringRef Name, uint32_t Type, | RelocationBaseSection::RelocationBaseSection(StringRef Name, uint32_t Type, | ||||
int32_t DynamicTag, | int32_t DynamicTag, | ||||
int32_t SizeDynamicTag) | int32_t SizeDynamicTag) | ||||
: SyntheticSection(SHF_ALLOC, Type, Config->Wordsize, Name), | : SyntheticSection(SHF_ALLOC, Type, Config->Wordsize, Name), | ||||
DynamicTag(DynamicTag), SizeDynamicTag(SizeDynamicTag) {} | DynamicTag(DynamicTag), SizeDynamicTag(SizeDynamicTag) {} | ||||
void RelocationBaseSection::addReloc(const DynamicReloc &Reloc, RelExpr Expr, | |||||
RelType Type) { | |||||
// REL type relocations don't have addend fields unlike RELAs, and | |||||
// their addends are stored to the section to which they are applied. | |||||
// So, store addends if we need to. | |||||
if (!Config->IsRela && Reloc.UseSymVA) | |||||
Reloc.getInputSec()->Relocations.push_back( | |||||
{Expr, Type, Reloc.OffsetInSec, Reloc.Addend, Reloc.Sym}); | |||||
addReloc(Reloc); | |||||
} | |||||
void RelocationBaseSection::addReloc(const DynamicReloc &Reloc) { | void RelocationBaseSection::addReloc(const DynamicReloc &Reloc) { | ||||
if (Reloc.Type == Target->RelativeRel) | if (Reloc.Type == Target->RelativeRel) | ||||
++NumRelativeRelocs; | ++NumRelativeRelocs; | ||||
Relocs.push_back(Reloc); | Relocs.push_back(Reloc); | ||||
} | } | ||||
void RelocationBaseSection::finalizeContents() { | void RelocationBaseSection::finalizeContents() { | ||||
// If all relocations are R_*_RELATIVE they don't refer to any | // If all relocations are R_*_RELATIVE they don't refer to any | ||||
▲ Show 20 Lines • Show All 1,486 Lines • Show Last 20 Lines |