[PATCH] D43161: Rename DynamicReloc::getAddend() to computeAddend(). NFC
Rafael Avila de Espindola via llvm-commits
llvm-commits at lists.llvm.org
Fri Feb 16 09:51:10 PST 2018
LGTM
Alexander Richardson via Phabricator <reviews at reviews.llvm.org> writes:
> arichardson updated this revision to Diff 134576.
> arichardson retitled this revision from "Rename DynamicReloc::getAddend() to getRelaAddend(). NFC" to "Rename DynamicReloc::getAddend() to computeAddend(). NFC".
> arichardson edited the summary of this revision.
> arichardson added a comment.
>
> Addressed review comment
>
>
> Repository:
> rLLD LLVM Linker
>
> https://reviews.llvm.org/D43161
>
> Files:
> ELF/SyntheticSections.cpp
> ELF/SyntheticSections.h
>
>
> Index: ELF/SyntheticSections.h
> ===================================================================
> --- ELF/SyntheticSections.h
> +++ ELF/SyntheticSections.h
> @@ -316,16 +316,24 @@
> UseSymVA(UseSymVA), Addend(Addend) {}
>
> uint64_t getOffset() const;
> - int64_t getAddend() const;
> uint32_t getSymIndex() const;
> const InputSectionBase *getInputSec() const { return InputSec; }
>
> + // Computes the addend of the dynamic relocation. Note that this is not the
> + // same as the Addend member variable as it also includes the symbol address
> + // if UseSymVA is true.
> + int64_t computeAddend() const;
> +
> RelType Type;
>
> private:
> Symbol *Sym;
> const InputSectionBase *InputSec = nullptr;
> uint64_t OffsetInSec;
> + // If this member is true, the dynamic relocation will not be against the
> + // symbol but will instead be a relative relocation that simply adds the
> + // load address. This means we need to write the symbol virtual address
> + // plus the original addend as the final relocation addend.
> bool UseSymVA;
> int64_t Addend;
> };
> Index: ELF/SyntheticSections.cpp
> ===================================================================
> --- ELF/SyntheticSections.cpp
> +++ ELF/SyntheticSections.cpp
> @@ -1184,7 +1184,7 @@
> return InputSec->getOutputSection()->Addr + InputSec->getOffset(OffsetInSec);
> }
>
> -int64_t DynamicReloc::getAddend() const {
> +int64_t DynamicReloc::computeAddend() const {
> if (UseSymVA)
> return Sym->getVA(Addend);
> return Addend;
> @@ -1236,7 +1236,7 @@
> static void encodeDynamicReloc(typename ELFT::Rela *P,
> const DynamicReloc &Rel) {
> if (Config->IsRela)
> - P->r_addend = Rel.getAddend();
> + P->r_addend = Rel.computeAddend();
> P->r_offset = Rel.getOffset();
> if (Config->EMachine == EM_MIPS && Rel.getInputSec() == InX::MipsGot)
> // The MIPS GOT section contains dynamic relocations that correspond to TLS
>
>
> Index: ELF/SyntheticSections.h
> ===================================================================
> --- ELF/SyntheticSections.h
> +++ ELF/SyntheticSections.h
> @@ -316,16 +316,24 @@
> UseSymVA(UseSymVA), Addend(Addend) {}
>
> uint64_t getOffset() const;
> - int64_t getAddend() const;
> uint32_t getSymIndex() const;
> const InputSectionBase *getInputSec() const { return InputSec; }
>
> + // Computes the addend of the dynamic relocation. Note that this is not the
> + // same as the Addend member variable as it also includes the symbol address
> + // if UseSymVA is true.
> + int64_t computeAddend() const;
> +
> RelType Type;
>
> private:
> Symbol *Sym;
> const InputSectionBase *InputSec = nullptr;
> uint64_t OffsetInSec;
> + // If this member is true, the dynamic relocation will not be against the
> + // symbol but will instead be a relative relocation that simply adds the
> + // load address. This means we need to write the symbol virtual address
> + // plus the original addend as the final relocation addend.
> bool UseSymVA;
> int64_t Addend;
> };
> Index: ELF/SyntheticSections.cpp
> ===================================================================
> --- ELF/SyntheticSections.cpp
> +++ ELF/SyntheticSections.cpp
> @@ -1184,7 +1184,7 @@
> return InputSec->getOutputSection()->Addr + InputSec->getOffset(OffsetInSec);
> }
>
> -int64_t DynamicReloc::getAddend() const {
> +int64_t DynamicReloc::computeAddend() const {
> if (UseSymVA)
> return Sym->getVA(Addend);
> return Addend;
> @@ -1236,7 +1236,7 @@
> static void encodeDynamicReloc(typename ELFT::Rela *P,
> const DynamicReloc &Rel) {
> if (Config->IsRela)
> - P->r_addend = Rel.getAddend();
> + P->r_addend = Rel.computeAddend();
> P->r_offset = Rel.getOffset();
> if (Config->EMachine == EM_MIPS && Rel.getInputSec() == InX::MipsGot)
> // The MIPS GOT section contains dynamic relocations that correspond to TLS
More information about the llvm-commits
mailing list