[all-commits] [llvm/llvm-project] 1ec9dd: Sparc: Refactor R_SPARC_13/R_SPARC_GOT13 handling ...

Fangrui Song via All-commits all-commits at lists.llvm.org
Sat May 3 22:50:50 PDT 2025


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

  Changed paths:
    M llvm/lib/Target/Sparc/AsmParser/SparcAsmParser.cpp
    M llvm/lib/Target/Sparc/MCTargetDesc/SparcELFObjectWriter.cpp
    M llvm/lib/Target/Sparc/MCTargetDesc/SparcMCCodeEmitter.cpp
    M llvm/lib/Target/Sparc/SparcInstrInfo.td
    M llvm/test/MC/Sparc/sparc-fixups.s

  Log Message:
  -----------
  Sparc: Refactor R_SPARC_13/R_SPARC_GOT13 handling and fix a bug referencing absolute symbol

https://reviews.llvm.org/D47136 did not correctly handle `ld [%i0 + abs], %o0; abs = 7`

To fix it and make fixup handling less hacky,

* Change TableGen MEMri to use simm13Op instead of i32imm
* Emit a fixup of kind fixup_sparc_13 in SparcMCCodeEmitter::getSImm13OpValue
* Convert fixup_sparc_13 to either R_SPARC_13/R_SPARC_GOT13 in getRelocType

This postpones 13/GOT13 decision to relocation generation, ensuring that
we suppress the relocation when referencing an absolute symbol, matching
gas.



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