[lld] r250101 - [ELF2] Add a base set of PPC64 relocations
Rafael EspĂndola via llvm-commits
llvm-commits at lists.llvm.org
Tue Oct 13 07:04:54 PDT 2015
> + // FIXME: This obviously does not do the right thing when there is no .got
> + // section, but there is a .toc or .tocbss section.
> + uint64_t TocVA = Out<ELF64BE>::Got->getVA();
> + if (!TocVA)
> + TocVA = Out<ELF64BE>::Plt->getVA();
There is always a got if there is a plt, so this could be an assert, no?
> + switch (Type) {
> + default: return false;
git-clang-format.
> +
> bool PPC64TargetInfo::relocNeedsPlt(uint32_t Type, const SymbolBody &S) const {
> - return false;
> + if (Type != R_PPC64_REL24)
> + return false;
> +
> + // These are function calls that need to be redirected through a PLT stub.
> + return S.isShared() || (S.isUndefined() && S.isWeak());
> }
Why the extra "(S.isUndefined() && S.isWeak())"?
Is this here for the same reason as X86_64 and i386? If so, you only
need the S.isShared(), no?
> + // For a TOC-relative relocation, adjust the addend and proceed in terms of
> + // the corresponding ADDR16 relocation type.
> switch (Type) {
> - case R_PPC64_ADDR64:
> - write64be(Loc, SymVA + Rel.r_addend);
> + case R_PPC64_TOC16: Type = R_PPC64_ADDR16; A -= TB; break;
> + case R_PPC64_TOC16_DS: Type = R_PPC64_ADDR16_DS; A -= TB; break;
> + case R_PPC64_TOC16_LO: Type = R_PPC64_ADDR16_LO; A -= TB; break;
> + case R_PPC64_TOC16_LO_DS: Type = R_PPC64_ADDR16_LO_DS; A -= TB; break;
> + case R_PPC64_TOC16_HI: Type = R_PPC64_ADDR16_HI; A -= TB; break;
> + case R_PPC64_TOC16_HA: Type = R_PPC64_ADDR16_HA; A -= TB; break;
> + default: break;
git-clang-format.
More information about the llvm-commits
mailing list