[all-commits] [llvm/llvm-project] c8121b: [RISCV] Xqcilb: remove RISCVMCExpr::VK_QC_E_JUMP_P...

Fangrui Song via All-commits all-commits at lists.llvm.org
Tue Apr 15 09:10:26 PDT 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: c8121b99a99fe1785add732aa062039b7c5fdd32
      https://github.com/llvm/llvm-project/commit/c8121b99a99fe1785add732aa062039b7c5fdd32
  Author: Fangrui Song <i at maskray.me>
  Date:   2025-04-15 (Tue, 15 Apr 2025)

  Changed paths:
    M llvm/lib/Target/RISCV/AsmParser/RISCVAsmParser.cpp
    M llvm/lib/Target/RISCV/MCTargetDesc/RISCVMCCodeEmitter.cpp
    M llvm/lib/Target/RISCV/MCTargetDesc/RISCVMCExpr.cpp
    M llvm/lib/Target/RISCV/MCTargetDesc/RISCVMCExpr.h
    M llvm/lib/Target/RISCV/RISCVInstrInfoXqci.td
    M llvm/test/MC/RISCV/xqcilb-invalid.s
    M llvm/test/MC/RISCV/xqcilb-relocations.s

  Log Message:
  -----------
  [RISCV] Xqcilb: remove RISCVMCExpr::VK_QC_E_JUMP_PLT and drop `@plt` parsing

Follow-up to the just landed #135044 . Remove `@plt` parsing (only
needed by legacy `call foo at plt`). MCParser's `@` parsing is problematic.
Supporting target variations like (`foo+2 at plt foo at plt+2 (foo+2)@plt`)
involves messy hacks. We should refrain from adding new `@` uses.

Remove unneeded `RISCVMCExpr::VK_QC_E_JUMP_PLT` (should only be used
when an instruction might have multiple reasonable relocations
https://maskray.me/blog/2025-03-16-relocation-generation-in-assemblers).

---

GCC's initial initial RISC-V port made a mistake by having both `call
foo` (non-PIC) and `call foo at plt` (PIC), likely misled by x86/SystemZ.
It was determined that the `@plt` was not needed. Since R_RISCV_CALL had
questionable undefined weak semantics in GNU ld (which has been removed
then), we kept R_RISCV_CALL_PLT and deprecated R_RISCV_CALL.

For RISC-V instructions, we only keep `@` in call/jump for backward
compatibility and discourage it for all other instructions.

(
There is disagreement about whether `PLT` in `JUMP_PLT` is useful or
misleading.
MaskRay's opnion: For new branch relocations with procedure call
semantics, use `_CALL` and avoid `_PLT` in the relocation name.
`_PLT` should only be used in data directives (e.g. R_RISCV_PLT32) to
indicate that the address of a function is not significant.
)

Pull Request: https://github.com/llvm/llvm-project/pull/135507



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list