[lld] r262026 - Add comment on AMDGPU that the difference has no obvious reason.

Rui Ueyama via llvm-commits llvm-commits at lists.llvm.org
Fri Feb 26 11:46:31 PST 2016


At least when the AMDGPU support was added (which happened last month in
http://reviews.llvm.org/D15895), the AMDGPU documents were not published.
So I think it's still not available.

On Fri, Feb 26, 2016 at 11:39 AM, Sean Silva <chisophugis at gmail.com> wrote:

>
>
> On Fri, Feb 26, 2016 at 7:39 AM, Rui Ueyama via llvm-commits <
> llvm-commits at lists.llvm.org> wrote:
>
>> Author: ruiu
>> Date: Fri Feb 26 09:39:26 2016
>> New Revision: 262026
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=262026&view=rev
>> Log:
>> Add comment on AMDGPU that the difference has no obvious reason.
>>
>> Modified:
>>     lld/trunk/ELF/OutputSections.cpp
>>     lld/trunk/ELF/Symbols.cpp
>>
>> Modified: lld/trunk/ELF/OutputSections.cpp
>> URL:
>> http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/OutputSections.cpp?rev=262026&r1=262025&r2=262026&view=diff
>>
>> ==============================================================================
>> --- lld/trunk/ELF/OutputSections.cpp (original)
>> +++ lld/trunk/ELF/OutputSections.cpp Fri Feb 26 09:39:26 2016
>> @@ -1456,8 +1456,11 @@ void SymbolTableSection<ELFT>::writeLoca
>>          const OutputSectionBase<ELFT> *OutSec = Section->OutSec;
>>          ESym->st_shndx = OutSec->SectionIndex;
>>          VA = Section->getOffset(*Sym);
>> -        // Symbol offsets for AMDGPU need to be the offset in bytes of
>> the
>> -        // symbol from the beginning of the section.
>> +
>> +        // Symbol offsets for AMDGPU are the offsets in bytes of the
>> +        // symbols from the beginning of the section. There seems to be
>> no
>> +        // reason for that deviation -- it's just that the definition of
>> +        // st_value field in AMDGPU's ELF is odd.
>>          if (Config->EMachine != EM_AMDGPU)
>>            VA += OutSec->getVA();
>>        }
>>
>> Modified: lld/trunk/ELF/Symbols.cpp
>> URL:
>> http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Symbols.cpp?rev=262026&r1=262025&r2=262026&view=diff
>>
>> ==============================================================================
>> --- lld/trunk/ELF/Symbols.cpp (original)
>> +++ lld/trunk/ELF/Symbols.cpp Fri Feb 26 09:39:26 2016
>> @@ -44,10 +44,12 @@ typename ELFFile<ELFT>::uintX_t SymbolBo
>>        return D->Sym.st_value;
>>      assert(SC->Live);
>>
>> -    // Symbol offsets for AMDGPU need to be the offset in bytes of the
>> symbol
>> -    // from the beginning of the section.
>> +    // Symbol offsets for AMDGPU are the offsets in bytes of the symbols
>> +    // from the beginning of the section. Note that this part of AMDGPU's
>> +    // ELF spec is odd and not in line with the standard ELF.
>>
>
> Where is this "AMDGPU ELF spec"? I don't see it in
> http://llvm.org/docs/CompilerWriterInfo.html#amdgpu and the original
> http://reviews.llvm.org/D15895 doesn't have a spec reference.
>
> -- Sean Silva
>
>
>>      if (Config->EMachine == EM_AMDGPU)
>>        return SC->getOffset(D->Sym);
>> +
>>      if (D->Sym.getType() == STT_TLS)
>>        return SC->OutSec->getVA() + SC->getOffset(D->Sym) -
>>               Out<ELFT>::TlsPhdr->p_vaddr;
>>
>>
>> _______________________________________________
>> llvm-commits mailing list
>> llvm-commits at lists.llvm.org
>> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160226/73b9058b/attachment.html>


More information about the llvm-commits mailing list