The current TLSDESC optimization code assumes:
leaq x@tlsdesc(%rip), %rax call *x@tlscall(%rax) # adjacent
From https://gitlab.freedesktop.org/mesa/mesa/-/issues/5665 , it seems that the
two instructions may not be adjacent in GCC 10's output:
leaq x@tlsdesc(%rip), %rax something else call *x@tlscall(%rax)
This patch supports the case. While here, support non-RAX registers for
R_X86_64_GOTPC32_TLSDESC, in case the compiler generates inefficient:
leaq x@tlsdesc(%rip), %rcx # or %rdx, %rbx, %rdi, ... movq %rcx, %rax call *x@tlscall(%rax) # GNU ld/gold error for non-RAX
REX.X and REX.B does not affect RIP-relative addressing. I believe we should use mask
0xf8 for loc[-3].