[ELF] Support non-RAX/non-adjacent R_X86_64_GOTPC32_TLSDESC/R_X86_64_TLSDESC_CALL
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 ``` Differential Revision: https://reviews.llvm.org/D114416
Loading
Please sign in to comment