<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Feb 26, 2016 at 10:42 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"><div dir="ltr">I don't know what the intention there,</div></blockquote><div><br></div><div>I think this is the most important thing: we need to understand what they are trying to model.</div><div><br></div><div>We can probably model this within ELF by just putting each section inside a PT_LOAD (or whatever getAmdgpuPhdr returns) with vaddr of 0.</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"><div dir="ltr"> but at least the current output for AMDGPU has a program header, which you can't get with -r. So, does that work?</div><div class=""><div class="h5"><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Feb 26, 2016 at 10:40 AM, Rafael Espíndola <span dir="ltr"><<a href="mailto:rafael.espindola@gmail.com" target="_blank">rafael.espindola@gmail.com</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">Hi Tom,<br>
<br>
As mentioned before, according to the ELF spec executable and shared<br>
object files *must* use virtual addresses, not offsets. This is simply<br>
not valid ELF and a very slippery slope I would much prefer lld and<br>
llvm to not be on. This has the potential of hitting far more places<br>
than the IsMips64EL issue.<br>
<br>
We are now adding support for -r, where it is correct (required) to<br>
use offsets. Could you please delete this code and just require that<br>
-r be used with the AMDGPU target?<br>
<br>
Cheers,<br>
Rafael<br>
<br>
<br>
<br>
On 26 February 2016 at 10:39, Rui Ueyama via llvm-commits<br>
<div><div><<a href="mailto:llvm-commits@lists.llvm.org" target="_blank">llvm-commits@lists.llvm.org</a>> wrote:<br>
> 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>
>      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" target="_blank">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>
</div></div></blockquote></div><br></div>
</div></div><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>
<br></blockquote></div><br></div></div>