From 10f34dd5e321940f3ad840e37ba6f1ca3111872d Mon Sep 17 00:00:00 2001 From: Catena cyber <35799796+catenacyber@users.noreply.github.com> Date: Thu, 14 Oct 2021 21:03:16 +0200 Subject: [PATCH] profraw: fix python uint64 for difference (#6603) And use right column for section address --- infra/base-images/base-runner/profraw_update.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/infra/base-images/base-runner/profraw_update.py b/infra/base-images/base-runner/profraw_update.py index ba6bbe6ac..bd2bf41cc 100755 --- a/infra/base-images/base-runner/profraw_update.py +++ b/infra/base-images/base-runner/profraw_update.py @@ -70,7 +70,8 @@ def upgrade(data, sect_prf_cnts, sect_prf_data): data = data[:88 + v7_header.BinaryIdsSize] + bytes( padlen) + data[88 + v7_header.BinaryIdsSize:] - if v7_header.CountersDelta != sect_prf_cnts - sect_prf_data: + if v7_header.CountersDelta != (sect_prf_cnts - + sect_prf_data) & 0xffffffffffffffff: # Rust linking seems to add an offset... sect_prf_data = v7_header.CountersDelta - sect_prf_cnts + sect_prf_data sect_prf_cnts = v7_header.CountersDelta @@ -108,9 +109,9 @@ def main(): return 2 for line in iter(output.split(b'\n')): if b'__llvm_prf_cnts' in line: - sect_prf_cnts = int(line.split()[4], 16) + sect_prf_cnts = int(line.split()[3], 16) elif b'__llvm_prf_data' in line: - sect_prf_data = int(line.split()[4], 16) + sect_prf_data = int(line.split()[3], 16) # Then open and read the input profraw file. with open(sys.argv[2], 'rb') as input_file: