[all-commits] [llvm/llvm-project] 94821c: MCValue: Store SymA specifier at Specifier

Fangrui Song via All-commits all-commits at lists.llvm.org
Sat Apr 5 17:17:17 PDT 2025


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

  Changed paths:
    M llvm/include/llvm/MC/MCExpr.h
    M llvm/include/llvm/MC/MCValue.h
    M llvm/lib/MC/MCAssembler.cpp
    M llvm/lib/MC/MCExpr.cpp
    M llvm/lib/MC/MCValue.cpp
    M llvm/lib/Target/AArch64/MCTargetDesc/AArch64AsmBackend.cpp
    M llvm/lib/Target/AArch64/MCTargetDesc/AArch64ELFObjectWriter.cpp
    M llvm/lib/Target/PowerPC/MCTargetDesc/PPCELFObjectWriter.cpp
    M llvm/lib/Target/RISCV/MCTargetDesc/RISCVELFObjectWriter.cpp
    M llvm/test/MC/AArch64/elf-reloc-ptrauth.s
    M llvm/test/MC/CSKY/relocation-specifier.s

  Log Message:
  -----------
  MCValue: Store SymA specifier at Specifier

The relocation specifier should be accessed via MCValue::Specifier.
However, some targets encode the relocation specifier within SymA using
MCSymbolRefExpr::SubclassData and access it via getAccessVariant(), though
this method is now deprecated.

This change stores the SymA specifier at Specifier as well, unifying the
two code paths.

* CSKY: GOT- and PLT- relocations now suppress the STT_SECTION
  conversion.
* AArch64: https://reviews.llvm.org/D156505 added `getRefkind` check to
  prevent folding. This is a hack and is now removed.

MCValue: Unify relocation specifier storage by storing SymA specifier at Specifier

The relocation specifier is accessed via MCValue::Specifier, but some
targets encoded it within SymA using MCSymbolRefExpr::SubclassData and
retrieved it through the now-deprecated getAccessVariant() method. This
commit unifies the two approaches by storing the SymA specifier at
`Specifier` as well.

Additional changes:

- CSKY: GOT- and PLT- relocations now suppress STT_SECTION conversion.
- AArch64: Removed the `getRefkind` check hack (introduced in https://reviews.llvm.org/D156505) that prevented folding.
  Removed the assertion from `getRelocType`.
- RISCV: Removed the assertion from `getRelocType`.

Future plans:

- Replace MCSymbolRefExpr members with MCSymbol within MCValue.
- Remove `getSymSpecifier` (added for migration).



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