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