[all-commits] [llvm/llvm-project] 02e02f: [LLD][PowerPC] Add check in LLD to produce an erro...

stefanp-ibm via All-commits all-commits at lists.llvm.org
Fri Aug 21 10:56:30 PDT 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 02e02f5398d00c3914d87b640b5c626e211dca7a
      https://github.com/llvm/llvm-project/commit/02e02f5398d00c3914d87b640b5c626e211dca7a
  Author: Stefan Pintilie <stefanp at ca.ibm.com>
  Date:   2020-08-21 (Fri, 21 Aug 2020)

  Changed paths:
    M lld/ELF/Relocations.cpp
    A lld/test/ELF/ppc64-tls-missing-gdld.s

  Log Message:
  -----------
  [LLD][PowerPC] Add check in LLD to produce an error for missing TLSGD/TLSLD

The function `__tls_get_addr` is used to get the address of an object that is Thread Local Storage.
It needs to have two relocations on it.
One relocation is for the function call itself and it is either R_PPC64_REL24 or R_PPC64_REL24_NOTOC.
The other is R_PPC64_TLSGD or R_PPC64_TLSLD for the symbol that is having its address computed.

In the early days of the transition from the ELFv1 ABI that is used for big endian PowerPC Linux distributions to the ELFv2 ABI that is used for little endian PowerPC Linux distributions, there was some ambiguity in the specification of the relocations for TLS. The GNU linker has implemented support for correct handling of calls to __tls_get_addr with a missing relocation. Unfortunately, we didn't notice that the IBM XL compiler did not handle TLS according to the updated ABI until we tried linking XL compiled libraries with LLD. As a result, there is a lot of code out there in various libraries compiled with XL that have this problem.

This patch adds a new error check in LLD that makes sure calls to `__tls_get_addr` are not missing the TLSGD/TLSLD relocation.

Reviewed By: MaskRay

Differential Revision: https://reviews.llvm.org/D85994




More information about the All-commits mailing list