[PATCH] D149047: [BOLT][Wrapper] Fix off-by-one in find_section upper limit

Job Noorman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 24 02:40:11 PDT 2023


jobnoorman created this revision.
jobnoorman added reviewers: rafauler, maksfb, yota9, Amir.
Herald added subscribers: asb, treapster, pmatos, ayermolo.
Herald added a project: All.
jobnoorman requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

find_section used to match offsets equal to file_offset + size causing
offsets to sometimes be attributed to the wrong section.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D149047

Files:
  bolt/utils/llvm-bolt-wrapper.py


Index: bolt/utils/llvm-bolt-wrapper.py
===================================================================
--- bolt/utils/llvm-bolt-wrapper.py
+++ bolt/utils/llvm-bolt-wrapper.py
@@ -246,7 +246,7 @@
         file_offset = int(cols[5], 16)
         # section size
         size = int(cols[2], 16)
-        if offset >= file_offset and offset <= file_offset + size:
+        if offset >= file_offset and offset < file_offset + size:
             if sys.stdout.isatty(): # terminal supports colors
                 print(f"\033[1m{line}\033[0m")
             else:


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D149047.516329.patch
Type: text/x-patch
Size: 562 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230424/58e43a92/attachment.bin>


More information about the llvm-commits mailing list