[clang] [llvm] [MC,llvm-readobj,yaml2obj] Support CREL relocation format (PR #91280)

James Henderson via cfe-commits cfe-commits at lists.llvm.org
Wed Jun 19 06:39:05 PDT 2024


================
@@ -474,9 +480,29 @@ struct Elf_Rel_Impl<ELFType<Endianness, true>, true>
     : public Elf_Rel_Impl<ELFType<Endianness, true>, false> {
   LLVM_ELF_IMPORT_TYPES(Endianness, true)
   static const bool IsRela = true;
+  static const bool IsCrel = false;
   Elf_Sxword r_addend; // Compute value for relocatable field by adding this.
 };
 
+// In-memory representation. The serialized representation uses LEB128.
+template <bool Is64> struct Elf_Crel_Impl {
+  using uint = std::conditional_t<Is64, uint64_t, uint32_t>;
+  static const bool IsRela = true;
----------------
jh7370 wrote:

This variable feels misnamed now. If its meaning is "relocation contains addend" rather than "relocation's addend is in the code" or something (I haven't attempted to figure out if that is what this is actually used for), then perhaps it needs renaming to something else.

After all, when I read the variable name, I think it means "is this an Elf_Rela" relocation, when the answer should be "no" for this type, since it is an "Elf_Crel".

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


More information about the cfe-commits mailing list