Assertion error with @PLT modifier

Hi all,

I’m hitting this assertion error in llvm:

clang-11: /usr/local/google/home/leonardchan/llvm-monorepo/llvm-project-2/llvm/lib/Target/AArch64/MCTargetDesc/AArch64ELFObjectWriter.cpp:119: virtual unsigned int (anonymous namespace)::AArch64ELFObjectWriter::getRelocType(llvm::MCContext &, const llvm::MCValue &, const llvm::MCFixup &, bool) const: Assertion `(!Target.getSymA() || Target.getSymA()->getKind() == MCSymbolRefExpr::VK_None) && "Should only be expression-level modifiers here"' failed.

when attempting to compile

.word func@PLT - .

for aarch64-unknown-linux. This assertion only appears when adding the @PLT. Otherwise, it compiles without errors. From what I understand, this syntax should still be valid for AArch64. Is there another reason this assertion is triggered, or perhaps there’s something invalid with my example?

The context is I’m attempting to implement a new AArch64 relocation (see for reference) which attempts to take the relative offset to a function. If it’s not dso_local, we should instead take the offset to the PLT entry for it. I know how to programatically add it through [PLTRelativeVariantKind]( used by lowerRelativeReference(), but setting this to anything other than VK_None for AArch64 results in this assertion error.


CCing Tim Northover who authored the assertion.