[llvm] [XCOFF] Use RLDs to print branches even without -r (PR #74342)

via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 19 14:04:08 PST 2023


================
@@ -2013,6 +2022,26 @@ disassembleObject(ObjectFile &Obj, const ObjectFile &DbgObj,
           }
         }
 
+        auto findRel = [&]() {
+          while (RelCur != RelEnd) {
+            RelOffset = RelCur->getOffset() - RelAdjustment;
+            // If this relocation is hidden, skip it.
+            if (getHidden(*RelCur) || SectionAddr + RelOffset < StartAddress) {
+              ++RelCur;
+              continue;
+            }
+
+            // Stop when RelCur's offset is past the disassembled
+            // instruction/data.
+            if (RelOffset >= Index + Size)
+              return false;
+            if (RelOffset >= Index)
+              return true;
----------------
diggerlin wrote:

suggest change these four lines
```
if (RelOffset >= Index + Size)
              return false;
 if (RelOffset >= Index)
              return true;

```
 to 
  ```
  if (RelOffset >= Index)
     return RelOffset >= Index + Size ? false : true;
```

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


More information about the llvm-commits mailing list