[PATCH] D28956: [LLD][ELF] Add support for local symbols in Synthetic Sections
Peter Smith via llvm-commits
llvm-commits at lists.llvm.org
Wed Jan 25 02:48:43 PST 2017
Thanks for the comments.
Yes they can be casts, I've made that change.
I think it would be possible to make a common base class. I did think
about it at the time but was unsure whether it would have made the
patch more difficult to understand. I can have another go to see if I
can come up with something better.
Peter
On 24 January 2017 at 23:59, Rafael Avila de Espindola
<rafael.espindola at gmail.com> wrote:
> Peter Smith via Phabricator <reviews at reviews.llvm.org> writes:
>
>> +void ARMTargetInfo::addPltHeaderSymbols(InputSectionData* ISD) const {
>> + auto* IS = dyn_cast<InputSection<ELF32LE>>(ISD);
>
> Can this be a cast<>?
>
>> + addSyntheticLocal("$a", STT_NOTYPE, 0, 0, IS);
>> + addSyntheticLocal("$d", STT_NOTYPE, 16, 0, IS);
>> +}
>> +
>> void ARMTargetInfo::writePlt(uint8_t *Buf, uint64_t GotEntryAddr,
>> uint64_t PltEntryAddr, int32_t Index,
>> unsigned RelOff) const {
>> @@ -1748,6 +1756,13 @@
>> write32le(Buf + 12, GotEntryAddr - L1 - 8);
>> }
>>
>> +void ARMTargetInfo::addPltSymbols(InputSectionData* ISD, uint64_t Off) const
>> +{
>> + auto* IS = dyn_cast<InputSection<ELF32LE>>(ISD);
>
> and this?
>
>> + addSyntheticLocal("$a", STT_NOTYPE, Off, 0, IS);
>> + addSyntheticLocal("$d", STT_NOTYPE, Off + 12, 0, IS);
>> +}
>> +
>> RelExpr ARMTargetInfo::getThunkExpr(RelExpr Expr, uint32_t RelocType,
>> const InputFile *File,
>> const SymbolBody &S) const {
>
>> + return S;
>> +}
>> +
>> static size_t getHashSize() {
>> switch (Config->BuildId) {
>> case BuildIdKind::Fast:
>> @@ -1441,6 +1453,15 @@
>> return Target->PltHeaderSize + Entries.size() * Target->PltEntrySize;
>> }
>>
>> +template <class ELFT> void PltSection<ELFT>::addSymbols() {
>> + Target->addPltHeaderSymbols(this);
>> + size_t Off = Target->PltHeaderSize;
>> + for (size_t I = 0; I < Entries.size(); ++I) {
>> + Target->addPltSymbols(this, Off);
>> + Off += Target->PltEntrySize;
>> + }
>> +}
>> +
>> template <class ELFT>
>> IpltSection<ELFT>::IpltSection()
>> : SyntheticSection<ELFT>(SHF_ALLOC | SHF_EXECINSTR, SHT_PROGBITS, 16,
>> @@ -1471,6 +1492,14 @@
>> return Entries.size() * Target->PltEntrySize;
>> }
>>
>> +template <class ELFT> void IpltSection<ELFT>::addSymbols() {
>> + size_t Off = 0;
>> + for (size_t I = 0; I < Entries.size(); ++I) {
>> + Target->addPltSymbols(this, Off);
>> + Off += Target->PltEntrySize;
>> + }
>> +}
>
> Would it be possible to add a common base class to PltSection and
> Ipltsection and share this code?
>
> These can be done after commit, LGTM.
>
> Cheers,
> Rafael
More information about the llvm-commits
mailing list