[llvm] [MC][AMDGPU] Support .reloc BFD_RELOC_{NONE, 32, 64} (PR #114617)

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 5 10:34:46 PST 2024


================
@@ -163,12 +163,17 @@ void AMDGPUAsmBackend::applyFixup(const MCAssembler &Asm, const MCFixup &Fixup,
 
 std::optional<MCFixupKind>
 AMDGPUAsmBackend::getFixupKind(StringRef Name) const {
-  return StringSwitch<std::optional<MCFixupKind>>(Name)
-#define ELF_RELOC(Name, Value)                                                 \
-  .Case(#Name, MCFixupKind(FirstLiteralRelocationKind + Value))
+  auto Type = StringSwitch<unsigned>(Name)
+#define ELF_RELOC(Name, Value) .Case(#Name, Value)
 #include "llvm/BinaryFormat/ELFRelocs/AMDGPU.def"
 #undef ELF_RELOC
-      .Default(std::nullopt);
+                  .Case("BFD_RELOC_NONE", ELF::R_AMDGPU_NONE)
+                  .Case("BFD_RELOC_32", ELF::R_AMDGPU_ABS32)
+                  .Case("BFD_RELOC_64", ELF::R_AMDGPU_ABS64)
----------------
arsenm wrote:

I have no idea why it's like this, why wouldn't these all be in the def? I guess it's fine to copy the pattern and clean them all later? 

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


More information about the llvm-commits mailing list