[PATCH] D71143: [ELF][Hexagon] Add support for TLS IE relocations

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 6 15:22:20 PST 2020


MaskRay added a comment.

In D71143#1806854 <https://reviews.llvm.org/D71143#1806854>, @sidneym wrote:

> In D71143#1806565 <https://reviews.llvm.org/D71143#1806565>, @MaskRay wrote:
>
> > I'd like to ask some questions which can help understand the situation better.
> >
> > - Does Hexagon have a binutils port or an alternative linker?
>
>
> The binutils port was never made public.  The internal linker can be downloaded with a click-thu license agreement, the same one needed to get to the ABI spec.  That linker is a branch of mclinker.


Like @ruiu argued before, a click-thu license agreement may be unacceptable in many environments. I am also concerned whether a click-thru license agreement is considered 100% GPLv3 conformance.

>> - Is -pie and -shared used a lot on Hexagon?
> 
> -pie isn't but shared is.
> 
>> - How is Hexagon's dynamic loader ld.so implemented? Is the source code available?
> 
> The code isn't yet available from Qualcomm but we have a port of MUSL and I don't think much more than adding the #defines to reloc.h and the files dlsym.s/tlsdesc.s was done.  Nothing weird for hexagon.

The source code will be appreciated.

>> - How is TLS going to be used on Hexagon?
> 
> There isn't anything out of the ordinary in how it is used and it is necessary for C++11 support.
> 
>> - Is text relocations acceptable?
> 
> No.  The reason I needed to add the -z notext in the -shared test was because technically the wrong relocations were being used.  I did that so that I could condense the IE patch into a single file testcase.

Not entirely wrong, and used in practice, e.g. libGL.so and libGLESv2.so use DT_STATIC_TLS. There are certain PC relative instructions, so `R_GOT` looks out-of-place to me. I hope this can be changed.



================
Comment at: lld/ELF/Arch/Hexagon.cpp:137
+  case R_HEX_IE_GOT_HI16:
+  case R_HEX_IE_GOT_LO16:
     return R_GOTPLT;
----------------
Add `config->hasStaticTlsModel = true;` if you use Initial Exec TLS model. And create a llvm-readelf -d test (see riscv-tls-ie.s).


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D71143/new/

https://reviews.llvm.org/D71143





More information about the llvm-commits mailing list