From 8a5a12057e9e324c73e962d8fc9c6dfdbad31dcb Mon Sep 17 00:00:00 2001 From: Job Noorman Date: Tue, 16 May 2023 09:23:26 +0200 Subject: [BOLT][Wrapper] Fix off-by-one in find_section upper limit find_section used to match offsets equal to file_offset + size causing offsets to sometimes be attributed to the wrong section. Reviewed By: Amir Differential Revision: https://reviews.llvm.org/D149047 --- bolt/utils/llvm-bolt-wrapper.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'bolt') diff --git a/bolt/utils/llvm-bolt-wrapper.py b/bolt/utils/llvm-bolt-wrapper.py index a6d863ce7caa..901304d134ee 100755 --- a/bolt/utils/llvm-bolt-wrapper.py +++ b/bolt/utils/llvm-bolt-wrapper.py @@ -246,7 +246,7 @@ def find_section(offset, readelf_hdr): 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: -- cgit v1.2.1