[llvm] [RISCV] Omit "@plt" in assembler output "call foo at plt" (PR #72467)

Fangrui Song via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 15 20:55:24 PST 2023


================
@@ -41,8 +41,6 @@ void RISCVMCExpr::printImpl(raw_ostream &OS, const MCAsmInfo *MAI) const {
   if (HasVariant)
     OS << '%' << getVariantKindName(getKind()) << '(';
   Expr->print(OS, MAI);
-  if (Kind == VK_RISCV_CALL_PLT)
-    OS << "@plt";
----------------
MaskRay wrote:

As explained in the description, always emitting `@plt` would lead to `jump .L1 at plt, a0`, which is invalid in assembly.

`@plt` has two purposes today: (a) redundant suffix in `call` and `jump` (b) `.word x at plt` for `R_RISCV_PLT32`.

Never emitting `@plt` ensures that compiler output always uses `@plt` for one single purpose.

https://github.com/llvm/llvm-project/pull/72467


More information about the llvm-commits mailing list