From 93097307f32a8b715ebba1336324e965847a7fe4 Mon Sep 17 00:00:00 2001 From: Nicolas Kruse Date: Mon, 3 Nov 2025 23:12:02 +0100 Subject: [PATCH] get_op_after_last_call_in_function fixed --- src/copapy/_stencils.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/copapy/_stencils.py b/src/copapy/_stencils.py index 771cffb..fd693cb 100644 --- a/src/copapy/_stencils.py +++ b/src/copapy/_stencils.py @@ -73,10 +73,8 @@ def get_op_after_last_call_in_function(func: elf_symbol) -> int: # Find last relocation in function assert func.relocations, f'No call function in stencil function {func.name}.' reloc = func.relocations[-1] - if reloc.bits < 32: - return reloc.fields['r_offset'] - func.fields['st_value'] - reloc.fields['r_addend'] + 4 - else: - return reloc.fields['r_offset'] - func.fields['st_value'] - reloc.fields['r_addend'] + assert reloc.bits <= 32, "Relocation segment might be larger then 32 bit" + return reloc.fields['r_offset'] - func.fields['st_value'] + 4 def symbol_is_stencil(sym: elf_symbol) -> bool: