[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:06 PDT 2024


================
@@ -4888,6 +4920,34 @@ void ELFDumper<ELFT>::printRelocationsHelper(const Elf_Shdr &Sec) {
 
 template <class ELFT> void ELFDumper<ELFT>::printDynamicRelocationsHelper() {
   const bool IsMips64EL = this->Obj.isMips64EL();
+  auto DumpCrelRegion = [&](DynRegionInfo &Region) {
+    // While the size is unknown, a valid CREL has at least one byte. We can
+    // check whether Addr is in bounds, and then decode CREL until the file
+    // end.
+    Region.Size = Region.EntSize = 1;
+    if (!Region.template getAsArrayRef<uint8_t>().empty()) {
+      const uint64_t Offset =
+          Region.Addr -
+          (const uint8_t *)ObjF.getMemoryBufferRef().getBufferStart();
----------------
jh7370 wrote:

Nit: reinterpret_cast

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


More information about the cfe-commits mailing list