[PATCH] D34689: [LLD][ELF] Pre-create ThunkSections at Target specific intervals

Peter Smith via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 17 04:09:53 PDT 2017


Yes you are correct, I'll incorporate that and update the diff.

On 14 July 2017 at 20:04, Rafael Avila de Espindola
<rafael.espindola at gmail.com> wrote:
> Peter Smith via Phabricator <reviews at reviews.llvm.org> writes:
>
>> +  forEachExecInputSectionRange(
>> +      OutputSections, [&](OutputSection *OS, std::vector<InputSection *> *ISR) {
>> +        for (InputSection *IS : *ISR) {
>> +          if (ISR != PrevISR) {
>> +            NeedTrailingTS = true;
>> +            Off = 0;
>> +            Limit = IS->OutSecOff +
>> +                    (Target->ThunkSectionSpacing - Target->ThunkSectionSize);
>> +            PrevIS = nullptr;
>> +            PrevISR = ISR;
>> +          }
>> +          Off = IS->OutSecOff + IS->getSize();
>> +          if (Off >= Limit) {
>> +            uint32_t ThunkOff = (PrevIS == nullptr)
>> +                                    ? IS->OutSecOff
>> +                                    : PrevIS->OutSecOff + PrevIS->getSize();
>> +            addThunkSection(OS, ISR, ThunkOff);
>> +            NeedTrailingTS = false;
>> +            Limit = ThunkOff + Target->ThunkSectionSpacing;
>> +          }
>
> Should this add (Target->ThunkSectionSpacing - Target->ThunkSectionSize)
> instead?
>
> A branch immediately after the previous thunk section will now be more
> than ThunkSectionSize away from the end of the following thunk section.
>
> Cheers,
> Rafael


More information about the llvm-commits mailing list