[PATCH] D18333: [ELF/AArch64] Fix TLS IE to LE relax for local symbols

Adhemerval Zanella via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 21 15:37:35 PDT 2016


zatrazz added a comment.

In fact the rebase against your patch to implement TLSDESC made the changes not necessary. The original change as basically:

bool AArch64TargetInfo::needsGot(uint32_t Type, SymbolBody &S) const {

- if (Type == R_AARCH64_TLSIE_LD64_GOTTPREL_LO12_NC ||
- Type == R_AARCH64_TLSIE_ADR_GOTTPREL_PAGE21)
- return true;

+  if (isTlsInitialExecRel(Type))
+    return canBePreempted(&S);

Where the TLSDESC [1] now does:

bool AArch64TargetInfo::refersToGotEntry(uint32_t Type,

                                         const SymbolBody &S) const {
  switch (Type) {
  case R_AARCH64_TLSIE_ADR_GOTTPREL_PAGE21:
  case R_AARCH64_TLSIE_LD64_GOTTPREL_LO12_NC:
    return !canRelaxTls(Type, &S);
  case R_AARCH64_ADR_GOT_PAGE:
  case R_AARCH64_LD64_GOT_LO12_NC:
    return true;
  default:
    return false;
  }

}

bool AArch64TargetInfo::needsGot(uint32_t Type, SymbolBody &S) const {

  return refersToGotEntry(Type, S) || needsPlt<ELF64LE>(Type, S);

}

Where 'canRelaxTls' now have the snippet required:

  // Initial-Exec relocs can be relaxed to Local-Exec if the symbol is locally
  // defined.
  if (isTlsInitialExecRel(Type))
    return !S->isPreemptible();

So maybe to rename this change to 'Add aarch64 TLS IE to LE relax for local symbol test'?

[1] http://reviews.llvm.org/D18330


Repository:
  rL LLVM

http://reviews.llvm.org/D18333





More information about the llvm-commits mailing list