================
@@ -1278,29 +1285,69 @@ void ELFState<ELFT>::writeSectionContent(
   if (!Section.Relocations)
     return;
 
+  const bool IsCrel = Section.Type == llvm::ELF::SHT_CREL;
   const bool IsRela = Section.Type == llvm::ELF::SHT_RELA;
+  typename ELFT::uint OffsetMask = 8, Offset = 0, Addend = 0;
+  uint32_t Symidx = 0, Type = 0;
+  uint64_t CurrentOffset = CBA.getOffset();
+  if (IsCrel)
----------------
smithp35 wrote:

Looking at the implementation of `encodeCrel` in ELFObjectWriter.cpp the 
algorithm used is the same, but there are some comment differences that could 
apply to both. I think it would be helpful to use the same comments in both 
implementations. For example at this point there is:
```
    // The delta offset and flags member may be larger than uint64_t. Special
    // case the first byte (3 flag bits and 4 offset bits). Other ULEB128 bytes
    // encode the remaining delta offset bits.
```

https://github.com/llvm/llvm-project/pull/91280
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to