[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
This commit is contained in:
Job Noorman 2023-05-16 09:23:26 +02:00
parent 4054c68644
commit 8a5a12057e

View File

@ -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: