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

Sid Manning via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 6 14:16:40 PST 2020


sidneym added a comment.

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.

> - 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.

> - 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.

> - Is it really impossible to use a PC-relative GOT address load on Hexagon? `R_GOT` on EM_386 has severe limitations. `EM_X86_64` fixed these issues. (I don't want to see newer architectures behave like it.)

The R_HEX_IE_GOT... are used for shared/pic code.   As far as I know the R_HEX_IE_32_6_X/16_X.. are used only when building static code.  The ABI has examples for both of these IE static and IE for PIC.

> I shall also mention that this is unfortunate.
> 
>>   bool canRelax = config->emachine != EM_ARM &&
>>                   config->emachine != EM_RISCV;
> 
> RISC-V TLS has several problems. Its design/implementation was copied from ARM/MIPS. The two architectures really do not provide the best reference for TLS implementations. The RISC-V TLS implementation has several defects. I've reported a few bugs on the binutils bugzilla.




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

https://reviews.llvm.org/D71143





More information about the llvm-commits mailing list