https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114621

--- Comment #5 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
While for the local exec we happily use something like
        movq    %fs:0, %rax
        movabsq $b@tpoff+34359738367, %rdx
        addq    %rdx, %rax
        movzbl  (%rax), %eax
we normally use instructions like
        movsbl  %fs:b@tpoff+31, %eax
Thus, I'd say at least in the normal code models we have a restriction that the
static TLS area of the whole program must fit into 2GB.
If we want to support something larger, we'd need to use 64-bit relocations
consistently for all LE/IE accesses regardless of whether the immediate offset
into them is > 2GB or not, because it could just be that some other library has
the static TLS area > 2GB and comes earlier, or some other TU etc.
x86-64 has both R_X86_64_TPOFF32 and R_X86_64_TPOFF64 relocations, but it
wouldn't help if we use the 32-bit ones in say
char a;
__thread char b[0x100000000L];
__thread char c[32L];

int
foo (void)
{
  return c[31L];
}
it just won't really link.

Reply via email to