[PATCH] D43161: Rename DynamicReloc::getAddend() to getRelaAddend(). NFC

Alexander Richardson via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 14 03:37:24 PST 2018


On 13 February 2018 at 16:02, Rafael Avila de Espindola
<rafael.espindola at gmail.com> wrote:
> Alexander Richardson via Phabricator <reviews at reviews.llvm.org> writes:
>
>> Index: ELF/SyntheticSections.h
>> ===================================================================
>> --- ELF/SyntheticSections.h
>> +++ ELF/SyntheticSections.h
>> @@ -316,16 +316,25 @@
>>          UseSymVA(UseSymVA), Addend(Addend) {}
>>
>>    uint64_t getOffset() const;
>> -  int64_t getAddend() const;
>>    uint32_t getSymIndex() const;
>>    const InputSectionBase *getInputSec() const { return InputSec; }
>>
>> +  // Return the value that should be written to the Elf_Rela r_addend field.
>
> This is the same addend value that should be used with Elf_Rel, so the
> description and name are a bit confusing too.
>
> I would suggest keeping the current name or calling it computeAddend and
> add a comment on the lines of:
>
> -------------------------------------------------------------------------
> 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.
> -------------------------------------------------------------------------
>
> Cheers,
> Rafael

It is true that it is the same value that should be used for the rel
addend but we currently add relocations against the input section for
Rel addends instead of using this function.
I'm also happy with computeAddend() and your comment since that
probably makes it even clearer.


More information about the llvm-commits mailing list