[all-commits] [llvm/llvm-project] 68472a: [MC] Restore MCAsmBackend::shouldForceRelocation t...

Fangrui Song via All-commits all-commits at lists.llvm.org
Thu May 22 09:49:50 PDT 2025


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

  Changed paths:
    M llvm/include/llvm/MC/MCAsmBackend.h
    M llvm/lib/MC/MCAsmBackend.cpp
    M llvm/lib/Target/Sparc/MCTargetDesc/SparcAsmBackend.cpp
    M llvm/lib/Target/SystemZ/MCTargetDesc/SystemZMCAsmBackend.cpp
    M llvm/lib/Target/X86/MCTargetDesc/X86AsmBackend.cpp

  Log Message:
  -----------
  [MC] Restore MCAsmBackend::shouldForceRelocation to false

For IsPCRel fixups, we had the `A->getKind() != MCSymbolRefExpr::VK_None`
condition to force relocations. The condition has then been changed to
`Target.getSpecifier()` (086af836889436baffc71c743c7c8259bad8ed60).

38c3ad36be1facbe6db2dede7e93c0f12fb4e1dc updated
shouldForceRelocation to test `Target.getSpecifier`.
It is not a good fit as many targets with %lo/%hi style specifiers
(SPARC, MIPS, PowerPC, RISC-V) do not force relocations for these
specifiers.

Revert the Target.getSpecifier implementation
(38c3ad36be1facbe6db2dede7e93c0f12fb4e1dc) and update
targets that need it (SystemZAsmBackend/X86AsmBackend) instead.
Targets need customization might define addReloc instead.

Note: The X86AsmBackend implementation is too conservative.
GNU Assembler doesn't emit a relocation for `call local at plt; local`
a3d39316764726ed9fd939550c7781199b1eb77e added missing coverage
for GOT/PLT related relocations.



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